mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Add bulk signing support for PKCS#11 keys
@ 2026-10-09 10:19 Massimiliano Marretta
  2026-10-09 10:19 ` [PATCH 1/2] scripts/sign-file: add bulk module signing support Massimiliano Marretta
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Massimiliano Marretta @ 2026-10-09 10:19 UTC (permalink / raw)
  To: David Howells, David Woodhouse, Nathan Chancellor, Nicolas Schier
  Cc: keyrings, linux-kbuild, linux-kernel, Massimiliano Marretta

Add support for signing kernel modules in bulk when the signing
key is stored on a PKCS#11 token.

Currently scripts/sign-file signs one module per invocation. When
the key lives on a PKCS#11 token (e.g. a Nitrokey HSM or a
SmartCard-HSM), every invocation pays a fixed initialization cost
of 25-36 seconds, which dominates the actual signing time. For a
typical build with hundreds of modules this is impractical.

This series adds a '-b' (bulk) option to scripts/sign-file and
teaches the kbuild system to use it automatically when the signing
key is provided as a PKCS#11 URI. The classic one-module-at-a-time
behavior is preserved when the key is a PEM file.

Patch 1/2 also extracts the body of the signing logic into a
dedicated sign_single_file() helper. This is done to keep the
new bulk loop in main() readable and to avoid duplicating the
argument parsing logic. The extracted function contains no
functional changes with respect to the current upstream code.

Measured on a build with 50 modules and the key stored on a
SmartCard-HSM:
  - before: ~24 minutes
  - after:  ~3 min 17 s

Note on checkpatch: the series produces a few "trailing statements
should be on next line" errors on sign-file.c. These come from the
switch statement in main() that is moved within the file by patch
1/2. The affected lines use the exact same style as the current
upstream sources (case 'x': stmt; break;) and are not introduced
by this series.

Massimiliano Marretta (2):
  scripts/sign-file: add bulk module signing support
  kbuild: sign modules in bulk when the signing key is on PKCS#11

 scripts/Makefile.modinst |  43 ++++++++++-
 scripts/sign-file.c      | 159 ++++++++++++++++++++++++---------------
 2 files changed, 142 insertions(+), 60 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-09 17:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 10:19 [PATCH 0/2] Add bulk signing support for PKCS#11 keys Massimiliano Marretta
2026-10-09 10:19 ` [PATCH 1/2] scripts/sign-file: add bulk module signing support Massimiliano Marretta
2026-10-09 10:19 ` [PATCH 2/2] kbuild: sign modules in bulk when the signing key is on PKCS#11 Massimiliano Marretta
2026-10-09 13:52 ` [PATCH 0/2] Add bulk signing support for PKCS#11 keys Eric Biggers
2026-10-09 16:13   ` Massimiliano Marretta
2026-10-09 16:26     ` Eric Biggers
2026-10-09 17:10       ` Massimiliano Marretta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®