From e8e35982845f36e714b915350eaf6855487aa0e8 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 28 Sep 2021 17:43:36 +0200 Subject: [PATCH] -init: suggest xchacha if we don't have AES accel Example on Raspberry Pi 4: $ ./gocryptfs/gocryptfs -init $(mktemp -d) Notice: Your CPU does not have AES acceleration. Consider using -xchacha for better performance. Choose a password for protecting your files. Password: https://github.com/rfjakob/gocryptfs/issues/607 --- init_dir.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init_dir.go b/init_dir.go index 00fb390..ab4c3df 100644 --- a/init_dir.go +++ b/init_dir.go @@ -14,6 +14,7 @@ import ( "github.com/rfjakob/gocryptfs/v2/internal/fido2" "github.com/rfjakob/gocryptfs/v2/internal/nametransform" "github.com/rfjakob/gocryptfs/v2/internal/readpassword" + "github.com/rfjakob/gocryptfs/v2/internal/stupidgcm" "github.com/rfjakob/gocryptfs/v2/internal/syscallcompat" "github.com/rfjakob/gocryptfs/v2/internal/tlog" ) @@ -67,6 +68,11 @@ func initDir(args *argContainer) { tlog.Fatal.Printf("Invalid cipherdir: %v", err) os.Exit(exitcodes.CipherDir) } + if !args.xchacha && !stupidgcm.CpuHasAES() { + tlog.Info.Printf(tlog.ColorYellow + + "Notice: Your CPU does not have AES acceleration. Consider using -xchacha for better performance." + + tlog.ColorReset) + } } // Choose password for config file if len(args.extpass) == 0 && args.fido2 == "" {