mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v3 2/3] keytoc: add support to handle single env keyspec
Date: Mon, 18 Aug 2025 19:08:14 +0200	[thread overview]
Message-ID: <20250818170815.2478554-2-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20250818170815.2478554-1-m.felsch@pengutronix.de>

Since commit 685cc602e0ad ("keytoc: allow __ENV__ lookup for keyname
hint") the hint and key can be specified via two environment variables.

Using two environment variables for a single keyspec is not very
intuitive. Therefore this commit adds the support to specify the keyspec
via a single environment variable:

For example:

   FITKEY = "<hint>:<key>"
   CONFIG_CRYPTO_PUBLIC_KEYS="__ENV__FITKEY"

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
Changelog:
v3:
- keep Basti's use-case to provide the keyhint+key via two env-variables
v2:
- no changes

 scripts/keytoc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/keytoc.c b/scripts/keytoc.c
index 617317d6607e..67e2db3386db 100644
--- a/scripts/keytoc.c
+++ b/scripts/keytoc.c
@@ -737,6 +737,10 @@ int main(int argc, char *argv[])
 		char *keyname = NULL;
 		char *path = NULL;
 
+		keyspec = try_resolve_env(keyspec);
+		if (!keyspec)
+			exit(1);
+
 		if (!strncmp(keyspec, "pkcs11:", 7))
 			path = strdup(keyspec);
 		else
-- 
2.39.5




  reply	other threads:[~2025-08-18 17:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18 17:08 [PATCH v3 1/3] keytoc: mark keyspec user input as readonly Marco Felsch
2025-08-18 17:08 ` Marco Felsch [this message]
2025-08-18 17:08 ` [PATCH v3 3/3] crypto: add examples to CRYPTO_PUBLIC_KEYS Marco Felsch
2025-08-19  6:04 ` [PATCH v3 1/3] keytoc: mark keyspec user input as readonly Sascha Hauer

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=20250818170815.2478554-2-m.felsch@pengutronix.de \
    --to=m.felsch@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