Use aligned access for _sha3 module on ARM.
authorDave Jones <dave.jones@canonical.com>
Sun, 1 Dec 2024 12:12:57 +0000 (14:12 +0200)
committerAdrian Bunk <bunk@debian.org>
Sun, 1 Dec 2024 12:12:57 +0000 (14:12 +0200)
Gbp-Pq: Name arm-alignment.diff

Modules/_sha3/sha3module.c

index c826b42df13f92f7f026cc3b00230786d78147a5..392ae537a540a5ba3eb2b316e99349acd96224c7 100644 (file)
 #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