From: Tom Cosgrove Date: Wed, 8 Nov 2023 22:45:55 +0000 (+0000) Subject: Enable AES and SHA3 optimisations on Apple Silicon M3-based macOS systems X-Git-Tag: openssl-3.3.0-alpha1~627 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7602bf871564df86005f6c4c989f1d7cc2393878;p=thirdparty%2Fopenssl.git Enable AES and SHA3 optimisations on Apple Silicon M3-based macOS systems AES gets a performance enhancement of 19-36%, similar to the M1 and M2. SHA3 gets an improvement of 4-7% on buffers 256 bytes or larger. Tested on an M3 Pro, but the CPU cores are the same on M3 and M3 Max. Change-Id: I2bf40bbde824823bb8cf2efd1bd945da9f23a703 Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/22685) --- diff --git a/crypto/armcap.c b/crypto/armcap.c index 3b1447456d7..b13da3be81c 100644 --- a/crypto/armcap.c +++ b/crypto/armcap.c @@ -298,7 +298,8 @@ void OPENSSL_cpuid_setup(void) size_t len = sizeof(uarch); 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 M2", 8) == 0) || + (strncmp(uarch, "Apple M3", 8) == 0))) { OPENSSL_armcap_P |= ARMV8_UNROLL8_EOR3; OPENSSL_armcap_P |= ARMV8_HAVE_SHA3_AND_WORTH_USING; }