// GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2018 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2015-2019 Sergey Matveev <stargrave@stargrave.org>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
)
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
}
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 {