[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aPZ0OU75EuC3tlxn@zx2c4.com>
Date: Mon, 20 Oct 2025 19:44:13 +0200
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Eric Biggers <ebiggers@...nel.org>
Cc: linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-btrfs@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Ard Biesheuvel <ardb@...nel.org>
Subject: Re: [PATCH 01/10] lib/crypto: blake2s: Adjust parameter order of
blake2s()
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
Powered by blists - more mailing lists