diff options
author | Jakob Unterwurzacher | 2021-08-23 22:10:23 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-08-23 22:10:23 +0200 |
commit | 806334eacf2e50d712844761aca2b11014ec99df (patch) | |
tree | 5d531146e92f7770a02e03107afdcb2fcc7a0ab1 /internal/siv_aead/siv_aead.go | |
parent | b12ad292d4dfef1c00567fe3def7e73461d3c217 (diff) |
cryptocore: add NonceSize to AEADTypeEnum
Have the information in one centralized place,
and access it from main as needed.
Diffstat (limited to 'internal/siv_aead/siv_aead.go')
-rw-r--r-- | internal/siv_aead/siv_aead.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/siv_aead/siv_aead.go b/internal/siv_aead/siv_aead.go index eabb5e2..482efd9 100644 --- a/internal/siv_aead/siv_aead.go +++ b/internal/siv_aead/siv_aead.go @@ -19,6 +19,11 @@ const ( // KeyLen is the required key length. The SIV algorithm supports other lengths, // but we only support 64. KeyLen = 64 + // NonceSize is the required nonce/IV length. + // SIV supports any nonce size, but in gocryptfs we exclusively use 16. + NonceSize = 16 + // Overhead is the number of bytes added for integrity checking + Overhead = 16 ) // New returns a new cipher.AEAD implementation. @@ -42,11 +47,11 @@ func new2(keyIn []byte) cipher.AEAD { func (s *sivAead) NonceSize() int { // SIV supports any nonce size, but in gocryptfs we exclusively use 16. - return 16 + return NonceSize } func (s *sivAead) Overhead() int { - return 16 + return Overhead } // Seal encrypts "in" using "nonce" and "authData" and appends the result to "dst" |