]> Cypherpunks.ru repositories - gogost.git/blobdiff - gost3410/vko2001_test.go
Raise copyright years
[gogost.git] / gost3410 / vko2001_test.go
index 3f807338cca2432c141e69f049a2b232c384dfc5..d956f1f74e8c41ace56ed3cdb5f123cacaa1cc86 100644 (file)
@@ -1,5 +1,5 @@
 // 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
@@ -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 {