Add flag use_target_attributes

This commit is contained in:
Olivier Chéron 2020-03-14 07:50:30 +01:00
parent f5706959a4
commit 0cf0d076ab
2 changed files with 16 additions and 0 deletions

View File

@ -40,8 +40,13 @@
#include <cryptonite_aes.h>
#include <aes/block128.h>
#ifdef WITH_TARGET_ATTRIBUTES
#define TARGET_AESNI __attribute__((target("ssse3,aes")))
#define TARGET_AESNI_PCLMUL __attribute__((target("sse4.1,aes,pclmul")))
#else
#define TARGET_AESNI
#define TARGET_AESNI_PCLMUL
#endif
#ifdef IMPL_DEBUG
TARGET_AESNI

View File

@ -103,6 +103,11 @@ Flag check_alignment
Default: False
Manual: True
Flag use_target_attributes
Description: use GCC / clang function attributes instead of global target options.
Default: False
Manual: True
Library
Exposed-modules: Crypto.Cipher.AES
Crypto.Cipher.AESGCMSIV
@ -337,8 +342,12 @@ Library
if flag(support_aesni) && (os(linux) || os(freebsd) || os(osx)) && (arch(i386) || arch(x86_64))
CC-options: -DWITH_AESNI
if !flag(use_target_attributes)
CC-options: -mssse3 -maes
if flag(support_pclmuldq)
CC-options: -DWITH_PCLMUL
if !flag(use_target_attributes)
CC-options: -msse4.1 -mpclmul
C-sources: cbits/aes/x86ni.c
, cbits/aes/generic.c
, cbits/aes/gf.c
@ -385,6 +394,8 @@ Library
Build-depends: deepseq
if flag(check_alignment)
cc-options: -DWITH_ASSERT_ALIGNMENT
if flag(use_target_attributes)
cc-options: -DWITH_TARGET_ATTRIBUTES
Test-Suite test-cryptonite
type: exitcode-stdio-1.0