From: Bastian Krause <bst@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Bastian Krause <bst@pengutronix.de>
Subject: [PATCH 2/3] keytoc: allow __ENV__ lookup for keyname hint
Date: Mon, 6 Jan 2025 16:36:32 +0100 [thread overview]
Message-ID: <20250106153633.1470205-2-bst@pengutronix.de> (raw)
In-Reply-To: <20250106153633.1470205-1-bst@pengutronix.de>
CONFIG_CRYPTO_PUBLIC_KEYS already supports __ENV__VARNAME making barebox
look up the value in the environment variable VARNAME instead. But this
only works for the public key (path or PKCS#11 URI), not for the
corresponding (optional) key name hint.
Change that by using the same logic as for the public key for the key
name hint.
For example, ..
CONFIG_CRYPTO_PUBLIC_KEYS="__ENV__FIT_KEY_NAME_HINT:__ENV__FIT_KEY"
..would look up the environment variables KEY_NAME_HINT and FIT_KEY.
Multiple keys can still be passed by space separating multiple key name
hint and public key combinations.
Signed-off-by: Bastian Krause <bst@pengutronix.de>
---
scripts/keytoc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/keytoc.c b/scripts/keytoc.c
index 9b3522a602f..cf9c2f52482 100644
--- a/scripts/keytoc.c
+++ b/scripts/keytoc.c
@@ -598,6 +598,10 @@ static int gen_key(const char *keyname, const char *path)
char *tmp, *key_name_c;
/* key name handling */
+ keyname = try_resolve_env(keyname);
+ if (!keyname)
+ exit(1);
+
tmp = key_name_c = strdup(keyname);
while (*tmp) {
--
2.39.5
next prev parent reply other threads:[~2025-01-06 15:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 15:36 [PATCH 1/3] keytoc: move __ENV__ resolving to dedicated function Bastian Krause
2025-01-06 15:36 ` Bastian Krause [this message]
2025-01-06 15:36 ` [PATCH 3/3] crypto: document __ENV__ lookup in CRYPTO_PUBLIC_KEYS Bastian Krause
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250106153633.1470205-2-bst@pengutronix.de \
--to=bst@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox