Skip to content

Commit

Permalink
Merge pull request #8282 from SparkiDev/iphone_no_sha3_instrs
Browse files Browse the repository at this point in the history
MacOS: allow SHA-3 instructions to be explicitly not used
  • Loading branch information
douzzer authored Dec 16, 2024
2 parents fd22bfc + 2aacc7c commit b5935f3
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2976,7 +2976,7 @@ fi

ENABLED_ARMASM_CRYPTO="unknown"
ENABLED_ARMASM_INLINE="no"
ENABLED_ARMASM_SHA3="no"
ENABLED_ARMASM_SHA3="unknown"
ENABLED_ARMASM_CRYPTO_SM4="no"
# ARM Assembly
# Both SHA3 and SHA512 instructions available with ARMV8.2-a
Expand Down Expand Up @@ -3010,6 +3010,16 @@ then
ENABLED_ARMASM_SHA3=yes
ENABLED_ARMASM_PLUS=yes
;;
no-sha512-crypto | no-sha3-crypto)
case $host_cpu in
*aarch64*)
;;
*)
AC_MSG_ERROR([SHA512/SHA3 instructions only available on Aarch64 CPU.])
break;;
esac
ENABLED_ARMASM_SHA3=no
;;
sm4)
case $host_cpu in
*aarch64*)
Expand Down Expand Up @@ -3054,8 +3064,10 @@ then
*aarch64*)
case $host_os in
*darwin*)
# All known Aarch64 Mac computers support SHA-512 instructions
ENABLED_ARMASM_SHA3=yes
# Turn it on unless explicitly turned off.
if test "$ENABLED_ARMASM_SHA3" = "unknown"; then
ENABLED_ARMASM_SHA3="yes"
fi
;;
*)
# +crypto needed for hardware acceleration
Expand Down Expand Up @@ -3171,6 +3183,9 @@ if test "$ENABLED_ARMASM_SHA3" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM_CRYPTO_SHA512 -DWOLFSSL_ARMASM_CRYPTO_SHA3"
AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ARMASM_CRYPTO_SHA512 -DWOLFSSL_ARMASM_CRYPTO_SHA3"
fi
if test "$ENABLED_ARMASM_SHA3" = "unknown"; then
ENABLED_ARMASM_SHA3="no"
fi
if test "$ENABLED_ARMASM_SM3" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM_CRYPTO_SM3"
fi
Expand Down

0 comments on commit b5935f3

Please sign in to comment.