From cc6addfa724ba7b7d3119e9171c65298f0711ac4 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Wed, 17 Jul 2019 18:09:59 +0300 Subject: [PATCH] Reuse pos() method --- src/cypherpunks.ru/gogost/gost3410/curve.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cypherpunks.ru/gogost/gost3410/curve.go b/src/cypherpunks.ru/gogost/gost3410/curve.go index 623ee68..0ad10c9 100644 --- a/src/cypherpunks.ru/gogost/gost3410/curve.go +++ b/src/cypherpunks.ru/gogost/gost3410/curve.go @@ -67,12 +67,11 @@ func NewCurve(p, q, a, b, bx, by []byte) (*Curve, error) { r2.Mul(r2, c.X) r2.Add(r2, c.B) r2.Mod(r2, c.P) - if r2.Cmp(big.NewInt(0)) == -1 { - r2.Add(r2, c.P) - } + c.pos(r2) if r1.Cmp(r2) != 0 { return nil, errors.New("Invalid curve parameters") } + } return &c, nil } -- 2.44.0