From 7613b3d6b871a1dbd2b84eb51b14c6d45d9970ea Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 23 May 2023 00:48:38 +0100 Subject: [PATCH] Fix xor fail for large block size Signed-off-by: Dave Rodgman --- library/common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/common.h b/library/common.h index 9c096024eb..94b8c5db34 100644 --- a/library/common.h +++ b/library/common.h @@ -131,10 +131,10 @@ inline void mbedtls_xor(unsigned char *r, const unsigned char *a, const unsigned #if defined(MBEDTLS_EFFICIENT_UNALIGNED_ACCESS) #if defined(__aarch64__) && defined(__ARM_NEON) for (; (i + 16) <= n; i += 16) { - uint64x2_t v1 = vld1q_u64((uint64_t *) a); - uint64x2_t v2 = vld1q_u64((uint64_t *) b); + uint64x2_t v1 = vld1q_u64((uint64_t *) (a + i)); + uint64x2_t v2 = vld1q_u64((uint64_t *) (b + i)); uint64x2_t x = veorq_u64(v1, v2); - vst1q_u64((uint64_t *) r, x); + vst1q_u64((uint64_t *) (r + i), x); } #elif defined(__amd64__) || defined(__x86_64__) || defined(__aarch64__) /* This codepath probably only makes sense on architectures with 64-bit registers */