diff options
author | Frank Denis | 2025-03-12 00:44:56 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2025-03-12 20:43:23 +0100 |
commit | e3e76e275d8edf294a4a64897f44a5ef0b70bfeb (patch) | |
tree | 7a1af2b9a2ec976f386c1cfb5e25071267939cb1 /internal/cryptocore/cryptocore.go | |
parent | 3e852eb354f99fb95b399c68d950298b33ed88ab (diff) |
Revert a few more things
Diffstat (limited to 'internal/cryptocore/cryptocore.go')
-rw-r--r-- | internal/cryptocore/cryptocore.go | 7 |
1 files changed, 5 insertions, 2 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) } |