public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] certs: buffer stderr from openssl unless error
@ 2023-05-17 16:23 ndesaulniers
  2023-05-18 10:22 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: ndesaulniers @ 2023-05-17 16:23 UTC (permalink / raw)
  To: David Howells, David Woodhouse
  Cc: Ard Biesheuvel, keyrings, linux-kernel, Nick Desaulniers

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@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.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@google.com>


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

end of thread, other threads:[~2023-06-08  9:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-17 16:23 [PATCH] certs: buffer stderr from openssl unless error ndesaulniers
2023-05-18 10:22 ` kernel test robot
2023-05-18 22:36   ` Nick Desaulniers
2023-05-22  6:53     ` Philip Li
2023-05-22  8:47     ` Guo Ren
2023-06-08  9:58     ` Liu, Yujie
2023-05-18 18:32 ` Jarkko Sakkinen
2023-05-22 15:35 ` kernel test robot

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