aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-05-26 09:20:22 +0200
committerJakob Unterwurzacher2021-05-26 09:20:22 +0200
commit1d2ac1e589209be96f8ee5fbba9a18e7e2c5fb04 (patch)
treeda172165a1e504e0c4012d8abf224dd45eab3edd /internal
parent09870bfac51995a0a8875137ed9e6d60688240f1 (diff)
stupidgcm: prefer Go stdlib over OpenSSL on Apple M1
https://github.com/rfjakob/gocryptfs/issues/556
Diffstat (limited to 'internal')
-rw-r--r--internal/stupidgcm/prefer.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/stupidgcm/prefer.go b/internal/stupidgcm/prefer.go
index c067d09..bacd56a 100644
--- a/internal/stupidgcm/prefer.go
+++ b/internal/stupidgcm/prefer.go
@@ -1,6 +1,8 @@
package stupidgcm
import (
+ "runtime"
+
"golang.org/x/sys/cpu"
)
@@ -23,6 +25,11 @@ func PreferOpenSSL() bool {
// Go stdlib is probably faster
return false
}
- // Openssl is probably faster
+ // On the Apple M1, Go stdlib is faster than OpenSSL, despite cpu.ARM64.HasAES
+ // reading false: https://github.com/rfjakob/gocryptfs/issues/556#issuecomment-848079309
+ if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
+ return false
+ }
+ // OpenSSL is probably faster
return true
}