X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=gost3410%2Fvko.go;h=71f61d1adb1e355d312bd181cec9b19723328fd8;hb=HEAD;hp=a6df7f402b415ddfca6126c265a2973ecb2004be;hpb=f4078e53da769ade0d92e80ad9093040e7f71d58;p=gogost.git diff --git a/gost3410/vko.go b/gost3410/vko.go index a6df7f4..1573296 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-2024 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 @@ -16,19 +16,20 @@ package gost3410 import ( + "fmt" "math/big" ) func (prv *PrivateKey) KEK(pub *PublicKey, ukm *big.Int) ([]byte, error) { keyX, keyY, err := prv.C.Exp(prv.Key, pub.X, pub.Y) if err != nil { - return nil, err + return nil, fmt.Errorf("gogost/gost3410.PrivateKey.KEK: %w", err) } 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 + return nil, fmt.Errorf("gogost/gost3410.PrivateKey.KEK: %w", err) } } pk := PublicKey{prv.C, keyX, keyY}