public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Alex Graf <agraf@csgraf.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Sughosh Ganu <sughosh.ganu@linaro.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v4 03/11] efi_loader: capsule: add back efi_get_public_key_data()
Date: Mon, 25 Oct 2021 14:14:34 +0900	[thread overview]
Message-ID: <20211025051434.GC44989@laputa> (raw)
In-Reply-To: <CAPnjgZ0ntX5wj=xsOgTwDudokD0BENmriSNL+xTZSHwjMazW=g@mail.gmail.com>

On Wed, Oct 20, 2021 at 07:39:37AM -0600, Simon Glass wrote:
> Hi Masami,
> 
> On Wed, 20 Oct 2021 at 02:18, Masami Hiramatsu
> <masami.hiramatsu@linaro.org> wrote:
> >
> > Hi Simon,
> >
> > 2021年10月15日(金) 9:40 Simon Glass <sjg@chromium.org>:
> > >
> > > Hi Takahiro,
> > >
> > > On Thu, 7 Oct 2021 at 00:25, AKASHI Takahiro <takahiro.akashi@linaro.org> wrote:
> > > >
> > > > The commit 47a25e81d35c ("Revert "efi_capsule: Move signature from DTB to
> > > > .rodata"") failed to revert the removal of efi_get_public_key_data().
> > > >
> > > > Add back this function and move it under lib/efi_loader so that other
> > > > platforms can utilize it. It is now declared as a weak function so that
> > > > it can be replaced with a platform-specific implementation.
> > > >
> > > > Fixes: 47a25e81d35c ("Revert "efi_capsule: Move signature from DTB to
> > > >         .rodata"")
> > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > > > ---
> > > >  lib/efi_loader/efi_capsule.c | 36 ++++++++++++++++++++++++++++++++++++
> > > >  1 file changed, 36 insertions(+)
> > > >
> > > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> > > > index b75e4bcba1a9..44f5da61a9be 100644
> > > > --- a/lib/efi_loader/efi_capsule.c
> > > > +++ b/lib/efi_loader/efi_capsule.c
> > > > @@ -11,15 +11,20 @@
> > > >  #include <common.h>
> > > >  #include <efi_loader.h>
> > > >  #include <efi_variable.h>
> > > > +#include <env.h>
> > > > +#include <fdtdec.h>
> > > >  #include <fs.h>
> > > >  #include <malloc.h>
> > > >  #include <mapmem.h>
> > > >  #include <sort.h>
> > > > +#include <asm/global_data.h>
> > > >
> > > >  #include <crypto/pkcs7.h>
> > > >  #include <crypto/pkcs7_parser.h>
> > > >  #include <linux/err.h>
> > > >
> > > > +DECLARE_GLOBAL_DATA_PTR;
> > > > +
> > > >  const efi_guid_t efi_guid_capsule_report = EFI_CAPSULE_REPORT_GUID;
> > > >  static const efi_guid_t efi_guid_firmware_management_capsule_id =
> > > >                 EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID;
> > > > @@ -251,6 +256,37 @@ out:
> > > >  }
> > > >
> > > >  #if defined(CONFIG_EFI_CAPSULE_AUTHENTICATE)
> > > > +int __weak efi_get_public_key_data(void **pkey, efi_uintn_t *pkey_len)
> > >
> > > I don't think this should be weak. What other way is there of handling
> > > this and why would it be platform-specific?
> >
> > I have a question about the current design of the capsule auth key.
> > If the platform has its own key-storage, how can the platform use the
> > platform specific storage? Does such platform load the key from the storage
> > and generate the dtb node in the platform initialization code? (or
> > device driver?)
> 
> Are we talking about a public key (which I assume from the function
> naming) or some secret key. What is an auth key?

Surely, a public key (more strictly, x509 certificate under the current
implementation)

> As I understand it, the public key should be provided by the platform
> in devicetree that U-Boot uses, by whatever prior stage has access to
> the key.

I still believe that some platform provider may want to save the key
in a *safer* storage, which should be at least read-only for non-authorized
writers. But if this issue (__weak or not) is the only blocking factor
for my entire patch series, I'm willing to drop __weak for now since
someone with production system may change it in the future when he has
a good reason for that :)

-Takahiro Akashi


> Regards,
> Simon

  reply	other threads:[~2021-10-25  5:14 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07  6:23 [PATCH v4 00/11] efi_loader: capsule: improve capsule authentication support AKASHI Takahiro
2021-10-07  6:23 ` [PATCH v4 01/11] Revert "Revert "mkeficapsule: Remove dtb related options"" AKASHI Takahiro
2021-10-08 15:38   ` Simon Glass
2021-10-08 19:11     ` Ilias Apalodimas
2021-10-11  0:29       ` AKASHI Takahiro
2021-10-11 14:54         ` Simon Glass
2021-10-12  1:15           ` AKASHI Takahiro
2021-10-07  6:23 ` [PATCH v4 02/11] Revert "Revert "doc: Update CapsuleUpdate READMEs"" AKASHI Takahiro
2021-10-07  6:23 ` [PATCH v4 03/11] efi_loader: capsule: add back efi_get_public_key_data() AKASHI Takahiro
2021-10-08 19:25   ` Ilias Apalodimas
2021-10-15  0:40   ` Simon Glass
2021-10-20  8:18     ` Masami Hiramatsu
2021-10-20  9:08       ` François Ozog
2021-10-20 13:39       ` Simon Glass
2021-10-25  5:14         ` AKASHI Takahiro [this message]
2021-10-25  6:28           ` François Ozog
2021-10-25  7:04             ` Masami Hiramatsu
2021-10-25  7:14               ` François Ozog
2021-10-25 15:18                 ` Simon Glass
2021-10-07  6:23 ` [PATCH v4 04/11] tools: add fdtsig.sh AKASHI Takahiro
2021-10-11 14:54   ` Simon Glass
2021-10-12  1:42     ` AKASHI Takahiro
2021-10-15  0:40       ` Simon Glass
2021-10-25  3:06         ` AKASHI Takahiro
2021-10-26  6:00           ` AKASHI Takahiro
2021-10-27 14:05             ` Simon Glass
2021-10-07  6:23 ` [PATCH v4 05/11] tools: mkeficapsule: add firmwware image signing AKASHI Takahiro
2021-10-20  8:17   ` Masami Hiramatsu
2021-10-25  3:12     ` AKASHI Takahiro
2021-10-25  5:40       ` Masami Hiramatsu
2021-10-25  6:09         ` AKASHI Takahiro
2021-10-25  7:04           ` Masami Hiramatsu
2021-10-25  9:58         ` Sughosh Ganu
2021-10-25 12:46           ` Masami Hiramatsu
2021-10-07  6:23 ` [PATCH v4 06/11] tools: mkeficapsule: add man page AKASHI Takahiro
2021-10-07  6:23 ` [PATCH v4 07/11] doc: update UEFI document for usage of mkeficapsule AKASHI Takahiro
2021-10-07  6:23 ` [PATCH v4 08/11] tools: mkeficapsule: allow for specifying GUID explicitly AKASHI Takahiro
2021-10-07  6:23 ` [PATCH v4 09/11] test/py: efi_capsule: align with the syntax change of mkeficapsule AKASHI Takahiro
2021-10-07  6:23 ` [PATCH v4 10/11] test/py: efi_capsule: add a test for "--guid" option AKASHI Takahiro
2021-10-07  6:23 ` [PATCH v4 11/11] test/py: efi_capsule: add image authentication test AKASHI Takahiro

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=20211025051434.GC44989@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=ilias.apalodimas@linaro.org \
    --cc=masami.hiramatsu@linaro.org \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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