From: Philippe Reynes <philippe.reynes@softathome.com>
To: marko.makela@iki.fi, jonny.green@keytechinc.com,
raymondmaoca@gmail.com, trini@konsulko.com,
simon.glass@canonical.com
Cc: u-boot@lists.u-boot-project.org,
Philippe Reynes <philippe.reynes@softathome.com>,
Simon Glass <sjg@chromium.org>
Subject: [PATCH v9 12/15] boot: pre-load: add support of ecdsa
Date: Thu, 3 Sep 2026 10:17:02 +0200 [thread overview]
Message-ID: <20260903081705.12894-13-philippe.reynes@softathome.com> (raw)
In-Reply-To: <20260903081705.12894-1-philippe.reynes@softathome.com>
Right now, u-boot can only boot image with a
pre-load header with rsa. We add the support
of ecdsa.
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Raymond Mao <raymondmaoca@gmail.com>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
---
v3:
- initial version
v4:
- avoid calling image_get_crypto_algo several times
v5:
- simplify the function is_ecdsa
- re-use already computed crypto in function image_pre_load_sig_setup
v6:
- no change
v7:
- no change
v8:
- no change
v9:
- no change
boot/image-pre-load.c | 53 +++++++++++++++++++++++++++++++++----------
1 file changed, 41 insertions(+), 12 deletions(-)
diff --git a/boot/image-pre-load.c b/boot/image-pre-load.c
index 2f851ebb28c..af72ea6d547 100644
--- a/boot/image-pre-load.c
+++ b/boot/image-pre-load.c
@@ -70,6 +70,12 @@ static int image_pre_load_sig_setup(struct image_sig_info *info)
return 0;
}
#else
+
+static int is_ecdsa(struct crypto_algo *crypto)
+{
+ return crypto && !strncmp(crypto->name, "ecdsa", 5);
+}
+
/*
* This function gathers information about the signature check
* that could be done before launching the image.
@@ -86,6 +92,7 @@ static int image_pre_load_sig_setup(struct image_sig_info *info)
int key_len;
int node, ret = 0;
char *sig_info_path = NULL;
+ struct crypto_algo *crypto;
if (!info) {
log_err("ERROR: info is NULL for image pre-load sig check\n");
@@ -114,11 +121,24 @@ static int image_pre_load_sig_setup(struct image_sig_info *info)
goto out;
}
- padding_name = fdt_getprop(gd_fdt_blob(), node,
- IMAGE_PRE_LOAD_PROP_PADDING_NAME, NULL);
- if (!padding_name) {
- log_info("INFO: no padding_name provided, so using pkcs-1.5\n");
- padding_name = "pkcs-1.5";
+ crypto = image_get_crypto_algo(algo_name);
+ if (!crypto) {
+ printf("ERROR: can't find a valid crypto algo from %s\n",
+ (char *)algo_name);
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if (is_ecdsa(crypto)) {
+ padding_name = NULL;
+ } else {
+ padding_name = fdt_getprop(gd_fdt_blob(), node,
+ IMAGE_PRE_LOAD_PROP_PADDING_NAME,
+ NULL);
+ if (!padding_name) {
+ log_info("INFO: no padding_name provided, so using pkcs-1.5\n");
+ padding_name = "pkcs-1.5";
+ }
}
sig_size = fdt_getprop(gd_fdt_blob(), node,
@@ -129,12 +149,17 @@ static int image_pre_load_sig_setup(struct image_sig_info *info)
goto out;
}
- key = fdt_getprop(gd_fdt_blob(), node,
- IMAGE_PRE_LOAD_PROP_PUBLIC_KEY, &key_len);
- if (!key) {
- log_err("ERROR: no key for image pre-load sig check\n");
- ret = -EINVAL;
- goto out;
+ if (is_ecdsa(crypto)) {
+ key = NULL;
+ key_len = 0;
+ } else {
+ key = fdt_getprop(gd_fdt_blob(), node,
+ IMAGE_PRE_LOAD_PROP_PUBLIC_KEY, &key_len);
+ if (!key) {
+ log_err("ERROR: no key for image pre-load sig check\n");
+ ret = -EINVAL;
+ goto out;
+ }
}
info->algo_name = (char *)algo_name;
@@ -152,9 +177,13 @@ static int image_pre_load_sig_setup(struct image_sig_info *info)
info->sig_info.name = info->algo_name;
info->sig_info.padding = image_get_padding_algo(info->padding_name);
info->sig_info.checksum = image_get_checksum_algo(info->sig_info.name);
- info->sig_info.crypto = image_get_crypto_algo(info->sig_info.name);
+ info->sig_info.crypto = crypto;
info->sig_info.key = info->key;
info->sig_info.keylen = info->key_len;
+ if (is_ecdsa(crypto)) {
+ info->sig_info.required_keynode = node;
+ info->sig_info.fdt_blob = gd_fdt_blob();
+ }
out:
return ret;
--
2.43.0
next prev parent reply other threads:[~2026-09-03 8:17 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 8:16 [PATCH v9 00/15] add software ecdsa support Philippe Reynes
2026-09-03 8:16 ` [PATCH v9 01/15] ecdsa: fix support of secp521r1 Philippe Reynes
2026-09-03 14:30 ` Raymond Mao
2026-09-03 8:16 ` [PATCH v9 02/15] mbedtls: enable support of ecc Philippe Reynes
2026-09-03 14:31 ` Raymond Mao
2026-09-03 8:16 ` [PATCH v9 03/15] ecdsa: initial support of ecdsa using mbedtls Philippe Reynes
2026-09-03 14:31 ` Raymond Mao
2026-09-03 8:16 ` [PATCH v9 04/15] test: lib: ecdsa: add initial test Philippe Reynes
2026-09-03 14:32 ` Raymond Mao
2026-09-03 8:16 ` [PATCH v9 05/15] drivers: crypto: add software ecdsa support Philippe Reynes
2026-09-03 14:32 ` Raymond Mao
2026-09-03 15:33 ` Raymond Mao
2026-09-03 18:33 ` Tom Rini
2026-09-03 8:16 ` [PATCH v9 06/15] test: dm: ecdsa.c: clean this test as software ecdsa is now implemented Philippe Reynes
2026-09-03 14:33 ` Raymond Mao
2026-09-03 8:16 ` [PATCH v9 07/15] test: py: vboot: prepare integration test for ecdsa Philippe Reynes
2026-09-03 15:42 ` Raymond Mao
2026-09-03 8:16 ` [PATCH v9 08/15] test: vboot: add " Philippe Reynes
2026-09-03 15:43 ` Raymond Mao
2026-09-03 8:16 ` [PATCH v9 09/15] tools: fit_image_setup_sig: set required_keynode to -1 Philippe Reynes
2026-09-03 14:34 ` Raymond Mao
2026-09-03 8:17 ` [PATCH v9 10/15] tools: mkimage: pre-load: add support of ecdsa Philippe Reynes
2026-09-03 14:36 ` Raymond Mao
2026-09-03 8:17 ` [PATCH v9 11/15] tools: binman: " Philippe Reynes
2026-09-03 14:37 ` Raymond Mao
2026-09-03 8:17 ` Philippe Reynes [this message]
2026-09-03 14:38 ` [PATCH v9 12/15] boot: " Raymond Mao
2026-09-03 8:17 ` [PATCH v9 13/15] tools: preload_check_sign: " Philippe Reynes
2026-09-03 14:39 ` Raymond Mao
2026-09-03 8:17 ` [PATCH v9 14/15] test: py: vboot: prepare test for global signature with ecdsa Philippe Reynes
2026-09-03 14:40 ` Raymond Mao
2026-09-03 8:17 ` [PATCH v9 15/15] test: py: vboot: add " Philippe Reynes
2026-09-03 14:41 ` Raymond Mao
2026-09-03 18:35 ` [PATCH v9 00/15] add software ecdsa support Tom Rini
2026-09-04 8:10 ` Philippe Reynes
2026-09-04 14:32 ` 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=20260903081705.12894-13-philippe.reynes@softathome.com \
--to=philippe.reynes@softathome.com \
--cc=jonny.green@keytechinc.com \
--cc=marko.makela@iki.fi \
--cc=raymondmaoca@gmail.com \
--cc=simon.glass@canonical.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.