public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file
Date: Wed, 22 May 2019 08:46:22 +0200	[thread overview]
Message-ID: <20190522084622.7d63c32d@jawa> (raw)
In-Reply-To: <AM0PR04MB448185CD7046B09B40F45F3A88000@AM0PR04MB4481.eurprd04.prod.outlook.com>

Hi Peng,

> > > > > > Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading
> > > > > > i.MX container format file
> > > > > >
> > > > > > On 5/21/19 4:55 AM, Peng Fan wrote:
> > > > > > [...]
> > > > > >  
> > > > > > >>>>> I do not know how other SoC vendor did FIT hardware
> > > > > > >>>>> secure boot, please share you have any information.  
> > > > > > >>>>
> > > > > > >>>> The SPL can be in the custom format, but then can load
> > > > > > >>>> fitImage with the next stage(s), right ?  
> > > > > > >>>
> > > > > > >>> I am not able to follow you, could you share more
> > > > > > >>> details?  
> > > > > > >>
> > > > > > >> Wrap the SPL into this custom format and then have the
> > > > > > >> SPL load/authenticate fitImage with the rest (U-Boot,
> > > > > > >> Linux, DTB etc). Would that work ?  
> > > > > > >
> > > > > > > It not work.
> > > > > > > We already wrap SPL in i.MX container format, this
> > > > > > > patchset is to let SPL could load the 2nd container file
> > > > > > > which contains U-Boot/DTB/OP-TEE/ATF.  If we let SPL load
> > > > > > > a fitimage which contains (U-Boot/DTB and etc), it could
> > > > > > > not pass secure boot authentication, because ROM not know
> > > > > > > fitimage, it only know i.MX container format.  
> > > > > >
> > > > > > It's not bootrom that authenticates the next stage, it's
> > > > > > U-Boot SPL. BootROM already authenticated and started the
> > > > > > U-Boot SPL, so that's a trusted code. Now this trusted code
> > > > > > can authenticate and start the next stage (U-Boot, ATF,
> > > > > > OpTee OS, etc) ; the BootROM is already out of the picture
> > > > > > at this point.  
> > > > >
> > > > > Sorry for not clear. On i.MX8, SCFW (a runtime firmware
> > > > > )exports API for others to use, sc_seco_authenticate is the
> > > > > API that used for authentication. I could not share more
> > > > > information about this API works inside SCFW and ROM. sc_err_t
> > > > > sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd,
> > > > > sc_faddr_t addr)
> > > > >
> > > > > SPL will call this API, one parameter is address which needs a
> > > > > container image there.  
> > > >
> > > > Please consider following scenario (I think that this is in sync
> > > > with Marek's point):
> > > >
> > > > 1. You wrap SPL into i.MX8 "container", so the SPL would be
> > > > recognised an checked by secure code in ROM.
> > > >
> > > > 2. Then we do have SPL "trusted". It is up to SPL to:
> > > >
> > > > 2.1. Use its private key to check u-boot, dtb, etc embedded into
> > > > FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).
> > > >
> > > > 2.2. Use crypto engine (it's API) with fused keys to speed-up
> > > > the process of boot (by HW support to check the binary). Such
> > > > approach is in i.MX6Q.  
> > >
> > > I suppose you talking HAB.  
> > 
> > Yes. As described here:
> > 
> > https://www.nxp.com/docs/en/application-note/AN4581.pdf
> >   
> > >  
> > > >
> > > >
> > > > By using above approach we do have the NXP's "container" format
> > > > only seen in the SPL (which is OK, as for example Samsung does
> > > > similar thing with FBL/BL1). When SPL is "trused" we may use
> > > > available facilities.  
> > >
> > > The issue to me is that sc_seco_authenticate could not take a FIT
> > > image as input.  
> > 
> > Is the sc_seco_authenticate an API accessible from SPL, U-Boot
> > proper or Linux crypro engine driver?  
> 
> Yes, it is an API accessible in SPL/U-Boot stage. I do not know about
> Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would
shed some more light on it?

> 
> > 
> > Or is it just the function executed by ROM on the very beginning to
> > load SPL? 
> > >
> > > If I switch to FIT, I need to use FIT to wrap a container image,
> > > it does not make sense to me.  
> > 
> > Please correct me if I'm wrong, but isn't the container image only
> > needed to wrap SPL?  
> 
> Container image will wrap SPL to make ROM could load SPL, Kick SPL and
> authenticate SPL.

Ok. So it is needed in the ROM "part" of security.

> 
> When SPL booting U-Boot, SPL could use FIT to load and boot uboot.
> But when SPL need to authenticate U-Boot with AHAB on i.MX8, a
> container format header/image needs to be passed to
> sc_seco_authenticate API, the API internal implementation is it will
> parse the container header/image.

Ok. So every time we want to use the sc_seco_authenticate API the
provided image for checking needs to be wrapped into the "container"
iMX8 specific format.

> 
> So in vendor tree, uboot/atf/optee are wrapped into a container
> format image.

Ok.

> 
> > 
> > In which other cases the container image is needed in U-Boot proper
> > or Linux kernel?  
> 
> When uboot authenticate kernel, we also wrap kernel image into a
> container format file using CST. I do not know how Linux kernel
> itself authenticate others.
> 
> Thanks,
> Peng.
> 
> >   
> > >
> > > Thanks,
> > > Peng.  
> > > >  
> > > > >  
> > > > > >  
> > > > > > > For authentication, we always let ROM to authenticate
> > > > > > > including SPL authenticating U-Boot, so we need pass an
> > > > > > > image to ROM that ROM could recognize when SPL booting
> > > > > > > 2nd image.  
> > > > > >
> > > > > > Shouldn't the CPU have some sort of facility, like a crypto
> > > > > > engine, which authenticates whatever blob with the right
> > > > > > signature against a key burned into the CPU ? If so, then
> > > > > > you would just implement a crypto driver and pass the blob
> > > > > > and signature to it. I suspect that's how it should work,
> > > > > > how else would Linux be able to make use of these secure
> > > > > > bits if it cannot call the bootrom anymore ?  
> > > > >
> > > > > sc_seco_authenticate on i.MX8 will always be available. It is
> > > > > exported by a runtime firmware running on a Cortex-M core
> > > > > inside i.MX8. The API will do authentication, its accepts
> > > > > container format image as input and no other format.
> > > > >
> > > > > Thanks,
> > > > > Peng.
> > > > >  
> > > > > >
> > > > > > --
> > > > > > Best regards,
> > > > > > Marek Vasut  
> > > > > _______________________________________________
> > > > > U-Boot mailing list
> > > > > U-Boot at lists.denx.de
> > > > > https://lists.denx.de/listinfo/u-boot  
> > > >
> > > >
> > > >
> > > >
> > > > Best regards,
> > > >
> > > > Lukasz Majewski
> > > >
> > > > --
> > > >
> > > > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194
> > > > Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
> > > > (+49)-8142-66989-80 Email: lukma at denx.de  
> > 
> > 
> > 
> > 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > --
> > 
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma at denx.de  




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190522/fff7327a/attachment.sig>

  reply	other threads:[~2019-05-22  6:46 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07 12:52 [U-Boot] [PATCH 0/6] imx8: support container Peng Fan
2019-05-07 12:52 ` [U-Boot] [PATCH 1/6] imx: mach-imx: clean up Makefile Peng Fan
2019-05-07 12:52 ` [U-Boot] [PATCH 2/6] spl: Add function to get u-boot raw sector Peng Fan
2019-05-07 12:52 ` [U-Boot] [PATCH 3/6] imx8: support parsing i.MX8 Container file Peng Fan
2019-05-07 12:52 ` [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file Peng Fan
2019-05-18 16:09   ` Simon Glass
2019-05-20  1:30     ` Peng Fan
2019-05-20  1:45       ` Marek Vasut
2019-05-20  1:54         ` Peng Fan
2019-05-20 10:36           ` Marek Vasut
2019-05-21  2:31             ` Peng Fan
2019-05-21  2:49               ` Marek Vasut
2019-05-21  2:55                 ` Peng Fan
2019-05-21  3:03                   ` Marek Vasut
2019-05-21  3:19                     ` Peng Fan
2019-05-21  8:32                       ` Lukasz Majewski
2019-05-21 12:41                         ` Marek Vasut
2019-05-21 13:13                           ` Lukasz Majewski
2019-05-22  4:18                         ` Peng Fan
2019-05-22  6:02                           ` Lukasz Majewski
2019-05-22  6:15                             ` Peng Fan
2019-05-22  6:46                               ` Lukasz Majewski [this message]
2019-05-22  7:22                                 ` Peng Fan
2019-05-22  7:34                                   ` Lukasz Majewski
2019-05-22 11:41                                     ` Marek Vasut
2019-05-24  1:59                                       ` [U-Boot] [EXT] " Ye Li
2019-05-27  9:49                                         ` Peng Fan
2019-05-27 11:31                                           ` Marek Vasut
2019-05-30  7:06                                             ` Ye Li
2019-05-30  8:19                                               ` Marek Vasut
2019-06-04  3:27                                                 ` Peng Fan
2019-06-04 11:24                                                   ` Marek Vasut
2019-06-05  1:18                                                     ` Peng Fan
2019-06-05  1:30                                                       ` Marek Vasut
2019-06-05  1:59                                                         ` Peng Fan
2019-06-05  2:38                                                           ` Marek Vasut
2019-06-05  3:03                                                             ` Peng Fan
2019-06-05 13:24                                                               ` Marek Vasut
2019-06-05 13:52                                                                 ` Tom Rini
2019-06-05 13:55                                                                   ` Marek Vasut
2019-06-06  2:33                                                                   ` Peng Fan
2019-06-06  7:02                                                                     ` Lukasz Majewski
2019-06-06  7:23                                                                       ` Peng Fan
2019-06-06  7:12                                                                     ` Marek Vasut
2019-06-06  7:54                                                                       ` Peng Fan
2019-06-06  8:05                                                                         ` Marek Vasut
2019-05-22  2:56       ` [U-Boot] " Peng Fan
2019-05-07 12:52 ` [U-Boot] [PATCH 5/6] imx: add container target Peng Fan
2019-05-07 12:52 ` [U-Boot] [PATCH 6/6] imx8qxp_mek: switch to use container image Peng Fan

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=20190522084622.7d63c32d@jawa \
    --to=lukma@denx.de \
    --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