[PATCH 2/3] keytoc: allow __ENV__ lookup for keyname hint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux