gogost.go | 2 +- gost3410/curve.go | 12 ++++++++++++ gost3410/public.go | 9 +++++++++ news.texi | 4 ++++ diff --git a/gogost.go b/gogost.go index 0141a62871a6e7ddec73ac332a75a694ff65460194478ccbe27843b92a6a8472..23355cd266cdc92233697f68729f801ccfb5936d41c93be0a06949b818b547b8 100644 --- a/gogost.go +++ b/gogost.go @@ -1,4 +1,4 @@ // Pure Go GOST cryptographic functions library. package gogost -const Version = "5.6.0" +const Version = "5.7.0" diff --git a/gost3410/curve.go b/gost3410/curve.go index 0bdac6531652b84d0845361fe9a383c06dd6334d545970c17960963788a9ddc9..dab3558db11814702db1d20cf4af550d78be9c999108a2af4f19344e7655e047 100644 --- a/gost3410/curve.go +++ b/gost3410/curve.go @@ -159,3 +159,15 @@ c.add(cx, cy, cx, cy) } return tx, ty, nil } + +func (our *Curve) Equal(their *Curve) bool { + return our.P.Cmp(their.P) == 0 && + our.Q.Cmp(their.Q) == 0 && + our.A.Cmp(their.A) == 0 && + our.B.Cmp(their.B) == 0 && + our.X.Cmp(their.X) == 0 && + our.Y.Cmp(their.Y) == 0 && + ((our.E == nil && their.E == nil) || our.E.Cmp(their.E) == 0) && + ((our.D == nil && their.D == nil) || our.D.Cmp(their.D) == 0) && + our.Co.Cmp(their.Co) == 0 +} diff --git a/gost3410/public.go b/gost3410/public.go index cd7c595af4c81456fe4b525174460a7563fe2c485beec5ee310440a563ad2247..144d2f0fe542cbcd23f460dbeb68ea3797747988db47c2b2a789476a49b718c0 100644 --- a/gost3410/public.go +++ b/gost3410/public.go @@ -16,6 +16,7 @@ package gost3410 import ( + "crypto" "fmt" "math/big" ) @@ -107,3 +108,11 @@ } lm.Mod(lm, pub.C.Q) return lm.Cmp(r) == 0, nil } + +func (our *PublicKey) Equal(theirKey crypto.PublicKey) bool { + their, ok := theirKey.(*PublicKey) + if !ok { + return false + } + return our.X.Cmp(their.X) == 0 && our.X.Cmp(their.Y) == 0 && our.C.Equal(their.C) +} diff --git a/news.texi b/news.texi index 07b52a6cdadf77a09f9c5288f80e4ddf968da04f1bc77de263fb6b4e3abe6db3..cf3aca95f2151f8119d20169e978aecd89c5891cf99748d4e439da0040e6e33f 100644 --- a/news.texi +++ b/news.texi @@ -3,6 +3,10 @@ @unnumbered News @table @strong +@anchor{Release 5.7.0} +@item 5.7.0 +Go 1.17 requires @code{gost3410.PublicKey} to have @code{Equal} method. + @anchor{Release 5.6.0} @item 5.6.0 @itemize