From 806334eacf2e50d712844761aca2b11014ec99df Mon Sep 17 00:00:00 2001
From: Jakob Unterwurzacher
Date: Mon, 23 Aug 2021 22:10:23 +0200
Subject: cryptocore: add NonceSize to AEADTypeEnum

Have the information in one centralized place,
and access it from main as needed.
---
 internal/siv_aead/siv_aead.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'internal/siv_aead')

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"
-- 
cgit v1.2.3