public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alex G. <mr.nuke.me@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH] lib: rsa: rsa-verify: don't look for keys in the FIT image
Date: Tue, 12 Jan 2021 12:30:44 -0600	[thread overview]
Message-ID: <ed9af52a-ca1c-da2c-3ca1-2845ed6dc98b@gmail.com> (raw)
In-Reply-To: <20210112181854.15056-1-philippe.reynes@softathome.com>

On 1/12/21 12:18 PM, Philippe Reynes wrote:

Hi Philippe,

> In the function rsa_verify_hash, if the "main" key doesn't
> work, u-boot try others keys. But it searches those keys
> in the FIT image instead of the u-boot device tree.
> 
> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
> ---
>   lib/rsa/rsa-verify.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
> index 0ab0f629d0..e34d3293d1 100644
> --- a/lib/rsa/rsa-verify.c
> +++ b/lib/rsa/rsa-verify.c
> @@ -522,10 +522,10 @@ int rsa_verify_hash(struct image_sign_info *info,
>   			return ret;
>   
>   		/* No luck, so try each of the keys in turn */
> -		for (ndepth = 0, noffset = fdt_next_node(info->fit, sig_node,
> +		for (ndepth = 0, noffset = fdt_next_node(blob, sig_node,
>   							 &ndepth);
>   		     (noffset >= 0) && (ndepth > 0);
> -		     noffset = fdt_next_node(info->fit, noffset, &ndepth)) {
> +		     noffset = fdt_next_node(blob, noffset, &ndepth)) {
>   			if (ndepth == 1 && noffset != node) {
>   				ret = rsa_verify_with_keynode(info, hash,
>   							      sig, sig_len,

I was looking at this code ot too long ago and didn't notice the 
inconsistency. I think it would be better to use 'info->fdt_blob' and 
get rid of 'blob' completely.

Alex

  reply	other threads:[~2021-01-12 18:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 18:18 [PATCH] lib: rsa: rsa-verify: don't look for keys in the FIT image Philippe Reynes
2021-01-12 18:30 ` Alex G. [this message]
2021-01-13 10:35   ` Philippe REYNES
2021-01-24  2:03 ` Simon Glass
2021-01-28 23:57 ` 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=ed9af52a-ca1c-da2c-3ca1-2845ed6dc98b@gmail.com \
    --to=mr.nuke.me@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox