From 5ad9bda206e476fea866907e2f0545257f74e1f0 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 18 Feb 2018 16:20:38 +0100 Subject: [PATCH] cryptocore: make AEADTypeEnum values explicit We now print the number in a debug message, so define the numeric values explicitely instead of using iota. This way you don't have to understand how iota works to find out what the number means. Lack of understanding of how iota works is also the reason why the numbers start at 3 (to keep the current behavoir). --- internal/cryptocore/cryptocore.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/cryptocore/cryptocore.go b/internal/cryptocore/cryptocore.go index 09bab53..bd30029 100644 --- a/internal/cryptocore/cryptocore.go +++ b/internal/cryptocore/cryptocore.go @@ -17,22 +17,23 @@ import ( "github.com/rfjakob/gocryptfs/internal/tlog" ) -// AEADTypeEnum indicates the type of AEAD backend in use. -type AEADTypeEnum int - const ( // KeyLen is the cipher key length in bytes. 32 for AES-256. KeyLen = 32 // AuthTagLen is the length of a GCM auth tag in bytes. AuthTagLen = 16 +) - _ = iota // Skip zero +// AEADTypeEnum indicates the type of AEAD backend in use. +type AEADTypeEnum int + +const ( // BackendOpenSSL specifies the OpenSSL backend. - BackendOpenSSL AEADTypeEnum = iota + BackendOpenSSL AEADTypeEnum = 3 // BackendGoGCM specifies the Go based GCM backend. - BackendGoGCM AEADTypeEnum = iota + BackendGoGCM AEADTypeEnum = 4 // BackendAESSIV specifies an AESSIV backend. - BackendAESSIV AEADTypeEnum = iota + BackendAESSIV AEADTypeEnum = 5 ) // CryptoCore is the low level crypto implementation.