public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] MODSIGN: Simplify Makefile with a Kconfig helper
@ 2013-01-24 21:20 Michal Marek
  2013-01-24 21:20 ` [PATCH v2 2/4] MODSIGN: Specify the hash algorithm on sign-file command line Michal Marek
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michal Marek @ 2013-01-24 21:20 UTC (permalink / raw)
  To: dhowells, rusty; +Cc: linux-kernel

Signed-off-by: Michal Marek <mmarek@suse.cz>
---
v2: Check in kernel/Makefile that CONFIG_MODULE_SIG_HASH is set

---
 init/Kconfig    |    9 +++++++++
 kernel/Makefile |   22 +++-------------------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 6fdd6e3..ba7d1c1 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1634,6 +1634,15 @@ config MODULE_SIG_SHA512
 
 endchoice
 
+config MODULE_SIG_HASH
+	string
+	depends on MODULE_SIG
+	default "sha1" if MODULE_SIG_SHA1
+	default "sha224" if MODULE_SIG_SHA224
+	default "sha256" if MODULE_SIG_SHA256
+	default "sha384" if MODULE_SIG_SHA384
+	default "sha512" if MODULE_SIG_SHA512
+
 endif # MODULES
 
 config INIT_ALL_POSSIBLE
diff --git a/kernel/Makefile b/kernel/Makefile
index 86e3285..fe5dfb0 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -148,23 +148,7 @@ kernel/modsign_pubkey.o: signing_key.x509 extra_certificates
 # fail and that the kernel may be used afterwards.
 #
 ###############################################################################
-sign_key_with_hash :=
-ifeq ($(CONFIG_MODULE_SIG_SHA1),y)
-sign_key_with_hash := -sha1
-endif
-ifeq ($(CONFIG_MODULE_SIG_SHA224),y)
-sign_key_with_hash := -sha224
-endif
-ifeq ($(CONFIG_MODULE_SIG_SHA256),y)
-sign_key_with_hash := -sha256
-endif
-ifeq ($(CONFIG_MODULE_SIG_SHA384),y)
-sign_key_with_hash := -sha384
-endif
-ifeq ($(CONFIG_MODULE_SIG_SHA512),y)
-sign_key_with_hash := -sha512
-endif
-ifeq ($(sign_key_with_hash),)
+ifndef CONFIG_MODULE_SIG_HASH
 $(error Could not determine digest type to use from kernel config)
 endif
 
@@ -177,8 +161,8 @@ signing_key.priv signing_key.x509: x509.genkey
 	@echo "### needs to be run as root, and uses a hardware random"
 	@echo "### number generator if one is available."
 	@echo "###"
-	openssl req -new -nodes -utf8 $(sign_key_with_hash) -days 36500 -batch \
-		-x509 -config x509.genkey \
+	openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
+		-batch -x509 -config x509.genkey \
 		-outform DER -out signing_key.x509 \
 		-keyout signing_key.priv
 	@echo "###"
-- 
1.7.8.3


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

end of thread, other threads:[~2013-01-25 21:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-24 21:20 [PATCH v2 1/4] MODSIGN: Simplify Makefile with a Kconfig helper Michal Marek
2013-01-24 21:20 ` [PATCH v2 2/4] MODSIGN: Specify the hash algorithm on sign-file command line Michal Marek
2013-01-24 21:20 ` [PATCH v2 3/4] MODSIGN: Add -s <signature> option to sign-file Michal Marek
2013-01-25  0:10   ` David Howells
2013-01-25  3:12     ` Rusty Russell
2013-01-25 21:30     ` Michal Marek
2013-01-24 21:20 ` [PATCH v2 4/4] MODSIGN: Add option to not sign modules during modules_install Michal Marek

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