X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=gost3410%2Fvko2012.go;h=bb1a9edc4fcb3d04a6cc21c3d0bd0d975d17ccad;hb=d681002980ca0b115936a6e217de5649bb8966d3;hp=b4527685492358ee72deb3306e2662ea3d68c47b;hpb=5afe1dcbfaf1043ed9e72e215a285966eaba3369;p=gogost.git diff --git a/gost3410/vko2012.go b/gost3410/vko2012.go index b452768..bb1a9ed 100644 --- a/gost3410/vko2012.go +++ b/gost3410/vko2012.go @@ -1,5 +1,5 @@ // GoGOST -- Pure Go GOST cryptographic functions library -// Copyright (C) 2015-2023 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,6 +16,7 @@ package gost3410 import ( + "fmt" "math/big" "go.cypherpunks.ru/gogost/v5/gost34112012256" @@ -27,11 +28,11 @@ import ( func (prv *PrivateKey) KEK2012256(pub *PublicKey, ukm *big.Int) ([]byte, error) { key, err := prv.KEK(pub, ukm) if err != nil { - return nil, err + return nil, fmt.Errorf("gogost/gost3410.PrivateKey.KEK2012256: %w", err) } h := gost34112012256.New() if _, err = h.Write(key); err != nil { - return nil, err + return nil, fmt.Errorf("gogost/gost3410.PrivateKey.KEK2012256: %w", err) } return h.Sum(key[:0]), nil } @@ -41,11 +42,11 @@ func (prv *PrivateKey) KEK2012256(pub *PublicKey, ukm *big.Int) ([]byte, error) func (prv *PrivateKey) KEK2012512(pub *PublicKey, ukm *big.Int) ([]byte, error) { key, err := prv.KEK(pub, ukm) if err != nil { - return nil, err + return nil, fmt.Errorf("gogost/gost3410.PrivateKey.KEK2012256: %w", err) } h := gost34112012512.New() if _, err = h.Write(key); err != nil { - return nil, err + return nil, fmt.Errorf("gogost/gost3410.PrivateKey.KEK2012256: %w", err) } return h.Sum(key[:0]), nil }