All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Roman Kopytin <Roman.Kopytin@kaspersky.com>,
	u-boot@lists.denx.de,
	 Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Subject: Re: [PATCH 0/2] RFC: add fdt_add_pubkey tool
Date: Wed, 10 Nov 2021 17:31:29 -0700	[thread overview]
Message-ID: <CAPnjgZ1ZL4MF1f9k-B0xBZYeFWT4xB1fgqfe9djiM68G_iTASg@mail.gmail.com> (raw)
In-Reply-To: <d132279d-5d5c-0f93-1e96-c21dafe0845a@siemens.com>

Hi Jan,

On Wed, 10 Nov 2021 at 13:58, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> On 10.11.21 20:36, Simon Glass wrote:
> > Hi Jan,
> >
> > On Wed, 10 Nov 2021 at 09:49, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> >>
> >> On 10.11.21 17:31, Simon Glass wrote:
> >>> Hi Jan,
> >>>
> >>> On Wed, 10 Nov 2021 at 00:20, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> >>>>
> >>>> On 10.11.21 07:55, Jan Kiszka wrote:
> >>>>> On 10.11.21 01:58, Simon Glass wrote:
> >>>>>> Hi,
> >>>>>>
> >>>>>> On Tue, 9 Nov 2021 at 02:17, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> >>>>>>>
> >>>>>>> On 08.11.21 16:28, Roman Kopytin wrote:
> >>>>>>>> In order to reduce the coupling between building the kernel and
> >>>>>>>> U-Boot, I'd like a tool that can add a public key to U-Boot's dtb
> >>>>>>>> without simultaneously signing a FIT image. That tool doesn't seem to
> >>>>>>>> exist, so I stole the necessary pieces from mkimage et al and put it
> >>>>>>>> in a single .c file.
> >>>>>>>>
> >>>>>>>> I'm still working on the details of my proposed "require just k out
> >>>>>>>> these n required keys" and how it should be implemented, but it will
> >>>>>>>> probably involve teaching this tool a bunch of new options. These
> >>>>>>>> patches are not necessarily ready for inclusion (unless someone else
> >>>>>>>> finds fdt_add_pubkey useful as is), but I thought I might as well send
> >>>>>>>> it out for early comments.
> >>>>>>>
> >>>>>>> I'd also like to see the usage of this hooked into the build process.
> >>>>>>>
> >>>>>>> And to my understanding of [1], that approach will provide a feature
> >>>>>>> that permits hooking with the build but would expect the key as dtsi
> >>>>>>> fragment. Can we consolidate the approaches?
> >>>>>>>
> >>>>>>> My current vision of a user interface would be a Kconfig option that
> >>>>>>> takes a list of key files to be injected. Maybe make that three lists,
> >>>>>>> one for "required=image", one for "required=conf", and one for optional
> >>>>>>> keys (if that has a use case in practice, no idea).
> >>>>>>
> >>>>>> Also please take a look at binman which is designed to handle create
> >>>>>> (or later updating from Yocto) the devicetree or firmware image.
> >>>>>>
> >>>>>
> >>>>> Yes, binman is another problem area, but not for the public key
> >>>>> injection, rather for permitting to sign fit images that are described
> >>>>> for binman (rather than for mkimage). I'm currently back to dd for
> >>>>> signing the U-Boot container in
> >>>>> arch/arm/dts/k3-am65-iot2050-boot-image.dtsi, or I would have to split
> >>>>> that FIT image description from that file - both not optimal.
> >>>
> >>> Well I don't think binman supports that at present, or at least I'm
> >>> not sure what it would do. We don't have a test case for it. If you
> >>> have an idea for how it should work, please send some ideas and I can
> >>> look at it.
> >>>
> >>>>
> >>>> OK, this can already be optimized with "binman replace" - once I
> >>>> understood where fdtmap can go and where not. Why no support for using
> >>>> map files?
> >>>
> >>> The fdtmap provides enough information to extract anything from the
> >>> image and regenerate/replace things.
> >>>
> >>> What is a map file?
> >>
> >> *.map, e.g. image.map? Also generated by many binmap <cmd> -m?
> >
> > Using map files for what? Do you mean passing it to Binman in lieu of
> > an in-image fdtmap? If so, they are not equivalent. The map is just a
> > simple text output of offsets and sizes. The fdtmap contains the full
> > image description.
>
> Too bad. I was looking for a way to avoid having to add fdtmap to an
> image when all information is already on the build host - and should
> actually only remain there. Embedding fdtmap into the image solely for
> build/post-process purposes looks like overkill to me.

