From cf8f9a80fcedbff200b802011f3722cf0cb9c0ba Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Tue, 10 Sep 2024 15:56:05 -0500 Subject: [PATCH] configure.ac: add --enable-all-asm, and add it to --enable-all and --enable-all-crypto. --- configure.ac | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d9e93278c..790e6378f 100644 --- a/configure.ac +++ b/configure.ac @@ -316,7 +316,6 @@ then fi AC_SUBST([ENABLED_ASM]) - # Default math is SP Math all and not fast math # FIPS v1 and v2 must use fast math DEF_SP_MATH="yes" @@ -1029,12 +1028,21 @@ then # More thorough error queue usage. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VERBOSE_ERRORS" + + # enable all applicable assembly accelerations + if test "$ENABLED_ASM" != "no" && + test "$enable_sp_asm" != "no" && + test "$enable_all_asm" = "" && + test "$ENABLED_LINUXKM_DEFAULTS" = "no" + then + enable_all_asm=yes + fi fi # ALL CRYPTO FEATURES AC_ARG_ENABLE([all-crypto], - [AS_HELP_STRING([--enable-all-crypto],[Enable all wolfcrypt algorithms (default: disabled)])], + [AS_HELP_STRING([--enable-all-crypto],[Enable all available wolfcrypt algorithm support (default: disabled)])], [ ENABLED_ALL_CRYPT=$enableval ], [ ENABLED_ALL_CRYPT=no ] ) @@ -1157,6 +1165,15 @@ then # Store issuer name components when parsing certificates. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_ISSUER_NAMES" + + # enable all applicable assembly accelerations + if test "$ENABLED_ASM" != "no" && + test "$enable_sp_asm" != "no" && + test "$enable_all_asm" = "" && + test "$ENABLED_LINUXKM_DEFAULTS" = "no" + then + enable_all_asm=yes + fi fi # liboqs @@ -2845,6 +2862,61 @@ then fi +# Auto-selected activation of all applicable asm accelerations +AC_ARG_ENABLE([all-asm], + [AS_HELP_STRING([--enable-all-asm],[Enable all applicable assembly accelerations (default: disabled)])], + [ ENABLED_ALL_ASM=$enableval ], + [ ENABLED_ALL_ASM=no ] + ) + +if test "$ENABLED_ALL_ASM" != "no" +then + if test "$ENABLED_ASM" = "no" + then + AC_MSG_ERROR([--enable-all-asm is incompatible with --disable-asm]) + fi + + if test "$enable_sp_asm" = "no" + then + AC_MSG_ERROR([--enable-all-asm is incompatible with --disable-sp-asm]) + fi + + if test "$enable_intelasm" = "no" + then + AC_MSG_ERROR([--enable-all-asm is incompatible with --disable-intelasm]) + fi + + if test "$enable_armasm" = "no" + then + AC_MSG_ERROR([--enable-all-asm is incompatible with --disable-armasm]) + fi + + if test "$ENABLED_SP" != "no" + then + ENABLED_SP_ASM=yes + if test "$ENABLED_SP" = "" + then + ENABLED_SP=yes + fi + fi + + case "$host_cpu" in + *x86_64*|*amd64*) + if test "$enable_intelasm" = "" + then + enable_intelasm=yes + fi + ;; + *aarch64*|*arm*|*cortex*) + if test "$enable_armasm" = "" + then + enable_armasm=yes + fi + ;; + esac +fi + + ENABLED_ARMASM_INLINE="no" ENABLED_ARMASM_SHA3="no" ENABLED_ARMASM_CRYPTO_SM4="no"