From: Eric Biggers <ebiggers@kernel.org>
To: David Howells <dhowells@redhat.com>
Cc: linux-crypto@vger.kernel.org
Subject: Re: SHAKE256 support
Date: Wed, 17 Sep 2025 14:28:29 -0500 [thread overview]
Message-ID: <20250917192829.GA8743@quark> (raw)
In-Reply-To: <3230006.1758136267@warthog.procyon.org.uk>
On Wed, Sep 17, 2025 at 08:11:07PM +0100, David Howells wrote:
> Eric Biggers <ebiggers@kernel.org> wrote:
>
> > On Wed, Sep 17, 2025 at 05:20:43PM +0100, David Howells wrote:
> > > Okay, I have lib/crypto/sha3 working. One question though: why are the hash
> > > tests built as separate kunit modules rather than being built into the
> > > algorithm module init function and marked __init/__initdata?
> >
> > KUnit is the standard way to do unit testing in the kernel these days.
> > The kernel community has been working on migrating legacy ad-hoc tests
> > over to KUnit. This is not specific to lib/crypto/.
>
> How do you test hashes with variable length digests (e.g. SHAKE128/256) using
> the hash testing infrastructure in lib/crypto/tests/?
Same as BLAKE2s
(https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/tree/lib/crypto/tests/blake2s_kunit.c?h=libcrypto-next).
Just choose a fixed output length to use with hash-test-template.h, and
instantiate those test cases. Then also add additional test cases to
your *_kunit.c file that cover other output lengths.
If you'd like to refactor things so that some of the variable-length
output test logic can be shared between the BLAKE2s and SHAKE tests,
that is a possibility. But I expect it wouldn't be worthwhile yet.
- Eric
next prev parent reply other threads:[~2025-09-17 19:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 20:51 SHAKE256 support David Howells
2025-09-15 21:00 ` David Howells
2025-09-15 22:07 ` Eric Biggers
2025-09-17 16:20 ` David Howells
2025-09-17 18:48 ` Eric Biggers
2025-09-17 19:11 ` David Howells
2025-09-17 19:28 ` Eric Biggers [this message]
2025-09-18 3:53 ` Joachim Vandersmissen
2025-09-18 4:17 ` Eric Biggers
2025-09-18 13:37 ` Simo Sorce
2025-09-18 15:53 ` Eric Biggers
2025-09-19 0:05 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250917192829.GA8743@quark \
--to=ebiggers@kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox