Skip to content

Commit 59ab513

Browse files
committed
修复 gcm 问题
1 parent 8b3c49b commit 59ab513

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

aes/aes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func DecryptGCM(bs []byte, key []byte, nonce []byte, additional []byte, encoding
242242
return nil, err
243243
}
244244

245-
dst := bytes.Clone(src)
245+
dst := src[:0]
246246

247247
gcm, err := cipher.NewGCM(block)
248248
if err != nil {

aes/aes_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ func TestGCM(t *testing.T) {
322322
}
323323

324324
nonce := []byte("123456abcdef")
325-
t.Logf("nonce: %s\n", nonce)
326325

327326
encrypt := func(data []byte, padding padding.Padding, encoding encoding.Encoding) ([]byte, error) {
328327
return EncryptGCM(data, testKey, nonce, nil, encoding)

0 commit comments

Comments
 (0)