]> Cypherpunks.ru repositories - gogost.git/blobdiff - gost3410/vko.go
Fixed VKO cofactor bug
[gogost.git] / gost3410 / vko.go
index bb10f9430b98bbf818c24e2bbb912bafb8fffa6e..e373e4a6c2a63ef290fd77ec0652f436d1a68f28 100644 (file)
@@ -1,5 +1,5 @@
 // GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2019 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2015-2020 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
@@ -24,6 +24,7 @@ func (prv *PrivateKey) KEK(pub *PublicKey, ukm *big.Int) ([]byte, error) {
        if err != nil {
                return nil, err
        }
+       ukm = ukm.Mul(ukm, prv.C.Co)
        if ukm.Cmp(bigInt1) != 0 {
                keyX, keyY, err = prv.C.Exp(ukm, keyX, keyY)
                if err != nil {