From be0928666614cf52510845ad1d3c44607b075f1d Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 8 Aug 2023 10:42:55 +0100 Subject: [PATCH] Enable 8-byte fastpath in mbedtls_xor on ARM64 and ARM64EC Signed-off-by: Dave Rodgman --- library/common.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/common.h b/library/common.h index 3c472c685d..f838216910 100644 --- a/library/common.h +++ b/library/common.h @@ -188,7 +188,8 @@ 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__) +#elif defined(__amd64__) || defined(__x86_64__) || \ + defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) /* 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); @@ -227,7 +228,8 @@ 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__) +#if defined(__amd64__) || defined(__x86_64__) || \ + defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) /* 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);