diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/stupidgcm/chacha.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/stupidgcm/chacha.go b/internal/stupidgcm/chacha.go index c90d721..30d57e3 100644 --- a/internal/stupidgcm/chacha.go +++ b/internal/stupidgcm/chacha.go @@ -39,9 +39,12 @@ func NewChacha20poly1305(key []byte) *stupidChacha20poly1305 { if len(key) != chacha20poly1305.KeySize { log.Panicf("Only %d-byte keys are supported, you passed %d bytes", chacha20poly1305.KeySize, len(key)) } + // private copy + key2 := make([]byte, chacha20poly1305.KeySize) + copy(key2, key) return &stupidChacha20poly1305{ stupidAEADCommon{ - key: append([]byte{}, key...), // private copy + key: key2, openSSLEVPCipher: _EVP_chacha20_poly1305, nonceSize: chacha20poly1305.NonceSize, }, |