X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgogost%2Fgost3410%2F2012_test.go;h=cbccee63bade8fb37a2c7605848651b68d81c8db;hb=64f9decbd53306c271661bf70a232963f75365a3;hp=71a2a0fc97066bd5bc94698c78f48d6e77a6f975;hpb=d1cbfa307ebcb72b61f926dfdbc21175a3eec1a8;p=gogost.git diff --git a/src/cypherpunks.ru/gogost/gost3410/2012_test.go b/src/cypherpunks.ru/gogost/gost3410/2012_test.go index 71a2a0f..cbccee6 100644 --- a/src/cypherpunks.ru/gogost/gost3410/2012_test.go +++ b/src/cypherpunks.ru/gogost/gost3410/2012_test.go @@ -1,5 +1,5 @@ // GoGOST -- Pure Go GOST cryptographic functions library -// Copyright (C) 2015-2018 Sergey Matveev +// Copyright (C) 2015-2019 Sergey Matveev // // 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 @@ -142,7 +142,14 @@ func TestGCL3Vectors(t *testing.T) { 0x60, 0xC9, 0x3B, 0xCB, 0xCD, 0x9C, 0x5C, 0x33, 0x17, 0xE1, 0x93, 0x44, 0xE1, 0x73, 0xAE, 0x36, } - c, err := NewCurve(p, q, a, b, x, y) + c, err := NewCurve( + bytes2big(p), + bytes2big(q), + bytes2big(a), + bytes2big(b), + bytes2big(x), + bytes2big(y), + ) if err != nil { t.FailNow() } @@ -175,12 +182,12 @@ func TestGCL3Vectors(t *testing.T) { } func TestRandom2012(t *testing.T) { - c, _ := NewCurveFromParams(CurveParamsGostR34102012TC26ParamSetA) - f := func(data [31]byte, digest [64]byte) bool { + c := CurveIdtc26gost341012512paramSetA() + f := func(prvRaw [64 - 1]byte, digest [64]byte) bool { prv, err := NewPrivateKey( c, Mode2012, - append([]byte{0xde}, data[:]...), + append([]byte{0xde}, prvRaw[:]...), ) if err != nil { return false @@ -210,7 +217,7 @@ func TestRandom2012(t *testing.T) { } func BenchmarkSign2012(b *testing.B) { - c, _ := NewCurveFromParams(CurveParamsGostR34102012TC26ParamSetA) + c := CurveIdtc26gost341012512paramSetA() prv, err := GenPrivateKey(c, Mode2012, rand.Reader) if err != nil { b.FailNow() @@ -224,7 +231,7 @@ func BenchmarkSign2012(b *testing.B) { } func BenchmarkVerify2012(b *testing.B) { - c, _ := NewCurveFromParams(CurveParamsGostR34102012TC26ParamSetA) + c := CurveIdtc26gost341012512paramSetA() prv, err := GenPrivateKey(c, Mode2012, rand.Reader) if err != nil { b.FailNow()