Skip to content

Commit da5c808

Browse files
authored
bpo-36515: Disable unaligned memory access in _sha3 on ARM (pythonGH-25927)
Contributed-By: Matthias Klose Automerge-Triggered-By: GH:tiran
1 parent 565a318 commit da5c808

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The :mod:`hashlib` module no longer does unaligned memory accesses when
2+
compiled for ARM platforms.

Modules/_sha3/sha3module.c

+5
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464
#define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
6565
#endif
6666

67+
/* Prevent bus errors on platforms requiring aligned accesses such ARM. */
68+
#if HAVE_ALIGNED_REQUIRED && !defined(NO_MISALIGNED_ACCESSES)
69+
#define NO_MISALIGNED_ACCESSES
70+
#endif
71+
6772
/* mangle names */
6873
#define KeccakF1600_FastLoop_Absorb _PySHA3_KeccakF1600_FastLoop_Absorb
6974
#define Keccak_HashFinal _PySHA3_Keccak_HashFinal

0 commit comments

Comments
 (0)