diff --git a/library/alignment.h b/library/alignment.h index 211e7ac37..ff811e34d 100644 --- a/library/alignment.h +++ b/library/alignment.h @@ -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 diff --git a/library/common.h b/library/common.h index fd2aecb20..6c65084f4 100644 --- a/library/common.h +++ b/library/common.h @@ -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);