aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/cryptocore/cryptocore.go7
-rw-r--r--internal/stupidgcm/without_aegis.go28
2 files changed, 5 insertions, 30 deletions
diff --git a/internal/cryptocore/cryptocore.go b/internal/cryptocore/cryptocore.go
index b1533db..ad5d719 100644
--- a/internal/cryptocore/cryptocore.go
+++ b/internal/cryptocore/cryptocore.go
@@ -20,11 +20,11 @@ import (
)
const (
+ // KeyLen is the cipher key length in bytes. All backends use 32 bytes.
+ KeyLen = 32
// AuthTagLen is the length of a authentication tag in bytes.
// All backends use 16 bytes.
AuthTagLen = 16
- // AEAD key length
- KeyLen = 32
)
// AEADTypeEnum indicates the type of AEAD backend in use.
@@ -88,6 +88,9 @@ func New(key []byte, aeadType AEADTypeEnum, IVBitLen int, useHKDF bool) *CryptoC
tlog.Debug.Printf("cryptocore.New: key=%d bytes, aeadType=%v, IVBitLen=%d, useHKDF=%v",
len(key), aeadType, IVBitLen, useHKDF)
+ if len(key) != KeyLen {
+ log.Panicf("Unsupported key length of %d bytes", len(key))
+ }
if IVBitLen != 96 && IVBitLen != 128 && IVBitLen != chacha20poly1305.NonceSizeX*8 {
log.Panicf("Unsupported IV length of %d bits", IVBitLen)
}
diff --git a/internal/stupidgcm/without_aegis.go b/internal/stupidgcm/without_aegis.go
deleted file mode 100644
index efd665c..0000000
--- a/internal/stupidgcm/without_aegis.go
+++ /dev/null
@@ -1,28 +0,0 @@
-//go:build without_aegis || !cgo
-// +build without_aegis !cgo
-
-package stupidgcm
-
-import (
- "fmt"
- "os"
-
- "crypto/cipher"
-
- "github.com/rfjakob/gocryptfs/v2/internal/exitcodes"
-)
-
-const (
- // BuiltWithoutAegis indicates if openssl been disabled at compile-time
- BuiltWithoutAegis = true
-)
-
-type stupidAegis struct {
- aead cipher.AEAD
-}
-
-func NewAegis(_ []byte) cipher.AEAD {
- fmt.Fprintln(os.Stderr, "I have been compiled without aegis support but you are still trying to use aegis")
- os.Exit(exitcodes.Aegis)
- return nil
-}