public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>,
	u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Michal Simek <michal.simek@amd.com>,
	Takahiro Akashi <takahiro.akashi@linaro.org>
Subject: Re: [PATCH 1/7] capsule: authenticate: Embed capsule public key in platform's dtb
Date: Mon, 26 Jun 2023 12:53:25 +0300	[thread overview]
Message-ID: <ZJlgFQIFL8HOYu6U@hera> (raw)
In-Reply-To: <CAPnjgZ34Q1a1+Df=Ea=7iLpPaaS7ih7iwgVQy_ds9NRF1=KMSg@mail.gmail.com>

Hi Simon,

[...]

> > > > > > +
> > > > > > +gen_capsule_signature_file signature.$$.dts > /dev/null 2>&1
> > > > > > +$CPP $dtc_cpp_flags -x assembler-with-cpp -o signature.$$.tmp signature.$$.dts > /dev/null 2>&1
> > > > > > +dtc -@ -O dtb -o signature.$$.dtbo signature.$$.tmp > /dev/null 2>&1
> > > > > > +fdtoverlay -i $1 -o temp.$$.dtb -v signature.$$.dtbo > /dev/null 2>&1
> > > > > > +mv temp.$$.dtb $1 > /dev/null 2>&1
> > > > > > +rm -f signature.$$.* > /dev/null 2>&1
> > > > > > --
> > > > > > 2.34.1
> > > > > >
> > > > >
> > > > > Can you please add this to binman instead?
> > > >
> > > > I had looked at using binman for this work earlier because I very much
> > > > expected this comment from you :). Having said that, I am very much
> > > > open to using binman instead if it turns out to be the better way of
> > > > achieving this. What this patch does is that, with capsule
> > > > authentication enabled, it embeds the public key esl file into the
> > > > dtb's as they get built. As per my understanding, binman gets called
> > > > at the end of the u-boot build, once the constituent images( e..g
> > > > u-boot.bin = u-boot-no-dtb.bin + dtb) have been generated. So, if we
> > > > call binman _after_ the requisite image(s) have been generated, we
> > > > would need to 1) identify the dtb's in which the esl needs to be
> > > > embedded, and then 2) generate the final image all over again. Don't
> > > > you think this is non optimal? Or is there a way of generating the
> > > > constituent images(including the dtb's) through binman instead?
> > >
> > > The best way to do that IMO is to generate a second file, .e.g.
> > > u-boot-capsule.bin
> >

This make no sense to me whatsoever.  Do we have an example in u-boot
generating multiple dtb versions for other reasons/subsystems?

> > That would break the scripts for platforms which might be using
> > u-boot.bin as the image to boot from. I know that the ST platform
> > which does enable capsule updates uses the u-boot-nodtb.bin as the
> > BL33 image and the u-boot.dtb as BL33_CFG. Hence my question, if we
> > have to use binman, is there a way to 1) modify the u-boot.dtb and
> > then 2) regenerate u-boot.bin image.
> >
> > I know this is software, and everything can be done in a hacky way.
> > But I was exploring using the u-boot node as a section entry, so that
> > the u-boot.dtb can be modified and then binman would
> > repackage/regenerate the u-boot.bin. But this is not working.
>
> NO, please do not do that.  You should create a new file, not modify
> u-boot.bin or u-boot.dtb. Please just don't mess around with this, it
> will lead to all sorts of confusion.
>
> I thought we already had this discussion a while back?

No we haven't.  In fact I am struggling to see the confusion part.  It's
fine for the u-boot dtb to include all the internal nodes DM needs, but
suddenly having the capsule signature is problematic?

In the past the .esl file was part of the U-Boot binary and things were
working perfectly fine.  In fact you could update/downgrade u-boot and the
signatures naturally followed along instead of having to update u-boot
*and* the dtb, which we have to do today. You could also build a capsule
way easier without injecting/removing signatures to the dtb.
You were the one that insisted on reverting that and instead adding it on
the dtb.  We explained most of the downsides back then, along with some
security concerns.  We also mentioned that the signature in the dtb makes
little sense since it's difference *per class of boards* and it's not
something we could include in static dtb files, but that lead nowhere...

As Sughosh already said there are platforms that use the generated u-boot
dtb and the raw binary to assemble a FIP image.  So why exactly adding the
capsule signature to the default dtb is wrong?  Why should we add an
*extra* .dtb with one additional node -- which is very much needed by the
design you proposed.  This will only lead to extra confusion.


