summaryrefslogtreecommitdiffstats
path: root/Modules/_sha3/sha3module.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-05-05 22:05:22 (GMT)
committerGitHub <noreply@github.com>2021-05-05 22:05:22 (GMT)
commit3b2a45ff95a68acc8276b37678c98740a232f6d4 (patch)
tree565ab4858c5f3b57b95b6ef018913baefb1dc123 /Modules/_sha3/sha3module.c
parent8f3ef457ad286e73f272dadec8b98d2ea3a6ec72 (diff)
downloadcpython-3b2a45ff95a68acc8276b37678c98740a232f6d4.zip
cpython-3b2a45ff95a68acc8276b37678c98740a232f6d4.tar.gz
cpython-3b2a45ff95a68acc8276b37678c98740a232f6d4.tar.bz2
bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927)
Contributed-By: Matthias Klose Automerge-Triggered-By: GH:tiran (cherry picked from commit da5c808fb50d34bc2e180d9481706072f33025da) Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Modules/_sha3/sha3module.c')
-rw-r--r--Modules/_sha3/sha3module.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c
index aba7f6d..3974e0b 100644
--- a/Modules/_sha3/sha3module.c
+++ b/Modules/_sha3/sha3module.c
@@ -64,6 +64,11 @@
#define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
#endif
+/* Prevent bus errors on platforms requiring aligned accesses such ARM. */
+#if HAVE_ALIGNED_REQUIRED && !defined(NO_MISALIGNED_ACCESSES)
+#define NO_MISALIGNED_ACCESSES
+#endif
+
/* mangle names */
#define KeccakF1600_FastLoop_Absorb _PySHA3_KeccakF1600_FastLoop_Absorb
#define Keccak_HashFinal _PySHA3_Keccak_HashFinal