All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] rsa: Return immediately if required-key verification fails
Date: Mon, 16 Sep 2019 11:43:26 -0600	[thread overview]
Message-ID: <CAPnjgZ0gEKt+FVqZ1CSq4BoZHm1v-JNLHg_o4PjOZKt=sRc1XQ@mail.gmail.com> (raw)
In-Reply-To: <20190914103626.2591-1-daniele.alessandrelli@gmail.com>

Hi Daniele,

On Sat, 14 Sep 2019 at 04:37, Daniele Alessandrelli
<daniele.alessandrelli@gmail.com> wrote:
>
> Currently, if image verification with a required key fails, rsa_verify()
> code tries to find another key to verify the FIT image. This however, is
> not the intended behavior as the documentation says that required keys
> "must be verified for the image / configuration to be considered valid".
>
> This patch fixes the issue by making rsa_verify() return immediately if
> the verification of a required key fails.
>
> Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@gmail.com>
> ---
>  lib/rsa/rsa-verify.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
> index 287fcc4d23..82dc513260 100644
> --- a/lib/rsa/rsa-verify.c
> +++ b/lib/rsa/rsa-verify.c
> @@ -437,8 +437,7 @@ int rsa_verify(struct image_sign_info *info,
>         if (info->required_keynode != -1) {
>                 ret = rsa_verify_with_keynode(info, hash, sig, sig_len,
>                         info->required_keynode);
> -               if (!ret)
> -                       return ret;
> +               return ret;
>         }
>
>         /* Look for a key that matches our hint */
> --
> 2.21.0
>

Thanks for the patch.

Unfortunately I don't think it is worth taking a patch in this area
without updating the test. Will see if someone has time to do that.

Regards,
Simon

      reply	other threads:[~2019-09-16 17:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-14 10:36 [U-Boot] [PATCH] rsa: Return immediately if required-key verification fails Daniele Alessandrelli
2019-09-16 17:43 ` Simon Glass [this message]

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='CAPnjgZ0gEKt+FVqZ1CSq4BoZHm1v-JNLHg_o4PjOZKt=sRc1XQ@mail.gmail.com' \
    --to=sjg@chromium.org \
    --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.