import (
"bytes"
"encoding/hex"
+ "math/big"
"testing"
"testing/quick"
)
}
}
+func TestVKOUKMAltering(t *testing.T) {
+ c := CurveIdtc26gost34102012256paramSetA()
+ ukm := big.NewInt(1)
+ prv, err := NewPrivateKey(c, bytes.Repeat([]byte{0x12}, 32))
+ if err != nil {
+ panic(err)
+ }
+ pub, err := prv.PublicKey()
+ if err != nil {
+ panic(err)
+ }
+ _, err = prv.KEK(pub, ukm)
+ if err != nil {
+ panic(err)
+ }
+ if ukm.Cmp(big.NewInt(1)) != 0 {
+ t.FailNow()
+ }
+}
+
func TestRandomVKO2001(t *testing.T) {
c := CurveIdGostR34102001TestParamSet()
f := func(prvRaw1 [32]byte, prvRaw2 [32]byte, ukmRaw [8]byte) bool {