On 06/09/2025 03:32, Collin Funk wrote:
Hi Pádraig,
Collin Funk <[email protected]> writes:
So in summary, I'd revert the previous patch,
and we'll figure out how to proceed from there.
Thanks, I'll have a look later today. I'll probably just move SHA-3 to
returning bool for errors (e.g. OOM). In coreutils we can xalloc_die, in
libraries they decision on how to handle that can be left up to them.
Thanks again for noticing this.
What do you think of the attached patch?
# Before patch
$ valgrind ./src/cksum -a sha3 -l 256 Makefile Makefile.am \
COPYING README 2>&1 | grep -F 'definitely lost'
==148531== definitely lost: 1,664 bytes in 4 blocks
# After patch
$ valgrind ./src/cksum -a sha3 -l 256 Makefile Makefile.am \
COPYING README 2>&1 | grep -F 'definitely lost'
==151416== definitely lost: 0 bytes in 0 blocks
Since OpenSSL is just going to allocate a bunch of memory anyways, there
is no point in trying to avoid EVP_MD_CTX_create, in my opinion. It also
makes the module more library friendly, which should hopefully alleviate
Simon's concerns. And makes it so we don't have to worry about
EVP_MD_CTX increasing in future versions of OpenSSL, however unlikely
that is.
For the purposes of Coreutils, we just have to add an extra xalloc_die
ourselves, which is no big deal.
Right propagating the error for this new interface seems best.
thanks,
Padraig