Skip to content

Commit 5ad9bda

Browse files
committed
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).
1 parent 6c69471 commit 5ad9bda

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

internal/cryptocore/cryptocore.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,23 @@ import (
1717
"github.com/rfjakob/gocryptfs/internal/tlog"
1818
)
1919

20-
// AEADTypeEnum indicates the type of AEAD backend in use.
21-
type AEADTypeEnum int
22-
2320
const (
2421
// KeyLen is the cipher key length in bytes. 32 for AES-256.
2522
KeyLen = 32
2623
// AuthTagLen is the length of a GCM auth tag in bytes.
2724
AuthTagLen = 16
25+
)
2826

29-
_ = iota // Skip zero
27+
// AEADTypeEnum indicates the type of AEAD backend in use.
28+
type AEADTypeEnum int
29+
30+
const (
3031
// BackendOpenSSL specifies the OpenSSL backend.
31-
BackendOpenSSL AEADTypeEnum = iota
32+
BackendOpenSSL AEADTypeEnum = 3
3233
// BackendGoGCM specifies the Go based GCM backend.
33-
BackendGoGCM AEADTypeEnum = iota
34+
BackendGoGCM AEADTypeEnum = 4
3435
// BackendAESSIV specifies an AESSIV backend.
35-
BackendAESSIV AEADTypeEnum = iota
36+
BackendAESSIV AEADTypeEnum = 5
3637
)
3738

3839
// CryptoCore is the low level crypto implementation.

0 commit comments

Comments
 (0)