mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Require/enable AVX for AES-based ciphers
This commit is contained in:
+5
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user