Do not try to compile aesni code if this is not going to compile

This commit is contained in:
Frank Denis 2015-10-10 18:21:33 +02:00
parent e83e9b2d8e
commit 6ca06314fc
2 changed files with 16 additions and 11 deletions

View File

@ -313,7 +313,10 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
]], [[ __m128i x = _mm_aesimc_si128(_mm_setzero_si128());
__m128i y = _mm_clmulepi64_si128(_mm_setzero_si128(), _mm_setzero_si128(), 0);]])],
[AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_WMMINTRIN_H], [1], [aesni is available])],
AC_DEFINE([HAVE_WMMINTRIN_H], [1], [aesni is available])
AX_CHECK_COMPILE_FLAG([-maes], [CFLAGS="$CFLAGS -maes"])
AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS="$CFLAGS -mpclmul"])
],
[AC_MSG_RESULT(no)])
])

View File

@ -3,6 +3,16 @@
* AES256-GCM, based on original code by Romain Dolbeau
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "crypto_aead_aes256gcm_aesni.h"
#include "export.h"
#include "utils.h"
#ifdef HAVE_WMMINTRIN_H
#pragma GCC target("sse")
#pragma GCC target("sse2")
#pragma GCC target("ssse3")
@ -19,15 +29,7 @@
#ifndef __PCLMUL__
# define __PCLMUL__
#endif
#include <immintrin.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "crypto_aead_aes256gcm_aesni.h"
#include "export.h"
#include "utils.h"
#if defined(__INTEL_COMPILER) || defined(_bswap64)
#elif defined(_MSC_VER)
@ -807,7 +809,7 @@ size_t crypto_aead_aes256gcm_aesni_abytes(void)
size_t crypto_aead_aes256gcm_aesni_statebytes(void)
{
(void) sizeof(int[(sizeof(crypto_aead_aes256gcm_aesni_state) >=
sizeof(context)) ? 1 : -1]);
return sizeof(crypto_aead_aes256gcm_aesni_state);
}
#endif