mirror of
https://github.com/restic/restic.git
synced 2026-11-13 22:43:03 +00:00
crypto: Use helpers for size calculations
This commit is contained in:
1 parent
d6db5a1fc2
commit
243698680a
3 files changed
+4
-5
No files matched your search
@@ -262,7 +262,7 @@ func AddKey(ctx context.Context, s *Repository, password, username, hostname str
|
||||
}
|
||||
|
||||
nonce := crypto.NewRandomNonce()
|
||||
ciphertext := make([]byte, 0, len(buf)+newkey.user.Overhead()+newkey.user.NonceSize())
|
||||
ciphertext := make([]byte, 0, restic.CiphertextLength(len(buf)))
|
||||
ciphertext = append(ciphertext, nonce...)
|
||||
ciphertext = newkey.user.Seal(ciphertext, nonce, buf, nil)
|
||||
newkey.Data = ciphertext
|
||||
|
||||
Reference in new issue
Block a user