Re: [PATCH v2] lib/crypto: Add SHA3-224, SHA3-256, SHA3-384, SHA-512, SHAKE128, SHAKE256
From: Stephan Mueller
Date: Fri Sep 19 2025 - 15:53:23 EST
Am Freitag, 19. September 2025, 21:48:00 Mitteleuropäische Sommerzeit
schrieb David Howells:
Hi David,
> > I see you also have a test in sha3_mod_init(), which doesn't make
sense.
> > The tests should be in the KUnit test suite(s). If you intended for
the
> > sha3_mod_init() test to be a FIPS pre-operational self-test, then (1)
it
> > would first need to be confirmed with the people doing FIPS
> > certifications that a FIPS pre-operational self-test is actually
> > necessary here, (2) it would need to be fixed to actually fulfill the
> > requirements for that type of test such as panicing the kernel on
> > failure, and (3) it would need to come in its own patch with its own
> > explanation. But, unless you are sure you actually need the FIPS test,
> > just omit it out for now and focus on the real tests.
>
> I disagree. It should have at least a single self-test. If we fail to
load
> any modules because the hash is broken on a particular CPU, it would be
> useful to have a note in dmesg. Loading kunit test modules becomes
tricky
> in such a case.
Just for clarifications of the FIPS requirements: One test of any of the
SHA3/SHAKE algorithms during startup is sufficient for *one* Keccak
implementation. FIPS wants the actual Keccak sponge being tested, it does
not care for the miniscule differences between the different SHA/SHAKE
definitions.
Yet, if we have multiple Keccak sponge implementations, then each needs its
own self test.
Ciao
Stephan