Use new MBEDTLS_ARCH_IS_xxx macros

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-09-15 11:41:17 +01:00
parent a0f10da9d2
commit c5cc727dd0
2 changed files with 3 additions and 5 deletions

View file

@ -35,7 +35,7 @@
* efficient when this is not defined.
*/
#if defined(__ARM_FEATURE_UNALIGNED) \
|| defined(__i386__) || defined(__amd64__) || defined(__x86_64__) \
|| defined(MBEDTLS_ARCH_IS_X86) || defined(MBEDTLS_ARCH_IS_X64) \
|| defined(_M_ARM64) || defined(_M_ARM64EC)
/*
* __ARM_FEATURE_UNALIGNED is defined where appropriate by armcc, gcc 7, clang 9

View file

@ -194,8 +194,7 @@ inline void mbedtls_xor(unsigned char *r, const unsigned char *a, const unsigned
uint8x16_t x = veorq_u8(v1, v2);
vst1q_u8(r + i, x);
}
#elif defined(__amd64__) || defined(__x86_64__) || \
defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
#elif defined(MBEDTLS_ARCH_IS_X64) || defined(MBEDTLS_ARCH_IS_ARM64)
/* This codepath probably only makes sense on architectures with 64-bit registers */
for (; (i + 8) <= n; i += 8) {
uint64_t x = mbedtls_get_unaligned_uint64(a + i) ^ mbedtls_get_unaligned_uint64(b + i);
@ -234,8 +233,7 @@ static inline void mbedtls_xor_no_simd(unsigned char *r,
{
size_t i = 0;
#if defined(MBEDTLS_EFFICIENT_UNALIGNED_ACCESS)
#if defined(__amd64__) || defined(__x86_64__) || \
defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
#if defined(MBEDTLS_ARCH_IS_X64) || defined(MBEDTLS_ARCH_IS_ARM64)
/* This codepath probably only makes sense on architectures with 64-bit registers */
for (; (i + 8) <= n; i += 8) {
uint64_t x = mbedtls_get_unaligned_uint64(a + i) ^ mbedtls_get_unaligned_uint64(b + i);