// GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2015-2021 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
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 {