MD4, MD5, SHA1, SHA224, SHA256, SHA384 and SHA512 Init/Update/Final and
the SHA256 one-shot threw. They now hash as LibreSSL does, on the
caller's MD4_CTX, MD5_CTX, SHA_CTX, SHA256_CTX and SHA512_CTX laid out as
in LibreSSL's md4.h, md5.h and sha.h, so a context copied or inspected
by the title stays valid: the bit count in Nl/Nh, the partial block in
data with its length in num, and md_len selecting the truncated digest.
Final pads and clears the buffer as LibreSSL's sources do.
Cases that differ between LibreSSL versions throw: SHA256 with a null
digest buffer and SHA512_Final with the SHA-512/224 or SHA-512/256
length. The test checks the RFC 1320, RFC 1321 and FIPS 180 vectors over
several chunk sizes, the context fields, copied contexts and those
cases.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>