From: Sergey Matveev Date: Wed, 17 Jul 2019 15:09:59 +0000 (+0300) Subject: Reuse pos() method X-Git-Tag: 3.0~4 X-Git-Url: http://www.git.cypherpunks.ru/?p=gogost.git;a=commitdiff_plain;h=cc6addfa724ba7b7d3119e9171c65298f0711ac4 Reuse pos() method --- 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 }