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: <2366240.1767794004@warthog.procyon.org.uk>
Date: Wed, 07 Jan 2026 13:53:24 +0000
From: David Howells <dhowells@...hat.com>
To: Ignat Korchagin <ignat@...udflare.com>
Cc: dhowells@...hat.com, Lukas Wunner <lukas@...ner.de>,
    Jarkko Sakkinen <jarkko@...nel.org>,
    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 v11 2/8] pkcs7: Allow the signing algo to calculate the digest itself

Ignat Korchagin <ignat@...udflare.com> wrote:

> > +                       ret = -ENOMEM;
> > +                       sig->digest = kmalloc(umax(sinfo->authattrs_len, sig->digest_size),
> > +                                             GFP_KERNEL);
> 
> Can we refactor this so we allocate the right size from the start.

The problem is that we don't know the right size until we've tried parsing it.

> Alternatively, should we just unconditionally use this approach
> "overallocating" some times?

In some ways, what I'd rather do is push the hash calculation down into the
crypto/ layer for all public key algos.

Also, we probably don't actually need to copy the authattrs, just retain a
pointer into the source buffer and the length since we don't intend to keep
the digest around beyond the verification procedure.  So I might be able to
get away with just a flag saying I don't need to free it.

However, there's an intermediate hash if there are authattrs, so I will need
to store that somewhere - though that could be allocated on demand.

David


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