X-Git-Url: http://www.git.cypherpunks.ru/?p=gogost.git;a=blobdiff_plain;f=gost3410%2Fvko2001_test.go;h=80e30ad3a9c435f96719c374e81f156f51678aa8;hp=3f807338cca2432c141e69f049a2b232c384dfc5;hb=f4078e53da769ade0d92e80ad9093040e7f71d58;hpb=f259d4aaa9a6c3c44f0d9d533a87751e0540b1c9;ds=sidebyside diff --git a/gost3410/vko2001_test.go b/gost3410/vko2001_test.go index 3f80733..80e30ad 100644 --- a/gost3410/vko2001_test.go +++ b/gost3410/vko2001_test.go @@ -18,6 +18,7 @@ package gost3410 import ( "bytes" "encoding/hex" + "math/big" "testing" "testing/quick" ) @@ -43,6 +44,26 @@ func TestVKO2001(t *testing.T) { } } +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 {