On 31/08/2025 02:00, Collin Funk wrote:
Hi,

Pádraig and I both wanted to add SHA-3 to cksum before the next
coreutils release. These two patches add the sha3-buffer module and
tests to Gnulib. They use the u64 module so that projects that care
about platforms without 64-bit integers can use them like Emacs. I can
have a look at adding it there later.

Tested on x86_64 and MIPS64 (big endian) with both 64-bit integers and
32-bit integers.

The module currently does not have OpenSSL support since it cannot be
done in the same way as the other Gnulib crypto modules. SHA-3 was
created after OpenSSL deprecated the <CIPHER>_Init, <CIPHER>_Update,
<CIPHER>_Final functions if my memory serves me correctly. So the SHA-3
versions of those do not exist. We would have to use the EVP interface
instead [1]. I'll have a look at it adding that later, but figured it
would make reviewing the patch harder.

Anyways, will push this patch later to give some time for review. I'll
have to write the the crypto/sha3-stream module but that is fairly
simple.

Collin

[1] https://docs.openssl.org/master/man3/EVP_DigestInit/#examples
Excellent.

This looks to be a from scratch implementation,
rather than being based on any reference implementations right?

I agree it's best to add the libcrypto complication after.

It would be good to verify that we don't have the following bug
from the reference implementations:
https://mouha.be/sha-3-buffer-overflow/

thanks!
Padraig

Reply via email to