]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927) (GH-25928)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 6 May 2021 06:55:35 +0000 (23:55 -0700)
committerGitHub <noreply@github.com>
Thu, 6 May 2021 06:55:35 +0000 (08:55 +0200)
Contributed-By: Matthias Klose
Automerge-Triggered-By: GH:tiran
(cherry picked from commit da5c808fb50d34bc2e180d9481706072f33025da)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Misc/NEWS.d/next/Library/2021-05-05-11-44-49.bpo-36515.uOSa3q.rst [new file with mode: 0644]
Modules/_sha3/sha3module.c

diff --git a/Misc/NEWS.d/next/Library/2021-05-05-11-44-49.bpo-36515.uOSa3q.rst b/Misc/NEWS.d/next/Library/2021-05-05-11-44-49.bpo-36515.uOSa3q.rst
new file mode 100644 (file)
index 0000000..dd24474
--- /dev/null
@@ -0,0 +1,2 @@
+The :mod:`hashlib` module no longer does unaligned memory accesses when
+compiled for ARM platforms.
index c826b42df13f92f7f026cc3b00230786d78147a5..b6a7130dd86974a0c761f9541a6d555fbed4eb4c 100644 (file)
 #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