From 07d28d859812933045bc9b88d007ba4b0786b380 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Mon, 20 Mar 2023 18:12:36 +0800 Subject: [PATCH] Add msvc build for aesce module Signed-off-by: Jerry Yu --- library/aesce.c | 3 ++- library/aesce.h | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/library/aesce.c b/library/aesce.c index fe056dc4c..f0ca274df 100644 --- a/library/aesce.c +++ b/library/aesce.c @@ -62,8 +62,9 @@ # pragma GCC push_options # pragma GCC target ("arch=armv8-a+crypto") # define MBEDTLS_POP_TARGET_PRAGMA +# elif defined(_MSC_VER) # else -# error "Only GCC and Clang supported for MBEDTLS_AESCE_C" +# error "Only MSVC, GCC and Clang supported for MBEDTLS_AESCE_C" # endif #endif /* !__ARM_FEATURE_AES || MBEDTLS_ENABLE_ARM_CRYPTO_EXTENSIONS_COMPILER_FLAG */ diff --git a/library/aesce.h b/library/aesce.h index 12ddc74b3..a29da3457 100644 --- a/library/aesce.h +++ b/library/aesce.h @@ -30,12 +30,19 @@ #include "mbedtls/aes.h" - +#if !defined(MBEDTLS_HAVE_ARM64) #if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && \ - defined(__aarch64__) && !defined(MBEDTLS_HAVE_ARM64) + defined(__aarch64__) #define MBEDTLS_HAVE_ARM64 #endif +/* MSVC */ +#if defined(_M_ARM64) || defined(_M_ARM64EC) +#define MBEDTLS_HAVE_ARM64 +#endif +#endif + + #if defined(MBEDTLS_HAVE_ARM64) #ifdef __cplusplus