diff options
Diffstat (limited to 'internal/siv_aead')
-rw-r--r-- | internal/siv_aead/siv_aead.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/siv_aead/siv_aead.go b/internal/siv_aead/siv_aead.go index a0ed882..c68ecdb 100644 --- a/internal/siv_aead/siv_aead.go +++ b/internal/siv_aead/siv_aead.go @@ -3,6 +3,8 @@ package siv_aead import ( + "crypto/cipher" + "github.com/jacobsa/crypto/siv" ) @@ -10,7 +12,10 @@ type sivAead struct { key []byte } -func New(key []byte) *sivAead { +var _ cipher.AEAD = &sivAead{} + +// New returns a new cipher.AEAD implementation. +func New(key []byte) cipher.AEAD { return &sivAead{ key: key, } @@ -25,7 +30,7 @@ func (s *sivAead) Overhead() int { return 16 } -// Seal - encrypt "in" using "nonce" and "authData" and append the result to "dst" +// Seal encrypts "in" using "nonce" and "authData" and append the result to "dst" func (s *sivAead) Seal(dst, nonce, plaintext, authData []byte) []byte { if len(nonce) != 16 { // SIV supports any nonce size, but in gocryptfs we exclusively use 16. @@ -43,7 +48,7 @@ func (s *sivAead) Seal(dst, nonce, plaintext, authData []byte) []byte { return out } -// Open - decrypt "in" using "nonce" and "authData" and append the result to "dst" +// Open decrypts "in" using "nonce" and "authData" and append the result to "dst" func (s *sivAead) Open(dst, nonce, ciphertext, authData []byte) ([]byte, error) { if len(nonce) != 16 { // SIV supports any nonce size, but in gocryptfs we exclusively use 16. |