Require/enable AVX for AES-based ciphers

This commit is contained in:
Frank Denis
2023-08-05 09:33:04 +02:00
parent 07a847e7ee
commit 6668dc8008
6 changed files with 11 additions and 15 deletions
+5 -5
View File
@@ -405,14 +405,14 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
[
AC_MSG_RESULT(no)
oldcflags="$CFLAGS"
AX_CHECK_COMPILE_FLAG([-march=armv8-a+crypto], [
CFLAGS="$CFLAGS -march=armv8-a+crypto"
AC_MSG_CHECKING(for ARM crypto instructions set with -march=armv8-a+crypto)
AX_CHECK_COMPILE_FLAG([-march=armv8-a+crypto+aes], [
CFLAGS="$CFLAGS -march=armv8-a+crypto+aes"
AC_MSG_CHECKING(for ARM crypto instructions set with -march=armv8-a+crypto+aes)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <arm_neon.h>]], [[ vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(__ARM_FEATURE_CRYPTO)) ]])],
[
AC_MSG_RESULT(yes - with addition of -march=armv8-a+crypto)
AC_MSG_RESULT(yes - with addition of -march=armv8-a+crypto+aes)
have_armcrypto=yes
CFLAGS_ARMCRYPTO="-march=armv8-a+crypto"
CFLAGS_ARMCRYPTO="-march=armv8-a+crypto+aes"
],
[AC_MSG_RESULT(no)])
CFLAGS="$oldcflags"
@@ -138,7 +138,7 @@ _crypto_aead_aegis128l_pick_best_implementation(void)
#endif
#if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H)
if (sodium_runtime_has_aesni()) {
if (sodium_runtime_has_aesni() & sodium_runtime_has_avx()) {
implementation = &crypto_aead_aegis128l_aesni_implementation;
return 0;
}
@@ -18,8 +18,7 @@
#if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H)
#ifdef __GNUC__
#pragma GCC target("ssse3")
#pragma GCC target("aes")
#pragma GCC target("avx,aes")
#endif
#include "private/sse2_64_32.h"
@@ -137,7 +137,7 @@ _crypto_aead_aegis256_pick_best_implementation(void)
#endif
#if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H)
if (sodium_runtime_has_aesni()) {
if (sodium_runtime_has_aesni() & sodium_runtime_has_avx()) {
implementation = &crypto_aead_aegis256_aesni_implementation;
return 0;
}
@@ -18,8 +18,7 @@
#if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H)
#ifdef __GNUC__
#pragma GCC target("ssse3")
#pragma GCC target("aes")
#pragma GCC target("avx,aes")
#endif
#include "private/sse2_64_32.h"
@@ -17,9 +17,7 @@
#if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H)
#ifdef __GNUC__
#pragma GCC target("ssse3")
#pragma GCC target("aes")
#pragma GCC target("pclmul")
#pragma GCC target("avx,aes,pclmul")
#endif
#if !defined(_MSC_VER) || _MSC_VER < 1800
@@ -1005,7 +1003,7 @@ crypto_aead_aes256gcm_decrypt(unsigned char *m, unsigned long long *mlen_p, unsi
int
crypto_aead_aes256gcm_is_available(void)
{
return sodium_runtime_has_pclmul() & sodium_runtime_has_aesni();
return sodium_runtime_has_pclmul() & sodium_runtime_has_aesni() & sodium_runtime_has_avx();
}
#endif