[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <506171.1758637355@warthog.procyon.org.uk>
Date: Tue, 23 Sep 2025 15:22:35 +0100
From: David Howells <dhowells@...hat.com>
To: Eric Biggers <ebiggers@...nel.org>
Cc: dhowells@...hat.com, "Jason A. Donenfeld" <Jason@...c4.com>,
Ard Biesheuvel <ardb@...nel.org>,
Harald Freudenberger <freude@...ux.ibm.com>,
Holger Dengler <dengler@...ux.ibm.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Stephan Mueller <smueller@...onox.de>, Simo Sorce <simo@...hat.com>,
linux-crypto@...r.kernel.org, linux-s390@...r.kernel.org,
keyrings@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] lib/crypto: Add SHA3-224, SHA3-256, SHA3-384, SHA-512, SHAKE128, SHAKE256
Eric Biggers <ebiggers@...nel.org> wrote:
> Also, the parameter should be strongly typed: 'struct sha3_state *'
> Likewise in all the other functions that take the raw u64 array.
Those function may be directly substituted by calls to assembly code - so
u64[] is probably more appropriate.
> > + for (round = 0; round < KECCAK_ROUNDS; round++) {
> > + keccakf_round(st);
> > + /* Iota */
> > + st[0] ^= keccakf_rndc[round];
> > + }
>
> In the spec, "Iota" is part of the round. Having it be separate from
> keccakf_round() in the code is confusing.
I assume that pertains to the comment about inlining in some way. This is as
is in sha3_generic.c. I can move it into the round function if you like, but
can you tell me what the effect will be?
> Second, the support for update() + squeeze() + update() + squeeze()
> seems to be trying to achieve something that is not defined in the SHA-3
> spec. Could you elaborate on what it is meant to be doing, and why it's
> here? According to the spec, the XOFs SHAKE128 and SHAKE256 actually
> just take a single message as their input.
Turns out I was misunderstanding what I was looking at whilst trying to adapt
Leancrypto's dilithium code. Whilst it does squeeze a context several times,
it doesn't update it after finalising it without reinitialising it.
David
Powered by blists - more mailing lists