[PATCH 01/10] lib/crypto: blake2s: Adjust parameter order of blake2s()
Jason A. Donenfeld
Jason at zx2c4.com
Mon Oct 20 10:44:13 PDT 2025
Hi Eric,
On Sun, Oct 19, 2025 at 09:07:29AM -0700, Eric Biggers wrote:
> On Sun, Oct 19, 2025 at 04:36:36PM +0200, Jason A. Donenfeld wrote:
> > On Fri, Oct 17, 2025 at 09:30:57PM -0700, Eric Biggers wrote:
> > > Reorder the parameters of blake2s() from (out, in, key, outlen, inlen,
> > > keylen) to (key, keylen, in, inlen, out, outlen).
> >
> > No objections to putting the size next to the argument. That makes
> > sense. But the order really should be:
> >
> > out, outlen, in, inlen, key, keylen
> >
> > in order to match normal APIs that output data. The output argument goes
> > first. The input argument goes next. Auxiliary information goes after.
>
> In general, both conventions are common. But in the other hashing
> functions in the kernel, we've been using output last. I'd like to
> prioritize making it consistent with:
Hm. I don't like that. But I guess if that's what
every-single-other-hash-function-does, then blake2s should follow the
convention, to avoid churn of adding something new?
I went looking at C crypto libraries to see what generally the trend is,
and I saw that crypto_hash from nacl and libsodium and supercop do `out,
in`, as does cryptlib, but beyond that, most libraries don't provide an
all-in-one-interface but only have init/update/final. So however you see
fit, I guess; I don't want to hold up progress.
Jason
More information about the linux-arm-kernel
mailing list