All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH] lib: rsa: Add debug message on algo mismatch
Date: Tue, 16 Feb 2021 18:01:09 +0100	[thread overview]
Message-ID: <314732.1613494869@gemini.denx.de> (raw)
In-Reply-To: <20210216164016.635125-1-sean.anderson@seco.com>

Dear Sean Anderson,

In message <20210216164016.635125-1-sean.anderson@seco.com> you wrote:
> Currently we fail silently if there is an algorithm mismatch. To help
> distinguish this failure condition.
>
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
>
>  lib/rsa/rsa-verify.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
> index e34d3293d1..aee76f42d5 100644
> --- a/lib/rsa/rsa-verify.c
> +++ b/lib/rsa/rsa-verify.c
> @@ -447,8 +447,11 @@ static int rsa_verify_with_keynode(struct image_sign_info *info,
>  	}
>  
>  	algo = fdt_getprop(blob, node, "algo", NULL);
> -	if (strcmp(info->name, algo))
> +	if (strcmp(info->name, algo)) {
> +		debug("%s: Wrong algo: have %s, expected %s", __func__,
> +		      info->name, algo);
>  		return -EFAULT;
> +	}

If this is considered an error, should that not be a printf() then
instead of a debug() which users will never see?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is impractical for  the  standard  to  attempt  to  constrain  the
behavior  of code that does not obey the constraints of the standard.
                                                          - Doug Gwyn

  reply	other threads:[~2021-02-16 17:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 16:40 [PATCH] lib: rsa: Add debug message on algo mismatch Sean Anderson
2021-02-16 17:01 ` Wolfgang Denk [this message]
2021-02-16 17:05   ` Sean Anderson
2021-02-17  2:45     ` Simon Glass
2021-02-25 13:29 ` 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=314732.1613494869@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.