// 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
if err != nil {
t.FailNow()
}
- prv, err := NewPrivateKey(c, DigestSize2012, priv)
+ prv, err := NewPrivateKey(c, Mode2012, priv)
if err != nil {
t.FailNow()
}
}
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,
- DigestSize2012,
- append([]byte{0xde}, data[:]...),
+ Mode2012,
+ append([]byte{0xde}, prvRaw[:]...),
)
if err != nil {
return false
return false
}
pubRaw := pub.Raw()
- pub, err = NewPublicKey(c, DigestSize2012, pubRaw)
+ pub, err = NewPublicKey(c, Mode2012, pubRaw)
if err != nil {
return false
}
}
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()
}
}
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()
}