From: David Howells <dhowells@redhat.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: dhowells@redhat.com, Lukas Wunner <lukas@wunner.de>,
Ignat Korchagin <ignat@cloudflare.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Eric Biggers <ebiggers@kernel.org>,
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>,
linux-crypto@vger.kernel.org, keyrings@vger.kernel.org,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v14 3/5] pkcs7: Allow the signing algo to do whatever digestion it wants itself
Date: Mon, 26 Jan 2026 11:11:08 +0000 [thread overview]
Message-ID: <1902869.1769425868@warthog.procyon.org.uk> (raw)
In-Reply-To: <aXYq_9XoOx5WaoU9@kernel.org>
Jarkko Sakkinen <jarkko@kernel.org> wrote:
> > (1) Rename ->digest and ->digest_len to ->m and ->m_size to represent the
> > input to the signature verification algorithm, reflecting that
> > ->digest may no longer actually *be* a digest.
> ...
> These renames emit enough noise to be split into a separate patch.
Yeah, I had considered that, so I've now done that.
> > + if (sig->algo_takes_data) {
> > + sig->m_size = sinfo->authattrs_len;
> > + memcpy(sig->m, sinfo->authattrs, sinfo->authattrs_len);
> > + sig->m[0] = ASN1_CONS_BIT | ASN1_SET;
> > + ret = 0;
> > + } else {
> > + u8 tag = ASN1_CONS_BIT | ASN1_SET;
> > +
> > + ret = crypto_shash_init(desc);
> > + if (ret < 0)
> > + goto error;
> > + ret = crypto_shash_update(desc, &tag, 1);
> > + if (ret < 0)
> > + goto error;
> > + ret = crypto_shash_finup(desc, sinfo->authattrs + 1,
> > + sinfo->authattrs_len - 1,
> > + sig->m);
> > + if (ret < 0)
> > + goto error;
> > + }
Thinking further on this, I think it's better just to do the copy and modify
unconditionally and then in the second case here just call
crypto_hash_digest(). That means we end up doing a single crypto call on an
aligned buffer. It's not like expect the authattrs to be particularly big for
an RSA signature.
David
next prev parent reply other threads:[~2026-01-26 11:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 22:36 [PATCH v14 0/5] x509, pkcs7, crypto: Add ML-DSA and RSASSA-PSS signing David Howells
2026-01-21 22:36 ` [PATCH v14 1/5] crypto: Add ML-DSA crypto_sig support David Howells
2026-01-21 22:36 ` [PATCH v14 2/5] x509: Separately calculate sha256 for blacklist David Howells
2026-01-25 14:34 ` Jarkko Sakkinen
2026-01-21 22:36 ` [PATCH v14 3/5] pkcs7: Allow the signing algo to do whatever digestion it wants itself David Howells
2026-01-25 14:38 ` Jarkko Sakkinen
2026-01-26 11:11 ` David Howells [this message]
2026-01-21 22:36 ` [PATCH v14 4/5] pkcs7, x509: Add ML-DSA support David Howells
2026-01-25 14:42 ` Jarkko Sakkinen
2026-01-26 11:25 ` David Howells
2026-01-26 13:56 ` James Bottomley
2026-01-26 12:02 ` Christophe Leroy (CS GROUP)
2026-01-21 22:36 ` [PATCH v14 5/5] modsign: Enable ML-DSA module signing David Howells
2026-01-25 14:44 ` Jarkko Sakkinen
2026-01-23 11:13 ` [PATCH v14 0/5] x509, pkcs7, crypto: Add ML-DSA and RSASSA-PSS signing David Howells
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=1902869.1769425868@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=da.gomez@kernel.org \
--cc=ebiggers@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=ignat@cloudflare.com \
--cc=jarkko@kernel.org \
--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