and for run-time access and for being able to list the image and
extract things from it.

Regards,
Simon


>
> >
> >>
> >>>
> >>>>
> >>>> Jan
> >>>>
> >>>>>
> >>>>> And another area: Trust centers that perform the signing (and only that)
> >>>>> usually do not support random formats and workflows but just few common
> >>>>> ones, e.g. x509. It would be nice to have a way to route out the payload
> >>>>> (hashes etc.) that mkimage would sign, ideally into a standard signing
> >>>>> request, and permit to inject the resulting signature at the right
> >>>>> places into the FIT image.
> >>>
> >>> Well that needs to be provided somewhere. It should be fairly easy to
> >>> get Binman to do this, so long as the image description has info about
> >>> what is being signed.
> >>
> >> I would assume that it has to have that information, already to use
> >> mkimage on it or its parts.
> >
> > Well, at present the information is there but Binman does not fully
> > parse the mkimage subnodes. E.g. it doesn't look to see what things
> > are signed/hashed. It just runs mkimage. If we want to output the hash
> > for signing, we would need to implement that somewhere. Binman could
> > do this after the image is build, i.e. look at the various signature
> > nodes, hash the appropriate data and write out an 'instructions' file
> > in a suitable format.
>
> Yep, that would be nice. Or would mkimage have more of the needed logic
> already on board and would better be extended to write them out?
>
> Jan
>
> --
> Siemens AG, T RDA IOT
> Corporate Competence Center Embedded Linux

  reply	other threads:[~2021-11-11  0:31 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 15:28 [PATCH 0/2] RFC: add fdt_add_pubkey tool Roman Kopytin
2021-11-08 15:28 ` [PATCH 1/2] tools: add fdt_add_pubkey Roman Kopytin
2021-11-10  0:58   ` Simon Glass
2021-11-10  7:03     ` Roman Kopytin
2021-11-10  7:41       ` Jan Kiszka
2021-11-10  6:39   ` Jan Kiszka
2021-11-10  7:39   ` Jan Kiszka
2021-11-10  8:26     ` Roman Kopytin
2021-11-10 19:21       ` Jan Kiszka
2021-11-11  5:26         ` Roman Kopytin
2021-11-11  7:18           ` Jan Kiszka
2021-11-10 21:15   ` Jan Kiszka
2021-11-08 15:28 ` [PATCH 2/2] test_vboot.py: include test of fdt_add_pubkey tool Roman Kopytin
2021-11-10  0:58   ` Simon Glass
2021-11-09  9:16 ` [PATCH 0/2] RFC: add " Jan Kiszka
2021-11-09  9:37   ` Roman Kopytin
2021-11-09 10:07     ` Jan Kiszka
2021-11-09 12:43       ` François Ozog
2021-11-09 12:58         ` Jan Kiszka
2021-11-09 13:16           ` François Ozog
2021-11-09 14:00             ` Jan Kiszka
2021-11-09 17:32               ` François Ozog
2021-11-10  0:58         ` Simon Glass
2021-11-10  0:58       ` Simon Glass
2021-11-10  6:43         ` Jan Kiszka
2021-11-10 16:31           ` Simon Glass
2021-11-10 16:48             ` Jan Kiszka
2021-11-10 17:29               ` François Ozog
2021-11-10 17:44                 ` Jan Kiszka
2021-11-10 19:36               ` Simon Glass
2021-11-10 20:51                 ` Jan Kiszka
2021-11-11  0:31                   ` Simon Glass
2021-11-10  0:58   ` Simon Glass
2021-11-10  6:55     ` Jan Kiszka
2021-11-10  7:20       ` Jan Kiszka
2021-11-10 16:31         ` Simon Glass
2021-11-10 16:49           ` Jan Kiszka
2021-11-10 19:36             ` Simon Glass
2021-11-10 20:58               ` Jan Kiszka
2021-11-11  0:31                 ` Simon Glass [this message]
2021-11-10 20:49         ` binman replace broken? (was: Re: [PATCH 0/2] RFC: add fdt_add_pubkey tool) Jan Kiszka
2021-11-11  0:32           ` Simon Glass
2021-11-11  8:15 [PATCH 0/2] RFC: add fdt_add_pubkey tool Roman Kopytin

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=CAPnjgZ1ZL4MF1f9k-B0xBZYeFWT4xB1fgqfe9djiM68G_iTASg@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=Roman.Kopytin@kaspersky.com \
    --cc=jan.kiszka@siemens.com \
    --cc=rasmus.villemoes@prevas.dk \
    --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.