Version 4 (and that's the last one, I promise), makes this work with
pkcs11 uri's as well. Tested with my Nitrokey, it is (unsurprisingly) incredibly slow but it works.
From 70415544a4aea458039f1abbbf9c7e112de846f3 Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <
andrewammerlaan@gentoo.org>
Date: Thu, 15 Jun 2023 21:10:02 +0200
Subject: [PATCH] kernel-build.eclass: add IUSE="modules-sign"
- Enable module signing configure options if requested by the user.
- Define the user variables MODULES_SIGN_HASH and MODULES_SIGN_KEY.
For controlling the used hashing algorithm and allowing the use of
external keys. These variables are the same as in linux-mod-r1.eclass
- Warn the user if we are letting the kernel build system generate the
signing
key. This key will end up binary packages. Plus external modules will
have to
be resigned if gentoo-kernel is re-emerged (i.e. a new key was generated).
Bug:
https://bugs.gentoo.org/814344
Bug:
https://bugs.gentoo.org/881651
Signed-off-by: Andrew Ammerlaan <
andrewammerlaan@gentoo.org>
---
eclass/kernel-build.eclass | 90 +++++++++++++++++++++++++++++++++++++-
1 file changed, 89 insertions(+), 1 deletion(-)
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index abfb01720817a..7d4e2133a04d2 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -43,6 +43,48 @@ BDEPEND="
IUSE="+strip"
+# @ECLASS_VARIABLE: KERNEL_IUSE_MODULES_SIGN
+# @PRE_INHERIT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, adds IUSE=modules-sign and required
+# logic to manipulate the kernel config while respecting the
+# MODULES_SIGN_HASH and MODULES_SIGN_KEY user variables.
+
+# @ECLASS_VARIABLE: MODULES_SIGN_HASH
+# @USER_VARIABLE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Used with USE=modules-sign. Can be set to hash algorithm to use
+# during signature generation (CONFIG_MODULE_SIG_SHA256).
+#
+# Valid values: sha512,sha384,sha256,sha224,sha1
+#
+# Default if unset: sha512
+
+# @ECLASS_VARIABLE: MODULES_SIGN_KEY
+# @USER_VA