From 5dfb7cb938e84471462b28e1b085ab21789bcc8e Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 7 Mar 2017 16:36:17 -0500 Subject: [PATCH] GOST R 34.10 curve added --- Signature.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Signature.cpp b/Signature.cpp index 7571760a..72343761 100644 --- a/Signature.cpp +++ b/Signature.cpp @@ -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; + }; + } }