Simplify Windows-on-Arm macros

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-09-15 11:52:06 +01:00
parent c5cc727dd0
commit 0a48717b83
6 changed files with 12 additions and 14 deletions

View file

@ -74,6 +74,10 @@
#define MBEDTLS_ARCH_IS_X86
#endif
#if defined(_M_ARM64) || defined(_M_ARM64EC)
#define MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64
#endif
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
#define _CRT_SECURE_NO_DEPRECATE 1
#endif

View file

@ -36,7 +36,7 @@
*/
#if defined(__ARM_FEATURE_UNALIGNED) \
|| defined(MBEDTLS_ARCH_IS_X86) || defined(MBEDTLS_ARCH_IS_X64) \
|| defined(_M_ARM64) || defined(_M_ARM64EC)
|| defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64)
/*
* __ARM_FEATURE_UNALIGNED is defined where appropriate by armcc, gcc 7, clang 9
* (and later versions) for Arm v7 and later; all x86 platforms should have

View file

@ -114,7 +114,8 @@ int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X,
* about whether the assignment was made or not.
* (Leaking information about the respective sizes of X and Y is ok however.)
*/
#if defined(_MSC_VER) && defined(_M_ARM64) && (_MSC_FULL_VER < 193131103)
#if defined(_MSC_VER) && defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64) && \
(_MSC_FULL_VER < 193131103)
/*
* MSVC miscompiles this function if it's inlined prior to Visual Studio 2022 version 17.1. See:
* https://developercommunity.visualstudio.com/t/c-compiler-miscompiles-part-of-mbedtls-library-on/1646989

View file

@ -34,9 +34,7 @@
#if defined(__ARM_NEON)
#include <arm_neon.h>
#define MBEDTLS_HAVE_NEON_INTRINSICS
#endif /* __ARM_NEON */
#if defined(_M_ARM64) || defined(_M_ARM64EC)
#elif defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64)
#include <arm64_neon.h>
#define MBEDTLS_HAVE_NEON_INTRINSICS
#endif

View file

@ -108,7 +108,7 @@
# include <signal.h>
# endif
# endif
#elif !(defined(_M_ARM64) || defined(_M_ARM64EC))
#elif !defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64)
# undef MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY
# undef MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT
#endif
@ -128,7 +128,7 @@ static int mbedtls_a64_crypto_sha256_determine_support(void)
{
return 1;
}
#elif defined(_M_ARM64) || defined(_M_ARM64EC)
#elif defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <processthreadsapi.h>

View file

@ -119,12 +119,7 @@
# include <signal.h>
# endif
# endif
#elif defined(_M_ARM64)
# if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) || \
defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY)
# include <arm64_neon.h>
# endif
#else
#elif !defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64)
# undef MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY
# undef MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT
#endif
@ -152,7 +147,7 @@ static int mbedtls_a64_crypto_sha512_determine_support(void)
NULL, 0);
return ret == 0 && value != 0;
}
#elif defined(_M_ARM64) || defined(_M_ARM64EC)
#elif defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64)
/*
* As of March 2022, there don't appear to be any PF_ARM_V8_* flags
* available to pass to IsProcessorFeaturePresent() to check for