From d2efeaffe76d97711d49e5065dfb57c213b3ebff Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Fri, 30 Jun 2023 00:34:16 +0200 Subject: Correctly detect ARM builds when listing CPU features in headers --- src/Common/Crypto.c | 4 ++-- src/Crypto/config.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c index 10c97e98..e87aea35 100644 --- a/src/Common/Crypto.c +++ b/src/Common/Crypto.c @@ -1180,7 +1180,7 @@ BOOL IsAesHwCpuSupported () } return state && !HwEncryptionDisabled; -#elif defined (_M_ARM64) +#elif defined (_M_ARM64) || defined(__arm__) || defined (__arm64__) || defined (__aarch64__) return 0; #else return (HasAESNI() && !HwEncryptionDisabled)? TRUE : FALSE; @@ -1463,7 +1463,7 @@ void VcUnprotectKeys (PCRYPTO_INFO pCryptoInfo, uint64 encID) #endif -#ifdef _M_ARM64 +#if defined(_M_ARM64) || defined(__arm__) || defined (__arm64__) || defined (__aarch64__) /* dummy implementation that should never be called */ void aes_hw_cpu_decrypt(const byte* ks, byte* data) { diff --git a/src/Crypto/config.h b/src/Crypto/config.h index 7ed6aabf..867c13dd 100644 --- a/src/Crypto/config.h +++ b/src/Crypto/config.h @@ -113,13 +113,13 @@ #define CRYPTOPP_X64_ASM_AVAILABLE #endif -#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) && !defined(_M_ARM) && !defined(_M_ARM64) +#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__arm__) && !defined(__aarch64__) && !defined(__arm64__) #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1 #else #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0 #endif -#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3) && !defined(_M_ARM) && !defined(_M_ARM64) && ( \ +#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__arm__) && !defined(__aarch64__) && !defined(__arm64__) && ( \ defined(__SSSE3__) || (_MSC_VER >= 1500) || \ (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \ (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000)) @@ -128,7 +128,7 @@ #define CRYPTOPP_SSSE3_AVAILABLE 0 # endif -#if !defined(CRYPTOPP_DISABLE_SSSE3) && (defined(__SSSE3__) || (_MSC_VER >= 1500)) && !defined(_M_ARM) && !defined(_M_ARM64) +#if !defined(CRYPTOPP_DISABLE_SSSE3) && (defined(__SSSE3__) || (_MSC_VER >= 1500)) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__arm__) && !defined(__aarch64__) && !defined(__arm64__) #define CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE 1 #else #define CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE 0 @@ -146,7 +146,7 @@ #define CRYPTOPP_BOOL_ALIGN16 0 #endif -#if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE && (defined(__SSE4_1__) || defined(__INTEL_COMPILER) || defined(_MSC_VER)) +#if CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE && (defined(__SSE4_1__) || defined(__INTEL_COMPILER) || defined(_MSC_VER)) #define CRYPTOPP_BOOL_SSE41_INTRINSICS_AVAILABLE 1 #else #define CRYPTOPP_BOOL_SSE41_INTRINSICS_AVAILABLE 0 -- cgit v1.2.3