[PATCH v4 11/14] boot: pre-load: add support of ecdsa

Simon Glass sjg at chromium.org
Mon Apr 20 04:12:36 CEST 2026


Hi Philippe,

On 2026-04-17T13:02:04, Philippe Reynes <philippe.reynes at softathome.com> wrote:
> boot: pre-load: add support of ecdsa
>
> Right now, u-boot can only boot image with a
> pre-load header with rsa. We add the support
> of ecdsa.
>
> Signed-off-by: Philippe Reynes <philippe.reynes at softathome.com>
>
> boot/image-pre-load.c | 56 +++++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 45 insertions(+), 11 deletions(-)

> diff --git a/boot/image-pre-load.c b/boot/image-pre-load.c
> @@ -70,6 +70,17 @@ static int image_pre_load_sig_setup(struct image_sig_info *info)
> +static int is_ecdsa(struct crypto_algo *crypto)
> +{
> +     int ret = 0;
> +
> +     if (crypto && !strncmp(crypto->name, "ecdsa", strlen("ecdsa")))
> +             ret = 1;
> +
> +     return ret;
> +}

This could be simplified to:

    static bool is_ecdsa(struct crypto_algo *crypto)
    {
        return crypto && !strncmp(crypto->name, "ecdsa", 5);
    }

> diff --git a/boot/image-pre-load.c b/boot/image-pre-load.c
> @@ -155,6 +185,10 @@ static int image_pre_load_sig_setup(struct image_sig_info *info)
> +     info->sig_info.crypto   = image_get_crypto_algo(info->sig_info.name);
> +     info->sig_info.key      = info->key;
> +     info->sig_info.keylen   = info->key_len;
> +     if (is_ecdsa(crypto)) {

You already have the crypto pointer from the earlier
image_get_crypto_algo() call. Please can you reuse it here instead of
calling image_get_crypto_algo() again:

    info->sig_info.crypto = crypto;

Reviewed-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list