diff options
-rw-r--r-- | init/Kconfig | 9 | ||||
-rw-r--r-- | kernel/Makefile | 22 |
2 files changed, 12 insertions, 19 deletions
diff --git a/init/Kconfig b/init/Kconfig index be8b7f55312d..fff4cb1321c5 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1697,6 +1697,15 @@ config MODULE_SIG_SHA512 | |||
1697 | 1697 | ||
1698 | endchoice | 1698 | endchoice |
1699 | 1699 | ||
1700 | config MODULE_SIG_HASH | ||
1701 | string | ||
1702 | depends on MODULE_SIG | ||
1703 | default "sha1" if MODULE_SIG_SHA1 | ||
1704 | default "sha224" if MODULE_SIG_SHA224 | ||
1705 | default "sha256" if MODULE_SIG_SHA256 | ||
1706 | default "sha384" if MODULE_SIG_SHA384 | ||
1707 | default "sha512" if MODULE_SIG_SHA512 | ||
1708 | |||
1700 | endif # MODULES | 1709 | endif # MODULES |
1701 | 1710 | ||
1702 | config INIT_ALL_POSSIBLE | 1711 | config INIT_ALL_POSSIBLE |
diff --git a/kernel/Makefile b/kernel/Makefile index 6c072b6da239..eceac38f3c65 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -153,23 +153,7 @@ kernel/modsign_certificate.o: signing_key.x509 extra_certificates | |||
153 | # fail and that the kernel may be used afterwards. | 153 | # fail and that the kernel may be used afterwards. |
154 | # | 154 | # |
155 | ############################################################################### | 155 | ############################################################################### |
156 | sign_key_with_hash := | 156 | ifndef CONFIG_MODULE_SIG_HASH |
157 | ifeq ($(CONFIG_MODULE_SIG_SHA1),y) | ||
158 | sign_key_with_hash := -sha1 | ||
159 | endif | ||
160 | ifeq ($(CONFIG_MODULE_SIG_SHA224),y) | ||
161 | sign_key_with_hash := -sha224 | ||
162 | endif | ||
163 | ifeq ($(CONFIG_MODULE_SIG_SHA256),y) | ||
164 | sign_key_with_hash := -sha256 | ||
165 | endif | ||
166 | ifeq ($(CONFIG_MODULE_SIG_SHA384),y) | ||
167 | sign_key_with_hash := -sha384 | ||
168 | endif | ||
169 | ifeq ($(CONFIG_MODULE_SIG_SHA512),y) | ||
170 | sign_key_with_hash := -sha512 | ||
171 | endif | ||
172 | ifeq ($(sign_key_with_hash),) | ||
173 | $(error Could not determine digest type to use from kernel config) | 157 | $(error Could not determine digest type to use from kernel config) |
174 | endif | 158 | endif |
175 | 159 | ||
@@ -182,8 +166,8 @@ signing_key.priv signing_key.x509: x509.genkey | |||
182 | @echo "### needs to be run as root, and uses a hardware random" | 166 | @echo "### needs to be run as root, and uses a hardware random" |
183 | @echo "### number generator if one is available." | 167 | @echo "### number generator if one is available." |
184 | @echo "###" | 168 | @echo "###" |
185 | openssl req -new -nodes -utf8 $(sign_key_with_hash) -days 36500 -batch \ | 169 | openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \ |
186 | -x509 -config x509.genkey \ | 170 | -batch -x509 -config x509.genkey \ |
187 | -outform DER -out signing_key.x509 \ | 171 | -outform DER -out signing_key.x509 \ |
188 | -keyout signing_key.priv | 172 | -keyout signing_key.priv |
189 | @echo "###" | 173 | @echo "###" |