On Tue, May 5, 2020 at 2:26 PM Havard Eidnes <h...@netbsd.org> wrote: > > > I must admit I'm scratching my head about this one. > > No more! And I stil have hair! > > Looking at the diff between ISC's lib/isc/sha2.c and ours reveals > that our source has code to overcome alignment issues, but in the > conversion one statement has been omitted...
The alignment is important on some arches, like mips and sparc. Sparc has an optimized move for 64-bits (ldx instruction) but the data must be naturally aligned to the word. SHA-384 and SHA-512 use 64-bit words, so the problem will surface under them (and not SHA-1 and SHA-256, which use 32-bit words). If the alignment is off then you'll get SIGBUS crashes like https://github.com/weidai11/cryptopp/issues/691. Jeff