Commit 5d06ee20 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David Howells

modsign: hide openssl output in silent builds

When a user calls 'make -s', we can assume they don't want to
see any output except for warnings and errors, but instead
they see this for a warning free build:

 ###
 ### Now generating an X.509 key pair to be used for signing modules.
 ###
 ### If this takes a long time, you might wish to run rngd in the
 ### background to keep the supply of entropy topped up.  It
 ### needs to be run as root, and uses a hardware random
 ### number generator if one is available.
 ###
 Generating a 4096 bit RSA private key
 .................................................................................................................................................................................................................................++
 ..............................................................................................................................++
 writing new private key to 'certs/signing_key.pem'
 -----
 ###
 ### Key pair generated.
 ###

The output can confuse simple build testing scripts that just check
for an empty build log.

This patch silences all the output:
 - "echo" is changed to "@$(kecho)", which is dropped when "-s" gets
   passed
 - the openssl command itself is only printed with V=1, using the
   $(Q) macro
 - The output of openssl gets redirected to /dev/null on "-s" builds.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent e5a2e3c8
...@@ -36,29 +36,34 @@ ifndef CONFIG_MODULE_SIG_HASH ...@@ -36,29 +36,34 @@ ifndef CONFIG_MODULE_SIG_HASH
$(error Could not determine digest type to use from kernel config) $(error Could not determine digest type to use from kernel config)
endif endif
redirect_openssl = 2>&1
quiet_redirect_openssl = 2>&1
silent_redirect_openssl = 2>/dev/null
# We do it this way rather than having a boolean option for enabling an # We do it this way rather than having a boolean option for enabling an
# external private key, because 'make randconfig' might enable such a # external private key, because 'make randconfig' might enable such a
# boolean option and we unfortunately can't make it depend on !RANDCONFIG. # boolean option and we unfortunately can't make it depend on !RANDCONFIG.
ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem") ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem")
$(obj)/signing_key.pem: $(obj)/x509.genkey $(obj)/signing_key.pem: $(obj)/x509.genkey
@echo "###" @$(kecho) "###"
@echo "### Now generating an X.509 key pair to be used for signing modules." @$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
@echo "###" @$(kecho) "###"
@echo "### If this takes a long time, you might wish to run rngd in the" @$(kecho) "### If this takes a long time, you might wish to run rngd in the"
@echo "### background to keep the supply of entropy topped up. It" @$(kecho) "### background to keep the supply of entropy topped up. It"
@echo "### needs to be run as root, and uses a hardware random" @$(kecho) "### needs to be run as root, and uses a hardware random"
@echo "### number generator if one is available." @$(kecho) "### number generator if one is available."
@echo "###" @$(kecho) "###"
openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \ $(Q)openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
-batch -x509 -config $(obj)/x509.genkey \ -batch -x509 -config $(obj)/x509.genkey \
-outform PEM -out $(obj)/signing_key.pem \ -outform PEM -out $(obj)/signing_key.pem \
-keyout $(obj)/signing_key.pem 2>&1 -keyout $(obj)/signing_key.pem \
@echo "###" $($(quiet)redirect_openssl)
@echo "### Key pair generated." @$(kecho) "###"
@echo "###" @$(kecho) "### Key pair generated."
@$(kecho) "###"
$(obj)/x509.genkey: $(obj)/x509.genkey:
@echo Generating X.509 key generation config @$(kecho) Generating X.509 key generation config
@echo >$@ "[ req ]" @echo >$@ "[ req ]"
@echo >>$@ "default_bits = 4096" @echo >>$@ "default_bits = 4096"
@echo >>$@ "distinguished_name = req_distinguished_name" @echo >>$@ "distinguished_name = req_distinguished_name"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment