openwall / john

John the Ripper jumbo - advanced offline password cracker, which supports hundreds of hash and cipher types, and runs on many operating systems, CPUs, GPUs, and even some FPGAs
https://www.openwall.com/john/
Other
10.37k stars 2.11k forks source link

Argon2 formats insufficient binary alignment #5572

Closed claudioandre-br closed 2 weeks ago

claudioandre-br commented 2 weeks ago

Since you guys are playing with it, perhaps this information could be useful.

Testing: Argon2 [BlaMka 256/256 AVX2]... formats.c:2099:9: runtime error: load of misaligned address 0x55c34cba1d61 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x55c34cba1d61: note: pointer points here
 00 00 00  50 c3 dc 37 b3 9f f3 57  cf 8f 70 06 65 26 19 d3  08 e1 3e bc 19 19 b2 c9  99 7f a8 ce ab
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior formats.c:2099:9 
formats.c:2104:9: runtime error: load of misaligned address 0x55c34cba1d61 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x55c34cba1d61: note: pointer points here
 00 00 00  50 c3 dc 37 b3 9f f3 57  cf 8f 70 06 65 26 19 d3  08 e1 3e bc 19 19 b2 c9  99 7f a8 ce ab
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior formats.c:2104:9 
formats.c:2109:9: runtime error: load of misaligned address 0x55c34cba1d61 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x55c34cba1d61: note: pointer points here
 00 00 00  50 c3 dc 37 b3 9f f3 57  cf 8f 70 06 65 26 19 d3  08 e1 3e bc 19 19 b2 c9  99 7f a8 ce ab
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior formats.c:2109:9 
formats.c:2114:9: runtime error: load of misaligned address 0x55c34cba1d61 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x55c34cba1d61: note: pointer points here
 00 00 00  50 c3 dc 37 b3 9f f3 57  cf 8f 70 06 65 26 19 d3  08 e1 3e bc 19 19 b2 c9  99 7f a8 ce ab
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior formats.c:2114:9 
formats.c:2119:9: runtime error: load of misaligned address 0x55c34cba1d61 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x55c34cba1d61: note: pointer points here
 00 00 00  50 c3 dc 37 b3 9f f3 57  cf 8f 70 06 65 26 19 d3  08 e1 3e bc 19 19 b2 c9  99 7f a8 ce ab
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior formats.c:2119:9 
formats.c:2124:9: runtime error: load of misaligned address 0x55c34cba1d61 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x55c34cba1d61: note: pointer points here
 00 00 00  50 c3 dc 37 b3 9f f3 57  cf 8f 70 06 65 26 19 d3  08 e1 3e bc 19 19 b2 c9  99 7f a8 ce ab
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior formats.c:2124:9 
formats.c:2129:9: runtime error: load of misaligned address 0x55c34cba1d61 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x55c34cba1d61: note: pointer points here
 00 00 00  50 c3 dc 37 b3 9f f3 57  cf 8f 70 06 65 26 19 d3  08 e1 3e bc 19 19 b2 c9  99 7f a8 ce ab
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior formats.c:2129:9 
solardiz commented 2 weeks ago

Oh, I see, since we use fmt_default_binary_hash_0, etc. in both Argon2 formats (CPU and OpenCL), we have to align the "binaries" for uint32_t. For this, we need not only to revert my recent change of BINARY_ALIGN, but also make get_binary() ensure that alignment of its return value.