From 72a7a96239127f18c7597c101a2091c87fc91c5a Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 25 Jan 2021 17:51:25 +0300 Subject: [PATCH] PrivateKey % Q --- gogost.go | 2 +- gost3410/private.go | 2 +- news.texi | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gogost.go b/gogost.go index e6ded96..7b90a3b 100644 --- a/gogost.go +++ b/gogost.go @@ -1,4 +1,4 @@ // Pure Go GOST cryptographic functions library. package gogost -const Version = "5.4.0" +const Version = "5.5.0" diff --git a/gost3410/private.go b/gost3410/private.go index 4d73b07..237a906 100644 --- a/gost3410/private.go +++ b/gost3410/private.go @@ -41,7 +41,7 @@ func NewPrivateKey(curve *Curve, raw []byte) (*PrivateKey, error) { if k.Cmp(zero) == 0 { return nil, errors.New("gogost/gost3410: zero private key") } - return &PrivateKey{curve, k}, nil + return &PrivateKey{curve, k.Mod(k, curve.Q)}, nil } func GenPrivateKey(curve *Curve, rand io.Reader) (*PrivateKey, error) { diff --git a/news.texi b/news.texi index c825e47..919168c 100644 --- a/news.texi +++ b/news.texi @@ -3,6 +3,11 @@ @table @strong +@anchor{Release 5.5.0} +@item 5.5.0 + @code{gost3410.PrivateKey} is in @code{gost3410.Curve.Q} now. That + makes them more friendly with some implementations. + @anchor{Release 5.4.0} @item 5.4.0 Even slightly less allocations in Streebog. -- 2.44.0