X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=gost3410%2Fcurve.go;h=a3685ce047e7be3b7c11ea58f649c09761255d46;hb=4581b7b9da29fc47d4831c1c4b98af2afa40a3cf;hp=696beabed9a68889675f9b96237a924fff30ea91;hpb=4f46a270096b061794b63d7c418cb6ee56af8879;p=gogost.git diff --git a/gost3410/curve.go b/gost3410/curve.go index 696beab..a3685ce 100644 --- a/gost3410/curve.go +++ b/gost3410/curve.go @@ -25,6 +25,7 @@ var ( bigInt1 *big.Int = big.NewInt(1) bigInt2 *big.Int = big.NewInt(2) bigInt3 *big.Int = big.NewInt(3) + bigInt4 *big.Int = big.NewInt(4) ) type Curve struct { @@ -33,6 +34,8 @@ type Curve struct { P *big.Int // Characteristic of the underlying prime field Q *big.Int // Elliptic curve subgroup order + Co *big.Int // Cofactor + // Equation coefficients of the elliptic curve in canonical form A *big.Int B *big.Int @@ -55,7 +58,7 @@ type Curve struct { edT *big.Int } -func NewCurve(p, q, a, b, x, y, e, d *big.Int) (*Curve, error) { +func NewCurve(p, q, a, b, x, y, e, d, co *big.Int) (*Curve, error) { c := Curve{ Name: "unknown", P: p, @@ -85,6 +88,11 @@ func NewCurve(p, q, a, b, x, y, e, d *big.Int) (*Curve, error) { c.E = e c.D = d } + if co == nil { + c.Co = bigInt1 + } else { + c.Co = co + } return &c, nil }