mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-17 21:26:04 +00:00
GOST R 34.10 curve added
This commit is contained in:
parent
044d6a2207
commit
5dfb7cb938
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user