From: Quentin Schulz <foss+uboot@0leil.net>
To: u-boot@lists.denx.de
Cc: Tom Rini <trini@konsulko.com>,
Aristo Chen <jj251510319013@gmail.com>,
Rasmus Villemoes <ravi@prevas.dk>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Simon Glass <sjg@chromium.org>,
Paul HENRYS <paul.henrys_ext@softathome.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Shiji Yang <yangshiji66@outlook.com>,
Anton Moryakov <ant.v.moryakov@gmail.com>,
Alper Nebi Yasak <alpernebiyasak@gmail.com>,
Alice Guo <alice.guo@nxp.com>, Bryan Brattlof <bb@ti.com>,
Wolfgang Wallner <wolfgang.wallner@br-automation.com>,
Peter Robinson <pbrobinson@gmail.com>,
Eddie Kovsky <ekovsky@redhat.com>,
Kever Yang <kever.yang@rock-chips.com>,
Yannic Moog <y.moog@phytec.de>,
Quentin Schulz <quentin.schulz@cherry.de>
Subject: [PATCH v3 1/4] fit: support signing with only an engine_id
Date: Fri, 21 Nov 2025 18:14:57 +0100 [thread overview]
Message-ID: <20251121-binman-engine-v3-1-b80180aaa783@cherry.de> (raw)
In-Reply-To: <20251121-binman-engine-v3-0-b80180aaa783@cherry.de>
From: Quentin Schulz <quentin.schulz@cherry.de>
Currently, when one wants to use an OpenSSL engine to sign a FIT image,
one needs to pass a keydir (via -k) to mkimage which will then be
prepended to the value of the key-name-hint before being passed as
key_id argument to the OpenSSL Engine API, or pass a keyfile (via -G) to
mkimage.
My OpenSSL engine only has "slots" which are not mapped like
directories, so using keydir is not proper, though I could simply have
-k '' I guess but this won't work currently with binman anyway.
Additionally, passing a keyfile (-G) when using an engine doesn't make
sense as the key is stored in the engine.
Let simply allow FIT images be signed if both keydir and keyfile are
missing but an engine is to be used.
The keyname member is already filled by looking at key-name-hint
property in the FIT and passed to the engine, which is exactly what is
needed here.
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
tools/fit_image.c | 3 ++-
tools/image-host.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 0306333141e..694bb927c7d 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -26,7 +26,8 @@ static struct legacy_img_hdr header;
static int fit_estimate_hash_sig_size(struct image_tool_params *params, const char *fname)
{
- bool signing = IMAGE_ENABLE_SIGN && (params->keydir || params->keyfile);
+ bool signing = IMAGE_ENABLE_SIGN &&
+ (params->keydir || params->keyfile || params->engine_id);
struct stat sbuf;
void *fdt;
int fd;
diff --git a/tools/image-host.c b/tools/image-host.c
index 21dd7f2d922..54df86316ae 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -696,7 +696,7 @@ int fit_image_add_verification_data(const char *keydir, const char *keyfile,
strlen(FIT_HASH_NODENAME))) {
ret = fit_image_process_hash(fit, image_name, noffset,
data, size);
- } else if (IMAGE_ENABLE_SIGN && (keydir || keyfile) &&
+ } else if (IMAGE_ENABLE_SIGN && (keydir || keyfile || engine_id) &&
!strncmp(node_name, FIT_SIG_NODENAME,
strlen(FIT_SIG_NODENAME))) {
ret = fit_image_process_sig(keydir, keyfile, keydest,
@@ -1366,7 +1366,7 @@ int fit_add_verification_data(const char *keydir, const char *keyfile,
}
/* If there are no keys, we can't sign configurations */
- if (!IMAGE_ENABLE_SIGN || !(keydir || keyfile))
+ if (!IMAGE_ENABLE_SIGN || !(keydir || keyfile || engine_id))
return 0;
/* Find configurations parent node offset */
--
2.51.1
next prev parent reply other threads:[~2025-11-21 17:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 17:14 [PATCH v3 0/4] fit: allow signing with an OpenSSL engine Quentin Schulz
2025-11-21 17:14 ` Quentin Schulz [this message]
2025-11-21 17:14 ` [PATCH v3 2/4] tools: binman: mkimage: add support for passing the engine Quentin Schulz
2025-11-21 17:14 ` [PATCH v3 3/4] tools: binman: fit: add support for OpenSSL engines Quentin Schulz
2025-11-25 22:15 ` Simon Glass
2025-11-26 11:28 ` Quentin Schulz
2025-11-21 17:15 ` [PATCH v3 4/4] tools: binman: fit: add tests for signing with an OpenSSL engine Quentin Schulz
2025-11-25 22:15 ` Simon Glass
2025-11-26 11:44 ` Quentin Schulz
2025-12-02 20:06 ` Simon Glass
2025-12-02 20:14 ` Tom Rini
2025-12-04 11:52 ` Quentin Schulz
2025-12-04 14:25 ` Tom Rini
2025-12-10 12:32 ` Simon Glass
2025-12-04 11:50 ` Quentin Schulz
2025-12-10 12:32 ` Simon Glass
2025-12-10 14:29 ` Tom Rini
2025-12-07 14:04 ` [PATCH v3 0/4] fit: allow " Tom Rini
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=20251121-binman-engine-v3-1-b80180aaa783@cherry.de \
--to=foss+uboot@0leil.net \
--cc=alice.guo@nxp.com \
--cc=alpernebiyasak@gmail.com \
--cc=ant.v.moryakov@gmail.com \
--cc=bb@ti.com \
--cc=ekovsky@redhat.com \
--cc=jj251510319013@gmail.com \
--cc=kever.yang@rock-chips.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=paul.henrys_ext@softathome.com \
--cc=pbrobinson@gmail.com \
--cc=quentin.schulz@cherry.de \
--cc=ravi@prevas.dk \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=wolfgang.wallner@br-automation.com \
--cc=xypron.glpk@gmx.de \
--cc=y.moog@phytec.de \
--cc=yangshiji66@outlook.com \
/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