[RFC PATCH 0/8] ima: measure modules with multiple appended signatures

From: Bruno Meneguele

Date: Thu Nov 26 2026 - 21:59:46 EST


Hi,

This RFC presents the support for modules with multiple signatures, *and mixed
algorithms*, appended. A scenario that requires it today is the PQC transition
period where modules are signed with both, eg., ML-DSA and ECDSA.

Appraisal already handles that: pkcs7_verify() accepts the file if a trusted
signer verifies and no other signer fails (unknown keys is not considered
failure). But measurement doesn't: 'd-modsig' and the binary blacklist check
take the content digest from pkcs7_get_digest(), which fails with more than one
signer, so the file loads unmeasured.

Patches #1 and #2 (for stable) fix two PKCS#7 bugs found on the way: a failed
digest left in sig->m, and pkcs7_get_digest() returning the signed attributes
instead of the content digest. Patch #3 adds support for multiple signers on
PKCS#7 code, but IMA 'd-modsig' can't describe it, so patches #4-#7 add a
template (patch #5 standardizes how ima-modsig records ML-DSA in the same way
proposed here for its v2):

ima-modsigv2 = d-ngv2 | n-ng | sig | d-modsig-list | modsig

'd-modsig-list' is <u32 count> x (<u32 entry_len><entry>), one 'd-modsig' entry
per signer in 'modsig' order, or "<sig algo>:" for direct data (eg. ML-DSA)
signatures:

d-ngv2: ima:sha256:a4fa30a9...48d3a449
n-ng: /test/t10-ecdsa512-mldsa65-noattr.ko
sig: 030304...feff
d-modsig-list: sha512:0e750939...f8c18dcb,mldsa65:
modsig: 30820e1706092a864886f70d010702a0...

Another example with ECDSA-SHA512+RSA-SHA256 and ML-DSA-65+ML-DSA-87:

d-modsig-list: sha512:0e750939...f8c18dcb,sha256:0ae76371...e37306f2
d-modsig-list: mldsa65:,mldsa87:

A signer with no usable digest gets an empty entry; with none, the measurement
list entry is dropped, as with 'd-modsig'. Patch #8 blocks a file if any
signer's digest is blacklisted.

Open questions: (1) should a dropped measurement be reported more explicitly
than by its audit record? (2) a pure ML-DSA signer has no content digest to
match a 'bin:' entry; how should that fit with the 'skid:' proposal [1]?

I tested module loading in a QEMU/KVM x86_64 and kernel image kexec in a PPC64LE
LPAR with RSA, ECDSA and ML-DSA-65/87, one or two signers, mixed hash algorithms
and rejected cases (bad messageDigest, two ML-DSA signers with one bad).

Claude Opus helped read the code, review the patches and write the tests (and
this cover-letter). I reviewed and reworked every diff and I'm responsible for
all of it.

Thanks,
Bruno

[1] https://lore.kernel.org/all/20261106173149.707244-1-zohar@xxxxxxxxxxxxx/


Bruno Meneguele (8):
pkcs7: don't cache a failed digest in pkcs7_digest()
pkcs7: return the content digest from pkcs7_get_digest()
pkcs7: support multiple signers in pkcs7_get_digest()
ima: get the modsig content digest of each signer
ima: record data-signing algorithms by name in 'd-modsig'
ima: add the 'd-modsig-list' template field
ima: define the ima-modsigv2 template
ima: check the digest of every modsig signer against the blacklist

Documentation/security/IMA-templates.rst | 8 +-
crypto/asymmetric_keys/pkcs7_verify.c | 83 +++++++--
include/crypto/pkcs7.h | 7 +-
security/integrity/ima/ima.h | 15 +-
security/integrity/ima/ima_appraise.c | 15 +-
security/integrity/ima/ima_modsig.c | 48 +++--
security/integrity/ima/ima_policy.c | 3 +-
security/integrity/ima/ima_template.c | 8 +-
security/integrity/ima/ima_template_lib.c | 208 ++++++++++++++++++----
security/integrity/ima/ima_template_lib.h | 4 +
10 files changed, 314 insertions(+), 85 deletions(-)

--
2.55.0