[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230517-genkey-v1-1-b887424da4a8@google.com>
Date: Wed, 17 May 2023 09:23:16 -0700
From: ndesaulniers@...gle.com
To: David Howells <dhowells@...hat.com>,
David Woodhouse <dwmw2@...radead.org>
Cc: Ard Biesheuvel <ardb@...nel.org>, keyrings@...r.kernel.org,
linux-kernel@...r.kernel.org,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: [PATCH] certs: buffer stderr from openssl unless error
Running `openssl req` prints a progress meter consisting of `.`, `*`,
and `+` characters to stderr which we redirect to stdout. During a build
with `make -j`, the output from this command becomes interspersed
throughout the rest of the quiet_cmd_* output, messing up the
indentation.
Suppress the output from this command unless the return code is
non-zero. If `openssl req` prints additional information to stderr
without setting a non-zero return code, it will be missed.
Suggested-by: Ard Biesheuvel <ardb@...nel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
---
certs/Makefile | 4 +---
certs/gen_key.sh | 7 +++++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/certs/Makefile b/certs/Makefile
index 799ad7b9e68a..9b4fee56780d 100644
--- a/certs/Makefile
+++ b/certs/Makefile
@@ -45,9 +45,7 @@ ifeq ($(CONFIG_MODULE_SIG_KEY),certs/signing_key.pem)
keytype-$(CONFIG_MODULE_SIG_KEY_TYPE_ECDSA) := -newkey ec -pkeyopt ec_paramgen_curve:secp384r1
quiet_cmd_gen_key = GENKEY $@
- cmd_gen_key = openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
- -batch -x509 -config $< \
- -outform PEM -out $@ -keyout $@ $(keytype-y) 2>&1
+ cmd_gen_key = $(srctree)/$(src)/gen_key.sh $(CONFIG_MODULE_SIG_HASH) $< $@ $(keytype-y)
$(obj)/signing_key.pem: $(obj)/x509.genkey FORCE
$(call if_changed,gen_key)
diff --git a/certs/gen_key.sh b/certs/gen_key.sh
new file mode 100755
index 000000000000..1de1f22be484
--- /dev/null
+++ b/certs/gen_key.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0
+OUT=$(openssl req -new -nodes -utf8 -"$1" -days 36500 -batch -x509 \
+ -config "$2" -outform PEM -out "$3" -keyout "$3" $4 2>&1)
+if [[ $? -ne 0 ]]; then
+ echo "$OUT"
+fi
---
base-commit: f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6
change-id: 20230517-genkey-24a835572835
Best regards,
--
Nick Desaulniers <ndesaulniers@...gle.com>
Powered by blists - more mailing lists