mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +03:00
Enable 8-byte fastpath in mbedtls_xor on ARM64 and ARM64EC
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
@@ -188,7 +188,8 @@ inline void mbedtls_xor(unsigned char *r, const unsigned char *a, const unsigned
|
|||||||
uint8x16_t x = veorq_u8(v1, v2);
|
uint8x16_t x = veorq_u8(v1, v2);
|
||||||
vst1q_u8(r + i, x);
|
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 */
|
/* This codepath probably only makes sense on architectures with 64-bit registers */
|
||||||
for (; (i + 8) <= n; i += 8) {
|
for (; (i + 8) <= n; i += 8) {
|
||||||
uint64_t x = mbedtls_get_unaligned_uint64(a + i) ^ mbedtls_get_unaligned_uint64(b + i);
|
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;
|
size_t i = 0;
|
||||||
#if defined(MBEDTLS_EFFICIENT_UNALIGNED_ACCESS)
|
#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 */
|
/* This codepath probably only makes sense on architectures with 64-bit registers */
|
||||||
for (; (i + 8) <= n; i += 8) {
|
for (; (i + 8) <= n; i += 8) {
|
||||||
uint64_t x = mbedtls_get_unaligned_uint64(a + i) ^ mbedtls_get_unaligned_uint64(b + i);
|
uint64_t x = mbedtls_get_unaligned_uint64(a + i) ^ mbedtls_get_unaligned_uint64(b + i);
|
||||||
|
Reference in New Issue
Block a user