Skip to content

Commit

Permalink
aesni: refine the condition of MBEDTLS_HAVE_X86_64
Browse files Browse the repository at this point in the history
Signed-off-by: Pengyu Lv <[email protected]>
  • Loading branch information
lpy4105 committed Sep 13, 2023
1 parent dc5a88b commit e707dc1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions include/mbedtls/aesni.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@
#define MBEDTLS_AESNI_AES 0x02000000u
#define MBEDTLS_AESNI_CLMUL 0x00000002u

/* Can we do AESNI with inline assembly?
* (Only implemented with gas syntax, only for 64-bit.)
*/
#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && \
(defined(__amd64__) || defined(__x86_64__)) && \
!defined(MBEDTLS_HAVE_X86_64)
#if !defined(MBEDTLS_HAVE_X86_64) && \
(defined(__amd64__) || defined(__x86_64__) || \
defined(_M_X64) || defined(_M_AMD64)) && \
!defined(_M_ARM64EC)
#define MBEDTLS_HAVE_X86_64
#endif

Expand Down Expand Up @@ -78,7 +76,11 @@
* favor the assembly-based implementation if it's available. We intend to
* revise this in a later release of Mbed TLS 3.x. In the long run, we will
* likely remove the assembly implementation. */
#if defined(MBEDTLS_HAVE_X86_64)
#if defined(MBEDTLS_HAVE_ASM) && \
defined(__GNUC__) && defined(MBEDTLS_HAVE_X86_64)
/* Can we do AESNI with inline assembly?
* (Only implemented with gas syntax, only for 64-bit.)
*/
#define MBEDTLS_AESNI_HAVE_CODE 1 // via assembly
#elif defined(MBEDTLS_AESNI_HAVE_INTRINSICS)
#define MBEDTLS_AESNI_HAVE_CODE 2 // via intrinsics
Expand Down

0 comments on commit e707dc1

Please sign in to comment.