X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=gost3410%2Fvko.go;h=b3036f577d2c7bd26a03ff38bdaa4442450ca3cb;hb=a575c072e60b46d792d31e665683e9fdd91f0bad;hp=fdf3a2f5cb191312f678297696745d75964049f6;hpb=7ed4c1e0857134c14ef5c03dee48c1cc7a555e98;p=gogost.git diff --git a/gost3410/vko.go b/gost3410/vko.go index fdf3a2f..b3036f5 100644 --- a/gost3410/vko.go +++ b/gost3410/vko.go @@ -1,5 +1,5 @@ // GoGOST -- Pure Go GOST cryptographic functions library -// Copyright (C) 2015-2020 Sergey Matveev +// Copyright (C) 2015-2021 Sergey Matveev // // 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,9 +24,9 @@ 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) + u := big.NewInt(0).Set(ukm).Mul(ukm, prv.C.Co) + if u.Cmp(bigInt1) != 0 { + keyX, keyY, err = prv.C.Exp(u, keyX, keyY) if err != nil { return nil, err }