From 2a099125469e28649d63f8a5c352ba957ee87700 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Wed, 17 Jul 2019 18:03:39 +0300 Subject: [PATCH] Rename gost3410.Curve Bx/By parameters to X/Y for simplicity --- src/cypherpunks.ru/gogost/gost3410/curve.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/cypherpunks.ru/gogost/gost3410/curve.go b/src/cypherpunks.ru/gogost/gost3410/curve.go index a8efdcc..623ee68 100644 --- a/src/cypherpunks.ru/gogost/gost3410/curve.go +++ b/src/cypherpunks.ru/gogost/gost3410/curve.go @@ -29,14 +29,16 @@ var ( ) type Curve struct { - P *big.Int - Q *big.Int + P *big.Int // Characteristic of the underlying prime field + Q *big.Int // Elliptic curve subgroup order + + // Equation coefficients of the elliptic curve in canonical form A *big.Int B *big.Int // Basic point X and Y coordinates - Bx *big.Int - By *big.Int + X *big.Int + Y *big.Int // Temporary variable for the add method t *big.Int @@ -58,11 +60,11 @@ func NewCurve(p, q, a, b, bx, by []byte) (*Curve, error) { } r1 := big.NewInt(0) r2 := big.NewInt(0) - r1.Mul(c.By, c.By) + r1.Mul(c.Y, c.Y) r1.Mod(r1, c.P) - r2.Mul(c.Bx, c.Bx) + r2.Mul(c.X, c.X) r2.Add(r2, c.A) - r2.Mul(r2, c.Bx) + r2.Mul(r2, c.X) r2.Add(r2, c.B) r2.Mod(r2, c.P) if r2.Cmp(big.NewInt(0)) == -1 { -- 2.44.0