]> Cypherpunks.ru repositories - gogost.git/blobdiff - src/cypherpunks.ru/gogost/gost3410/2012_test.go
Simplify 34.10 curve creation from parameters
[gogost.git] / src / cypherpunks.ru / gogost / gost3410 / 2012_test.go
index fc2d61a51952e8c3d1711a9bae9ce4ed8078050b..c2942dd630498ae04f2ee8fd0df69090536062d3 100644 (file)
@@ -1,5 +1,5 @@
 // GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2016 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
@@ -146,7 +146,7 @@ func TestGCL3Vectors(t *testing.T) {
        if err != nil {
                t.FailNow()
        }
-       prv, err := NewPrivateKey(c, DigestSize2012, priv)
+       prv, err := NewPrivateKey(c, Mode2012, priv)
        if err != nil {
                t.FailNow()
        }
@@ -175,11 +175,11 @@ func TestGCL3Vectors(t *testing.T) {
 }
 
 func TestRandom2012(t *testing.T) {
-       c, _ := NewCurveFromParams(CurveParamsGostR34102012TC26ParamSetA)
+       c := CurveIdtc26gost341012512paramSetA()
        f := func(data [31]byte, digest [64]byte) bool {
                prv, err := NewPrivateKey(
                        c,
-                       DigestSize2012,
+                       Mode2012,
                        append([]byte{0xde}, data[:]...),
                )
                if err != nil {
@@ -190,7 +190,7 @@ func TestRandom2012(t *testing.T) {
                        return false
                }
                pubRaw := pub.Raw()
-               pub, err = NewPublicKey(c, DigestSize2012, pubRaw)
+               pub, err = NewPublicKey(c, Mode2012, pubRaw)
                if err != nil {
                        return false
                }
@@ -210,8 +210,8 @@ func TestRandom2012(t *testing.T) {
 }
 
 func BenchmarkSign2012(b *testing.B) {
-       c, _ := NewCurveFromParams(CurveParamsGostR34102012TC26ParamSetA)
-       prv, err := GenPrivateKey(c, DigestSize2012, rand.Reader)
+       c := CurveIdtc26gost341012512paramSetA()
+       prv, err := GenPrivateKey(c, Mode2012, rand.Reader)
        if err != nil {
                b.FailNow()
        }
@@ -224,8 +224,8 @@ func BenchmarkSign2012(b *testing.B) {
 }
 
 func BenchmarkVerify2012(b *testing.B) {
-       c, _ := NewCurveFromParams(CurveParamsGostR34102012TC26ParamSetA)
-       prv, err := GenPrivateKey(c, DigestSize2012, rand.Reader)
+       c := CurveIdtc26gost341012512paramSetA()
+       prv, err := GenPrivateKey(c, Mode2012, rand.Reader)
        if err != nil {
                b.FailNow()
        }