mirror of
https://github.com/restic/restic.git
synced 2025-12-03 21:21:47 +00:00
crypto: Use helpers for size calculations
This commit is contained in:
@@ -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