|
| 1 | +From 6702f69bef6044163acc7715e6ac7e430890ce78 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Frank Denis < [email protected]> |
| 3 | +Date: Wed, 7 Jan 2026 12:00:49 +0100 |
| 4 | +Subject: [PATCH] Fix compilation with GCC on aarch64 |
| 5 | + |
| 6 | +Use unsigned NEON intrinsics everywhere |
| 7 | + |
| 8 | +Fixes #1502 |
| 9 | + |
| 10 | +diff --git a/src/libsodium/crypto_ipcrypt/ipcrypt_armcrypto.c b/src/libsodium/crypto_ipcrypt/ipcrypt_armcrypto.c |
| 11 | +index c5a27e92..bad4ce38 100644 |
| 12 | +--- a/src/libsodium/crypto_ipcrypt/ipcrypt_armcrypto.c |
| 13 | ++++ b/src/libsodium/crypto_ipcrypt/ipcrypt_armcrypto.c |
| 14 | +@@ -37,7 +37,7 @@ typedef uint64x2_t BlockVec; |
| 15 | + # define XOR128_3(a, b, c) veorq_u64(veorq_u64((a), (b)), (c)) |
| 16 | + # define SET64x2(a, b) vsetq_lane_u64((uint64_t) (a), vmovq_n_u64((uint64_t) (b)), 1) |
| 17 | + # define BYTESHL128(a, b) \ |
| 18 | +- vreinterpretq_u64_u8(vextq_s8(vdupq_n_s8(0), vreinterpretq_s8_u64(a), 16 - (b))) |
| 19 | ++ vreinterpretq_u64_u8(vextq_u8(vdupq_n_u8(0), vreinterpretq_u8_u64(a), 16 - (b))) |
| 20 | + |
| 21 | + # define AES_XENCRYPT(block_vec, rkey) \ |
| 22 | + vreinterpretq_u64_u8( \ |
| 23 | +@@ -348,12 +348,12 @@ pfx_set_bit(uint8_t ip16[16], const unsigned int bit_index, const uint8_t bit_va |
| 24 | + static void |
| 25 | + pfx_shift_left(uint8_t ip16[16]) |
| 26 | + { |
| 27 | +- BlockVec v = LOAD128(ip16); |
| 28 | +- const BlockVec shl = vshlq_n_u8(vreinterpretq_u8_u64(v), 1); |
| 29 | +- const BlockVec msb = vshrq_n_u8(vreinterpretq_u8_u64(v), 7); |
| 30 | +- const BlockVec zero = vdupq_n_u8(0); |
| 31 | +- const BlockVec carries = vextq_u8(vreinterpretq_u8_u64(msb), zero, 1); |
| 32 | +- v = vreinterpretq_u64_u8(vorrq_u8(shl, carries)); |
| 33 | ++ BlockVec v = LOAD128(ip16); |
| 34 | ++ const uint8x16_t shl = vshlq_n_u8(vreinterpretq_u8_u64(v), 1); |
| 35 | ++ const uint8x16_t msb = vshrq_n_u8(vreinterpretq_u8_u64(v), 7); |
| 36 | ++ const uint8x16_t zero = vdupq_n_u8(0); |
| 37 | ++ const uint8x16_t carries = vextq_u8(msb, zero, 1); |
| 38 | ++ v = vreinterpretq_u64_u8(vorrq_u8(shl, carries)); |
| 39 | + STORE128(ip16, v); |
| 40 | + } |
| 41 | + |
| 42 | +-- |
| 43 | +2.52.0 |
| 44 | + |
0 commit comments