Skip to content

Commit

Permalink
Enable AES and SHA3 optimisations on Apple Silicon M4-based macOS sys…
Browse files Browse the repository at this point in the history
…tems

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 <[email protected]>
Reviewed-by: Kurt Roeckx <[email protected]>
(Merged from openssl#25940)
  • Loading branch information
tom-cosgrove-arm authored and t8m committed Nov 22, 2024
1 parent 635bf49 commit ea58178
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/armcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ea58178

Please sign in to comment.