[PATCH 3/5] Do not build amd64 assembly on i386

Jussi Kivilinna jussi.kivilinna at iki.fi
Sun Jul 28 18:50:58 CEST 2024


* configure.ac: Build "serpent-avx2-amd64" and
"camellia-*-amd64" only on x86-64.
--

GnuPG-bug-id: 7220
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 configure.ac | 50 +++++++++++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1e182552..191aa38d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3133,14 +3133,14 @@ if test "$found" = "1" ; then
       x86_64-*-*)
          # Build with the SSE2 implementation
          GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS serpent-sse2-amd64.lo"
+
+         if test x"$avx2support" = xyes ; then
+            # Build with the AVX2 implementation
+            GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS serpent-avx2-amd64.lo"
+         fi
       ;;
    esac
 
-   if test x"$avx2support" = xyes ; then
-      # Build with the AVX2 implementation
-      GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS serpent-avx2-amd64.lo"
-   fi
-
    if test x"$avx512support" = xyes ; then
       # Build with the AVX512 implementation
       GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS serpent-avx512-x86.lo"
@@ -3186,28 +3186,32 @@ if test "$found" = "1" ; then
       ;;
    esac
 
-   if test x"$avxsupport" = xyes ; then
-      if test x"$aesnisupport" = xyes ; then
-        # Build with the AES-NI/AVX implementation
-        GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-aesni-avx-amd64.lo"
-      fi
-   fi
+   case "${host}" in
+      x86_64-*-*)
+         if test x"$avxsupport" = xyes ; then
+            if test x"$aesnisupport" = xyes ; then
+              # Build with the AES-NI/AVX implementation
+              GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-aesni-avx-amd64.lo"
+            fi
+         fi
 
-   if test x"$avx2support" = xyes ; then
-      if test x"$aesnisupport" = xyes ; then
-        # Build with the AES-NI/AVX2 implementation
-        GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-aesni-avx2-amd64.lo"
+         if test x"$avx2support" = xyes ; then
+            if test x"$aesnisupport" = xyes ; then
+              # Build with the AES-NI/AVX2 implementation
+              GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-aesni-avx2-amd64.lo"
 
-        # Build with the VAES/AVX2 implementation
-        GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-vaes-avx2-amd64.lo"
+              # Build with the VAES/AVX2 implementation
+              GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-vaes-avx2-amd64.lo"
 
-        # Build with the GFNI/AVX2 implementation
-        GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-gfni-avx2-amd64.lo"
+              # Build with the GFNI/AVX2 implementation
+              GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-gfni-avx2-amd64.lo"
 
-        # Build with the GFNI/AVX512 implementation
-        GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-gfni-avx512-amd64.lo"
-      fi
-   fi
+              # Build with the GFNI/AVX512 implementation
+              GCRYPT_ASM_CIPHERS="$GCRYPT_ASM_CIPHERS camellia-gfni-avx512-amd64.lo"
+            fi
+         fi
+      ;;
+   esac
 fi
 
 LIST_MEMBER(idea, $enabled_ciphers)
-- 
2.43.0




More information about the Gcrypt-devel mailing list