diff options
Diffstat (limited to 'internal/stupidgcm')
-rw-r--r-- | internal/stupidgcm/stupidgcm.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/stupidgcm/stupidgcm.go b/internal/stupidgcm/stupidgcm.go index db9e6ef..58027f8 100644 --- a/internal/stupidgcm/stupidgcm.go +++ b/internal/stupidgcm/stupidgcm.go @@ -9,6 +9,7 @@ package stupidgcm import "C" import ( + "crypto/cipher" "fmt" "log" "unsafe" @@ -28,7 +29,10 @@ type stupidGCM struct { key []byte } -func New(key []byte) stupidGCM { +var _ cipher.AEAD = &stupidGCM{} + +// New returns a new cipher.AEAD implementation.. +func New(key []byte) cipher.AEAD { if len(key) != keyLen { log.Panicf("Only %d-byte keys are supported", keyLen) } @@ -43,7 +47,7 @@ func (g stupidGCM) Overhead() int { return tagLen } -// Seal - encrypt "in" using "iv" and "authData" and append the result to "dst" +// Seal encrypts "in" using "iv" and "authData" and append the result to "dst" func (g stupidGCM) Seal(dst, iv, in, authData []byte) []byte { if len(iv) != ivLen { log.Panicf("Only %d-byte IVs are supported", ivLen) @@ -114,7 +118,7 @@ func (g stupidGCM) Seal(dst, iv, in, authData []byte) []byte { return append(dst, buf...) } -// Open - decrypt "in" using "iv" and "authData" and append the result to "dst" +// Open decrypts "in" using "iv" and "authData" and append the result to "dst" func (g stupidGCM) Open(dst, iv, in, authData []byte) ([]byte, error) { if len(iv) != ivLen { log.Panicf("Only %d-byte IVs are supported", ivLen) |