From: Tom Cosgrove Date: Wed, 25 Jan 2023 19:34:25 +0000 (+0000) Subject: Enable AES optimisation on Apple Silicon M2-based systems X-Git-Tag: openssl-3.2.0-alpha1~1363 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d79bb5316e1318bd776d6b2d6723a36778e07f9d;p=thirdparty%2Fopenssl.git Enable AES optimisation on Apple Silicon M2-based systems Gives a performance enhancement of 16-38%, similar to the M1. Reviewed-by: Tomas Mraz Reviewed-by: Hugo Landau Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/20141) --- diff --git a/crypto/armcap.c b/crypto/armcap.c index 71296786c3b..68f735baec6 100644 --- a/crypto/armcap.c +++ b/crypto/armcap.c @@ -254,7 +254,8 @@ void OPENSSL_cpuid_setup(void) OPENSSL_armcap_P |= ARMV8_SHA3; len = sizeof(uarch); if ((sysctlbyname("machdep.cpu.brand_string", uarch, &len, NULL, 0) == 0) && - (strncmp(uarch, "Apple M1", 8) == 0)) + ((strncmp(uarch, "Apple M1", 8) == 0) || + (strncmp(uarch, "Apple M2", 8) == 0))) OPENSSL_armcap_P |= ARMV8_UNROLL8_EOR3; } }