]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Enable AES and SHA3 optimisations on Apple Silicon M4-based macOS systems
authorTom Cosgrove <tom.cosgrove@arm.com>
Tue, 12 Nov 2024 08:27:27 +0000 (08:27 +0000)
committerTomas Mraz <tomas@openssl.org>
Fri, 22 Nov 2024 13:56:04 +0000 (14:56 +0100)
AES gets a performance enhancement of 7-33%.

Tested on an M4 Pro, but the CPU cores are the same on M4 and M4 Max.

Change-Id: I634c03f1d2b50fa5f8ca97dd65975e49d970c72b

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/25940)

crypto/armcap.c

index 33b9dd4df08c3b00e81f61138c3b221b3989fb35..7c5a127523acb339d388f8fd70642e9d674b4b41 100644 (file)
@@ -300,7 +300,8 @@ void OPENSSL_cpuid_setup(void)
             if ((sysctlbyname("machdep.cpu.brand_string", uarch, &len, NULL, 0) == 0) &&
                ((strncmp(uarch, "Apple M1", 8) == 0) ||
                 (strncmp(uarch, "Apple M2", 8) == 0) ||
-                (strncmp(uarch, "Apple M3", 8) == 0))) {
+                (strncmp(uarch, "Apple M3", 8) == 0) ||
+                (strncmp(uarch, "Apple M4", 8) == 0))) {
                 OPENSSL_armcap_P |= ARMV8_UNROLL8_EOR3;
                 OPENSSL_armcap_P |= ARMV8_HAVE_SHA3_AND_WORTH_USING;
             }