Thanks
/Ilias
>
> >
> > >
> > > I don't think it is a good idea to add other junk to u-boot.bin. It
> > > should just be U-Boot + dtb.
> >
> > No junk is being added to u-boot.bin. Just that, as the platform
> > builds dtb's, the ESL file gets embedded into them as a property under
> > the signature node. There is no additional image being added to the
> > the u-boot.bin.
>
> This needs to be done in a separte file, as above.
>
> Regards,
> Simon

  reply	other threads:[~2023-06-26  9:53 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 10:37 [PATCH 0/7] Integrate EFI capsule tasks into u-boot's build flow Sughosh Ganu
2023-06-13 10:38 ` [PATCH 1/7] capsule: authenticate: Embed capsule public key in platform's dtb Sughosh Ganu
2023-06-15  9:14   ` Simon Glass
2023-06-15 16:11     ` Sughosh Ganu
2023-06-19 12:36       ` Simon Glass
2023-06-21  4:20         ` Sughosh Ganu
2023-06-26  9:07           ` Simon Glass
2023-06-26  9:53             ` Ilias Apalodimas [this message]
2023-06-26 11:19               ` Simon Glass
2023-06-27  9:54                 ` Ilias Apalodimas
2023-06-27 10:13                   ` Simon Glass
2023-06-27 10:20                     ` Sughosh Ganu
2023-06-13 10:38 ` [PATCH 2/7] test: py: Generate capsule keys prior to building u-boot Sughosh Ganu
2023-06-13 10:38 ` [PATCH 3/7] doc: capsule: Document the new mechanism to embed ESL file into dtb Sughosh Ganu
2023-06-15  9:14   ` Simon Glass
2023-06-13 10:38 ` [PATCH 4/7] tools: mkeficapsule: Add support for parsing capsule params from config file Sughosh Ganu
2023-06-14  3:39   ` Takahiro Akashi
2023-06-14  5:26     ` Sughosh Ganu
2023-06-14  5:53       ` Takahiro Akashi
2023-06-15  4:39         ` Sughosh Ganu
2023-06-15  5:49           ` Takahiro Akashi
2023-06-16  4:26             ` Sughosh Ganu
2023-06-16  4:46               ` Takahiro Akashi
2023-06-16  5:07                 ` Sughosh Ganu
2023-06-16  5:18                   ` Takahiro Akashi
2023-06-16  6:35                     ` Sughosh Ganu
2023-06-16 13:12                       ` Schmidt, Malte
2023-06-19  7:27                         ` Sughosh Ganu
2023-06-19  9:42                           ` Schmidt, Malte
2023-06-13 10:38 ` [PATCH 5/7] Makefile: Add a target for building capsules Sughosh Ganu
2023-06-15  9:14   ` Simon Glass
2023-06-15 16:25     ` Sughosh Ganu
2023-06-19 12:37       ` Simon Glass
2023-06-21  4:26         ` Sughosh Ganu
2023-06-26  9:07           ` Simon Glass
2023-06-26 12:13             ` Sughosh Ganu
2023-06-27  4:57               ` Sughosh Ganu
2023-06-27 11:20                 ` Simon Glass
2023-06-27 12:07                   ` Sughosh Ganu
2023-06-27 12:20                     ` Simon Glass
2023-06-27 17:42                       ` Sughosh Ganu
2023-06-28  7:42                         ` Simon Glass
2023-06-28  8:42                           ` Ilias Apalodimas
2023-06-28 10:00                           ` Sughosh Ganu
2023-06-28 10:19                             ` Simon Glass
2023-06-28 12:25                               ` Sughosh Ganu
2023-06-28 13:02                                 ` Simon Glass
2023-06-13 10:38 ` [PATCH 6/7] test: efi_capsule: Test capsule generation from config file Sughosh Ganu
2023-06-15  9:14   ` Simon Glass
2023-06-13 10:38 ` [PATCH 7/7] doc: Add documentation to describe capsule config file format Sughosh Ganu

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=ZJlgFQIFL8HOYu6U@hera \
    --to=ilias.apalodimas@linaro.org \
    --cc=michal.simek@amd.com \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=takahiro.akashi@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