RE: [PATCH 0/3] lib/digsig: fix some bugs in digsig

From: Mimi Zohar

Date: Thu Dec 03 2026 - 07:13:26 EST


On Wed, 2026-12-02 at 22:44 -0800, Eric Biggers wrote:
> [ +Cc linux-crypto@xxxxxxxxxxxxxxx and linux-integrity@xxxxxxxxxxxxxxx ]
>
> On Thu, Dec 03, 2026 at 09:18:53AM +0300, Dan Carpenter wrote:
> > On Wed, Dec 02, 2026 at 12:57:16PM -0800, Andrew Morton wrote:
> > > On Wed, 02 Dec 2026 15:20:27 +0300 Dan Carpenter <dan@xxxxxxxx> wrote:
> > >
> > > > Pereq is doing formal verification work. These are some bugs we found.
> > > >
> > > > * Dereferencing an error pointer on the error path
> > > > * Not implementing the RFC correctly
> > > > * Allowing garbage bytes after a signature
> > > >
> > > > Fixing the last two bugs is just about correctness and they don't
> > > > actually affect real life.
> > > >
> > > > lib/digsig.c | 11 +++++++++++
> > >
> > > Thanks.
> > >
> > > hp2:/usr/src/mm> scripts/get_maintainer.pl -f lib/digsig.c
> > > Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> (maintainer:LIBRARY CODE)
> > > linux-kernel@xxxxxxxxxxxxxxx (open list:LIBRARY CODE)
> > > LIBRARY CODE status: Supported
> > > hp2:/usr/src/mm>
> > >
> > > Someone please change this!!
> >
> > Someone needs to summon Greg. Say his name three times. :P
> >
> > Realistically, it's probably going to fall to Mimi or maybe we could put
> > it under crypto?
> >
> > regards,
> > dan carpenter
>
> lib/crypto/ is for standalone cryptographic algorithm implementations.
>
> lib/digsig.c is a high-level keyring consumer (using the keyrings
> subsystem, which lib/crypto/ has no dependency on) that implements
> support for the IMA/EVM-specific obsolete v1 IMA/EVM signature format,
> hardcodes SHA-1 hashing, and uses a bespoke implementation of RSA PKCS#1
> v1.5 on top of the MPI library. Only that last part is a cryptographic
> algorithm implementation (of an obsolete algorithm, of course).
>
> I think it should be moved to be alongside its only caller in
> security/integrity/ and renamed to digsig_v1.c. That would make it be
> owned by "INTEGRITY MEASUREMENT ARCHITECTURE" in MAINTAINERS. Likewise,
> include/linux/digsig.h should be a local header in security/integrity/.
> Documentation/security/digsig.rst should just be deleted, I think.
>
> Mimi, Roberto, Dmitry: does that sound good to you?
>
> Note: at some point I'd like to fix the kernel's RSA code, in which case
> digsig_v1.c would have something better to call than the MPI library.
> But security/integrity/ is still the right place for this file.
>

Thanks, Dan, Eric.

Eric, that sounds fine. At some point, the original IMA v1 signature format
should be deprecated and removed. It played an important role at the time, but
was replaced relatively quickly with sigv2 to support other hash algorithms.

Would you be willing to review Dan's fixes?

Mimi