From e84ff965935436095e1bc2b846eaaa01804fd4eb Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 23 Jun 2022 17:50:15 +0300 Subject: [PATCH] [#539] Fix nonce size computation Signed-off-by: Denis Kirillov --- creds/accessbox/accessbox.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creds/accessbox/accessbox.go b/creds/accessbox/accessbox.go index 0497ea6..e558489 100644 --- a/creds/accessbox/accessbox.go +++ b/creds/accessbox/accessbox.go @@ -271,7 +271,7 @@ func encrypt(owner *keys.PrivateKey, sender *keys.PublicKey, data []byte) ([]byt return nil, fmt.Errorf("get chiper: %w", err) } - nonce := make([]byte, enc.NonceSize(), enc.NonceSize()+len(data)+enc.Overhead()) + nonce := make([]byte, enc.NonceSize()) if _, err = rand.Read(nonce); err != nil { return nil, fmt.Errorf("generate random nonce: %w", err) }