lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1902869.1769425868@warthog.procyon.org.uk>
Date: Mon, 26 Jan 2026 11:11:08 +0000
From: David Howells <dhowells@...hat.com>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: dhowells@...hat.com, Lukas Wunner <lukas@...ner.de>,
    Ignat Korchagin <ignat@...udflare.com>,
    Herbert Xu <herbert@...dor.apana.org.au>,
    Eric Biggers <ebiggers@...nel.org>,
    Luis Chamberlain <mcgrof@...nel.org>,
    Petr Pavlu <petr.pavlu@...e.com>, Daniel Gomez <da.gomez@...nel.org>,
    Sami Tolvanen <samitolvanen@...gle.com>,
    "Jason A . Donenfeld" <Jason@...c4.com>,
    Ard Biesheuvel <ardb@...nel.org>,
    Stephan Mueller <smueller@...onox.de>, linux-crypto@...r.kernel.org,
    keyrings@...r.kernel.org, linux-modules@...r.kernel.org,
    linux-kernel@...r.kernel.org
Subject: Re: [PATCH v14 3/5] pkcs7: Allow the signing algo to do whatever digestion it wants itself

Jarkko Sakkinen <jarkko@...nel.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