From 3a41ecabd4a351753a379d6754031b0cf4cf6bca Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Mon, 19 Oct 2020 10:51:18 +0100 Subject: [PATCH] Use aligned access for _sha3 module on ARM. Gbp-Pq: Name arm-alignment.diff --- Modules/_sha3/sha3module.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c index c826b42..392ae53 100644 --- a/Modules/_sha3/sha3module.c +++ b/Modules/_sha3/sha3module.c @@ -64,6 +64,12 @@ #define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN #endif +/* Bus error on 32-bit ARM due to un-aligned memory accesses; 64-bit ARM + * doesn't complain but un-aligned memory accesses are sub-optimal */ +#if defined(__arm__) || defined(__aarch64__) +#define NO_MISALIGNED_ACCESSES 1 +#endif + /* mangle names */ #define KeccakF1600_FastLoop_Absorb _PySHA3_KeccakF1600_FastLoop_Absorb #define Keccak_HashFinal _PySHA3_Keccak_HashFinal -- 2.30.2