summaryrefslogtreecommitdiff
path: root/internal/cryptocore/cryptocore.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-06-21 11:32:04 +0200
committerJakob Unterwurzacher2021-06-21 11:32:04 +0200
commit6b0e63c1a86946de23f549e7d80ea933a4a105f8 (patch)
tree59bc27a3f0822f413997b8fd3bc4e512747c7725 /internal/cryptocore/cryptocore.go
parentc5d8fa83ae702017fc90769dff178fda6a7942a3 (diff)
Improve startup debug output
The startup debug output was very verbose but still missing some effective crypto settings.
Diffstat (limited to 'internal/cryptocore/cryptocore.go')
-rw-r--r--internal/cryptocore/cryptocore.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/cryptocore/cryptocore.go b/internal/cryptocore/cryptocore.go
index d66f390..9f5b9bd 100644
--- a/internal/cryptocore/cryptocore.go
+++ b/internal/cryptocore/cryptocore.go
@@ -36,6 +36,19 @@ const (
BackendAESSIV AEADTypeEnum = 5
)
+func (a AEADTypeEnum) String() string {
+ switch a {
+ case BackendOpenSSL:
+ return "BackendOpenSSL"
+ case BackendGoGCM:
+ return "BackendGoGCM"
+ case BackendAESSIV:
+ return "BackendAESSIV"
+ default:
+ return fmt.Sprintf("%d", a)
+ }
+}
+
// CryptoCore is the low level crypto implementation.
type CryptoCore struct {
// EME is used for filename encryption.
@@ -58,6 +71,9 @@ type CryptoCore struct {
// Note: "key" is either the scrypt hash of the password (when decrypting
// a config file) or the masterkey (when finally mounting the filesystem).
func New(key []byte, aeadType AEADTypeEnum, IVBitLen int, useHKDF bool, forceDecode bool) *CryptoCore {
+ tlog.Debug.Printf("cryptocore.New: key=%d bytes, aeadType=%v, IVBitLen=%d, useHKDF=%v, forceDecode=%v",
+ len(key), aeadType, IVBitLen, useHKDF, forceDecode)
+
if len(key) != KeyLen {
log.Panic(fmt.Sprintf("Unsupported key length %d", len(key)))
}