summaryrefslogtreecommitdiff
path: root/internal/stupidgcm
diff options
context:
space:
mode:
Diffstat (limited to 'internal/stupidgcm')
-rw-r--r--internal/stupidgcm/stupidgcm.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/stupidgcm/stupidgcm.go b/internal/stupidgcm/stupidgcm.go
index 77d6770..c8aecca 100644
--- a/internal/stupidgcm/stupidgcm.go
+++ b/internal/stupidgcm/stupidgcm.go
@@ -33,10 +33,12 @@ type StupidGCM struct {
var _ cipher.AEAD = &StupidGCM{}
// New returns a new cipher.AEAD implementation..
-func New(key []byte, forceDecode bool) cipher.AEAD {
- if len(key) != keyLen {
+func New(keyIn []byte, forceDecode bool) cipher.AEAD {
+ if len(keyIn) != keyLen {
log.Panicf("Only %d-byte keys are supported", keyLen)
}
+ // Create a private copy of the key
+ key := append([]byte{}, keyIn...)
return &StupidGCM{key: key, forceDecode: forceDecode}
}