GOST R 34.10 curve added

This commit is contained in:
orignal 2017-03-07 16:36:17 -05:00
parent 044d6a2207
commit 5dfb7cb938

View File

@ -492,6 +492,36 @@ namespace crypto
{
GetEd25519 ()->Sign (m_ExpandedPrivateKey, m_PublicKeyEncoded, buf, len, signature);
}
//----------------------------------------------
// GOST
class GOSTR3410
{
public:
GOSTR3410 (BIGNUM * a, BIGNUM * b, BIGNUM * p, BIGNUM * q, BIGNUM * x, BIGNUM * y)
{
BN_CTX * ctx = BN_CTX_new ();
m_Curve = EC_GROUP_new_curve_GFp (p, a, b, ctx);
EC_POINT * P = EC_POINT_new (m_Curve);
EC_POINT_set_affine_coordinates_GFp (m_Curve, P, x, y, ctx);
EC_GROUP_set_generator (m_Curve, P, q, nullptr);
EC_GROUP_set_curve_name (m_Curve, NID_id_GostR3410_2001);
EC_POINT_free(P);
BN_CTX_free (ctx);
}
~GOSTR3410 ()
{
EC_GROUP_free (m_Curve);
}
private:
EC_GROUP * m_Curve;
};
}
}