AES-NI with per-file target compiler options

This commit is contained in:
Olivier Chéron 2020-03-06 06:43:32 +01:00
parent a1072948ca
commit dae01d056d
2 changed files with 8 additions and 1 deletions

View File

@ -30,6 +30,10 @@
#ifdef WITH_AESNI
#pragma GCC push_options
#pragma GCC target("ssse3", "aes")
#pragma clang attribute push (__attribute__((target("ssse3,aes"))), apply_to=function)
#include <wmmintrin.h>
#include <tmmintrin.h>
#include <string.h>
@ -400,4 +404,7 @@ static inline __m128i ghash_add(__m128i tag, const table_4bit htable, __m128i m)
#endif
#pragma clang attribute pop
#pragma GCC pop_options
#endif

View File

@ -336,7 +336,7 @@ Library
c-sources: cbits/cryptonite_rdrand.c
if flag(support_aesni) && (os(linux) || os(freebsd) || os(osx)) && (arch(i386) || arch(x86_64))
CC-options: -mssse3 -maes -DWITH_AESNI
CC-options: -DWITH_AESNI
if flag(support_pclmuldq)
CC-options: -msse4.1 -mpclmul -DWITH_PCLMUL
C-sources: cbits/aes/x86ni.c