Files
ipxe/src
Michael Brown 327378a764 [crypto] Generalise implementation of Merkle-Damgård hash algorithms
All of our current digest algorithms (MD4, MD5, SHA-1, and the SHA-2
family) use a Merkle-Damgård construction, with only the compression
function, the initial digest values, the field sizes, and the
endianness differing between algorithms.

Provide a common implementation for Merkle-Damgård hash algorithms to
reduce code size.  Values are now held as host-endian quantities, with
any swapping performed byte-by-byte as data is accumulated (using a
compile-time constant that is XORed with the byte index).

For the SHA family of algorithms, the values w[] are now calculated
iteratively as we progress through the main loop: this substantially
reduces the stack space required for the compression function.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-06-23 13:24:22 +01:00
..