From: "Elliott, Robert (Servers)" <elliott@hpe.com>
To: Eric Biggers <ebiggers@kernel.org>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
David Howells <dhowells@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
Ard Biesheuvel <ardb@kernel.org>,
"Stephan Mueller" <smueller@chronox.de>,
Lukas Wunner <lukas@wunner.de>,
"Ignat Korchagin" <ignat@cloudflare.com>,
"keyrings@vger.kernel.org" <keyrings@vger.kernel.org>,
"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2 1/2] lib/crypto: Add ML-DSA verification support
Date: Wed, 26 Nov 2025 21:29:10 +0000 [thread overview]
Message-ID: <IA4PR84MB4011F4D5B7EF52901829AD94ABDEA@IA4PR84MB4011.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20251126203517.167040-2-ebiggers@kernel.org>
> -----Original Message-----
> From: Eric Biggers <ebiggers@kernel.org>
> Subject: [PATCH v2 1/2] lib/crypto: Add ML-DSA verification support
...
> +++ b/lib/crypto/mldsa.c
> +} mldsa_parameter_sets[] = {
> + [MLDSA44] = {
> + .ctilde_len = 32,
> + .pk_len = MLDSA44_PUBLIC_KEY_SIZE,
> + .sig_len = MLDSA44_SIGNATURE_SIZE,
> + },
> + [MLDSA65] = {
> + .ctilde_len = 48,
> + .pk_len = MLDSA65_PUBLIC_KEY_SIZE,
> + .sig_len = MLDSA65_SIGNATURE_SIZE,
> + },
> + [MLDSA87] = {
> + .ctilde_len = 64,
> + .pk_len = MLDSA87_PUBLIC_KEY_SIZE,
> + .sig_len = MLDSA87_SIGNATURE_SIZE,
> + },
...
> + union {
...
> + /* The commitment hash. Real length is params->ctilde_len */
> + u8 ctildeprime[64];
> + };
...
> + /* Recreate the challenge c from the signer's commitment hash. */
> + sample_in_ball(&ws->c, ctilde, params->ctilde_len, params->tau,
> + &ws->shake);
...
> + /* Finish computing ctildeprime. */
> + shake_squeeze(&ws->shake, ws->ctildeprime, params->ctilde_len);
...
> + /* Verify that ctilde == ctildeprime. */
> + if (memcmp(ws->ctildeprime, ctilde, params->ctilde_len) != 0)
> + return -EKEYREJECTED;
Is there any way to ensure that each ctilde_len value is <= 64
and <= the corresponding .sig_size value at compile time so there's
no risk of overflowing any buffers?
next prev parent reply other threads:[~2025-11-26 21:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 20:35 [PATCH v2 0/2] lib/crypto: ML-DSA verification support Eric Biggers
2025-11-26 20:35 ` [PATCH v2 1/2] lib/crypto: Add " Eric Biggers
2025-11-26 21:29 ` Elliott, Robert (Servers) [this message]
2025-11-26 21:42 ` Eric Biggers
2025-11-26 20:35 ` [PATCH v2 2/2] lib/crypto: tests: Add KUnit tests for ML-DSA verification Eric Biggers
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=IA4PR84MB4011F4D5B7EF52901829AD94ABDEA@IA4PR84MB4011.NAMPRD84.PROD.OUTLOOK.COM \
--to=elliott@hpe.com \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=da.gomez@kernel.org \
--cc=dhowells@redhat.com \
--cc=ebiggers@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=ignat@cloudflare.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mcgrof@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=samitolvanen@google.com \
--cc=smueller@chronox.de \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).