Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-05-01 Thread Peter Jones
On Sat, Apr 27, 2019 at 09:56:08AM +0200, Alexander Graf wrote:
> 
> >>> UEFI gets a bad rap at being complicated, but I think the U-Boot work
> >>> has shown that implementing the core UEFI ABI doesn't require much code
> >>> and isn't the complicated mess they everyone fears it to be.
> >> Depends on how much you start to rely on UEFI features.
> > The format for a UEFI capsule is described in the
> > EFI_FIRMWARE_MANAGEMENT_PROTOCOL chapter of the UEFI spec. Essentially
> 
> Are you sure? I thought that protocol was about other devices in the
> system, not the main firmware. It also seems to be optional - so we
> could just have a board specific function to implement CapsuleUpdate,
> but no cruft for all the other bits in the spec.

There's no requirement to use that format in order to use capsule
updates, but some vendors have found it convenient.  There's also no
requirement to implement the EFI_FIRMWARE_MANAGEMENT_PROTOCOL at all -
and the only place it's distinctly useful from an application point of
view (i.e. while trying to drive a firmware update) is if you want to
independently update two of the same kind of peripheral device's
firmware from within a UEFI application.  It's not clear to me that's a
very interesting use case from an EBBR point of view - I'm haven't seen
much demand for it on server, laptop, or desktop systems either.

But it's also how option ROMs register their firmware to be updated via
UpdateCapsule().  That's interesting on machines where you regularly
expect peripherals to be in PCIe slots, but I'm still not sure it's that
useful for EBBR style devices.  I guess it could be useful in the
thunderbolt case, but I think in order to avoid thwarting DMA attack
mitigations, that would best be done from the OS just like for USB
devices.

> That's where the idea came from to just put a fit image into the capsule
> body (set CapsuleGUID to a newly defined FIT-GUID). With that, we could
> share a lot of code inside of U-Boot, as DT parsing is already there. We
> could then have individual segments, that can either be data or command
> payloads and thus a capsule update could basically just be a few data
> segments with a U-Boot script.

This makes a lot of sense to me, though there have been some pain points
about this approach in the past.  The biggest one is because the
EFI_FIRMWARE_MANAGEMENT_PROTOCOL capsule format has a header on it
that's the same as the EFI_CAPSULE_HEADER structure, which we have to
add in fwupd if we can't find it.  If we plan on recommending that
vendors implement these ad-hoc firmware blobs, we should also require
that when they do so, they already include the EFI_CAPSULE_HEADER on the
image, with a GUID that matches what's in the ESRT, and is specifically
not EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID.

> > it is a file containing multiple UEFI binaries which are individually
> > signed and can be loaded as UEFI boottime drivers. Further payloads are
> > passed to the SetImage() method of the EFI_FIRMWARE_MANAGEMENT_PROTOCOL.
> >
> > Two ways for the delivery of a capsule are defined.

Three, I think?  I'm not seeing why an application can't also call
FMP->SetImage() to do this when it's present.  I'm not sure it's worth
supporting at all, though.

> > Capsules can be delivered by placing a file in the
> > \EFI\UpdateCapsule directory or by calling the UpdateCapsule() boot
> > service. The UpdateCapsule() boot service can either be implemented
> > as available at boottime only or as a full runtime service.

Right now in fwupd we support only boot-service calls to do this,
because of the history of bugs with SetVirtualAddressMap() and
ExitBootServices(), and because it's the only thing required to be
tested for Windows logo cert.  I suspect MS has made that the case
because of the exact same bugs.

The path-based mechanism makes a lot of sense with EBBR, but runtime
UpdateCapsule() is a lot more viable here than on the desktop or
servers as well.  The reason I say that is because with these devices
we're more in a situation where the hardware vendor is likely to be
producing the kernel as well, so there's a better integration testing
story here.

-- 
  Peter
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-27 Thread Alexander Graf

On 26.04.19 15:46, Heinrich Schuchardt wrote:
>
> On 4/26/19 1:21 PM, Jan Kiszka wrote:
>> On 26.04.19 12:21, Grant Likely wrote:
>>> On 26/04/2019 10:49, Jan Kiszka wrote:
 On 26.04.19 11:07, Francois Ozog wrote:
>>> [...]
> Here are the guiding principles of our efforts :
> 0) we want a cross architecture (x86/Arm/...), cross vendor and cross
> processor model update solution
> 1) untrusted world cannot update trusted world
 Conceptually, it can. It's a matter of validating the update by the
 trusted world before using it. A trusted instance can allow an untrusted
 one to write version 2, validate that before switching to it, and stick
 with version 1 if that fails.

> 2) what the UEFI implementation does with the capsule is platform
> specific
> 3) the update capsule payload is opaque
>
> 1) is a "philosophy" decision. When you have a root of trust down to
> the operating system. So in theory everything should be fine. But the
> attack surface is such that we can't rule out hacking (and history
> prove this is unfortunately a safe assumption). In addition, there may
> be liability aspects related to the who does the update: the hardware
> platform administrator may not be the legal entity than the operating
> system administrator. For instance:
> -  on Packet.net could, a customer can flash up to the BL33 untrusted
> firmware but that is all.
> - A surveillance camera can be operated by city personnel but only law
> enforcement agency can see raw video (un-blurred faces and licence
> plates). This can be implemented by a derivative of OPTEE SecureMedia
> Path but if you allow untrusted world to update the trusted one, city
> personnel can overcome the legal restriction.
> With 1) this means that even U-Boot code shall not be able/allowed to
> update S-EL3 firmware (be it Trusted Firmware A or something else),
> Secure EL1/0 software (OPTEE and its applications or something else).
> If possible, allowing the operating system administrator to
> selectively (BL33 is OK but not S-EL3) update firmware is at least
> platform dependent. Hence defeats 0)
>
> With 2) we do not impose reboot to update. Some platform may impose
> reboot or some designers will prefer reboot. We say that there is a
> chain of responsibility for updates.
> So it is perfectly OK to have a Linux software agent receive an update
> by any mean (network, USB, serial...). The agent will pack this (or
> those) into a capsule and push it to UEFI implementation.
> The UEFI implementation (U-Boot or Tianocore) will then do whatever it
> pleases for the update providing it complies with 1) So the UEFI
> implementation can live update up to BL33 firmware.
> Should the update be targeted to secure world, then the UEFI
> implementation can pass it to S-EL3 for update (platform specific)
> which means the update can also be live. It is a designer decision.
>
> With 3) we have flexibility but sometimes too much flexibility is a
> problem. Alexander Graf suggested we can use a FIT object to pass
> diverse objects. It is "half" opaque but I really like the idea.
> The contents of individual FIT components can be blocks to be placed
> at a fix location in a NOR flash or a file, no importance.
>
> What do everyone think about those design principles ?
>
 UEFI and capsules can be fine for those platform that support it (and
 it's still a rare feature) and for stuff like boot and peripheral
 firmware. I don't think it's a wise, future-proof idea to use it for
 more.

 UEFI is not a very healthy ecosystem yet, and I'm personally skeptical
 it will evolve towards that (looking at that as both a user as well as
 an OEM). It's not even present in quite a few of our use cases. In some
 it will never be - think of safety-critical system: not affordable with
 such a complex approach like UEFI.
>>> Can I challenge that view a bit? On the Tianocore side I agree that the
>>> ecosystem isn't very healthy. That project in particular struggles with
>>> what to do with board support, having decided early on that board
>>> support generally doesn't need to be in the main repository.
>>>
>>> However, U-Boot support for the UEFI ABI is improving in leaps and
>>> bounds. SUSE and Fedora both depend on U-Boot UEFI for booting on all
>>> the Arm SBCs that they support, and enabling UEFI in U-Boot is just a
>>> config option or two. There is a fair bit of encouragement from within
>>> the project to enable UEFI by default.
>> I don't disagree that this aspect is a step forward (though pulling in
>> things redundant code via grub & Co is not really progress). But a Unix
>> community would have probably designed a technically more elegant
>> solution on a green field than the clumsy, legacy-based UEFI interfaces.
>>

Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread Heinrich Schuchardt


On 4/26/19 1:21 PM, Jan Kiszka wrote:
> On 26.04.19 12:21, Grant Likely wrote:
>> On 26/04/2019 10:49, Jan Kiszka wrote:
>>> On 26.04.19 11:07, Francois Ozog wrote:
>> [...]
 Here are the guiding principles of our efforts :
 0) we want a cross architecture (x86/Arm/...), cross vendor and cross
 processor model update solution
 1) untrusted world cannot update trusted world
>>>
>>> Conceptually, it can. It's a matter of validating the update by the
>>> trusted world before using it. A trusted instance can allow an untrusted
>>> one to write version 2, validate that before switching to it, and stick
>>> with version 1 if that fails.
>>>
 2) what the UEFI implementation does with the capsule is platform
 specific
 3) the update capsule payload is opaque

 1) is a "philosophy" decision. When you have a root of trust down to
 the operating system. So in theory everything should be fine. But the
 attack surface is such that we can't rule out hacking (and history
 prove this is unfortunately a safe assumption). In addition, there may
 be liability aspects related to the who does the update: the hardware
 platform administrator may not be the legal entity than the operating
 system administrator. For instance:
 -  on Packet.net could, a customer can flash up to the BL33 untrusted
 firmware but that is all.
 - A surveillance camera can be operated by city personnel but only law
 enforcement agency can see raw video (un-blurred faces and licence
 plates). This can be implemented by a derivative of OPTEE SecureMedia
 Path but if you allow untrusted world to update the trusted one, city
 personnel can overcome the legal restriction.
 With 1) this means that even U-Boot code shall not be able/allowed to
 update S-EL3 firmware (be it Trusted Firmware A or something else),
 Secure EL1/0 software (OPTEE and its applications or something else).
 If possible, allowing the operating system administrator to
 selectively (BL33 is OK but not S-EL3) update firmware is at least
 platform dependent. Hence defeats 0)

 With 2) we do not impose reboot to update. Some platform may impose
 reboot or some designers will prefer reboot. We say that there is a
 chain of responsibility for updates.
 So it is perfectly OK to have a Linux software agent receive an update
 by any mean (network, USB, serial...). The agent will pack this (or
 those) into a capsule and push it to UEFI implementation.
 The UEFI implementation (U-Boot or Tianocore) will then do whatever it
 pleases for the update providing it complies with 1) So the UEFI
 implementation can live update up to BL33 firmware.
 Should the update be targeted to secure world, then the UEFI
 implementation can pass it to S-EL3 for update (platform specific)
 which means the update can also be live. It is a designer decision.

 With 3) we have flexibility but sometimes too much flexibility is a
 problem. Alexander Graf suggested we can use a FIT object to pass
 diverse objects. It is "half" opaque but I really like the idea.
 The contents of individual FIT components can be blocks to be placed
 at a fix location in a NOR flash or a file, no importance.

 What do everyone think about those design principles ?

>>>
>>> UEFI and capsules can be fine for those platform that support it (and
>>> it's still a rare feature) and for stuff like boot and peripheral
>>> firmware. I don't think it's a wise, future-proof idea to use it for
>>> more.
>>>
>>> UEFI is not a very healthy ecosystem yet, and I'm personally skeptical
>>> it will evolve towards that (looking at that as both a user as well as
>>> an OEM). It's not even present in quite a few of our use cases. In some
>>> it will never be - think of safety-critical system: not affordable with
>>> such a complex approach like UEFI.
>>
>> Can I challenge that view a bit? On the Tianocore side I agree that the
>> ecosystem isn't very healthy. That project in particular struggles with
>> what to do with board support, having decided early on that board
>> support generally doesn't need to be in the main repository.
>>
>> However, U-Boot support for the UEFI ABI is improving in leaps and
>> bounds. SUSE and Fedora both depend on U-Boot UEFI for booting on all
>> the Arm SBCs that they support, and enabling UEFI in U-Boot is just a
>> config option or two. There is a fair bit of encouragement from within
>> the project to enable UEFI by default.
>
> I don't disagree that this aspect is a step forward (though pulling in
> things redundant code via grub & Co is not really progress). But a Unix
> community would have probably designed a technically more elegant
> solution on a green field than the clumsy, legacy-based UEFI interfaces.
>
>>
>> UEFI gets a bad rap at being complicated, but I think the U-Boot work
>> has shown that implementing the core UEFI 

Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread Francois Ozog
On Fri, 26 Apr 2019 at 11:49, Jan Kiszka  wrote:

> On 26.04.19 11:07, Francois Ozog wrote:
> > On Fri, 26 Apr 2019 at 10:30, Christian Storm
> >  wrote:
> >>
> >> Hi,
> >>
> > Background: during the last Linaro connect in Bangkok I was told
> > that Linaro Edge (LEDGE) were working on a secure software update
> > mechanism based on UEFI capsules that would flash firmware updates
> > from a UEFI application, instead of using a Linux agent such as
> > SWUpdate.
> 
>  How would capsules help with writing to arbitrary storage, updating
>  only files on filesystem, reducing the update size (binary diffs),
>  or talking to the cloud?
> >>>
> >
> > See below
> >>
> >>> - arbitrary storage: I guess they can only write to what is supported
> >>>by the machine's UEFI implementation.
> >>>
> >
> > Yes, see below
> >>
> >>> - updating only files on filesystem: I assume this is out of scope in
> >>>their architecture (Francois: do you want to support file-based
> >>>updates or only block-based ones?)
> >>
> > Both, see below
> >>
> >>> - reducing the update size (binary diffs), or talking to the cloud:
> >>>they will do that from non-secure Linux. It would be dangerous to
> use
> >>>a fragile network stack from an UEFI application or the secure
> world.
> >>>In that sense, they also need a Linux agent.
> >>
> >> If I understand the idea correctly, there's then a Linux companion agent
> >> that does, e.g., the cloud communication and sets up the update payload
> >> to be consumed and applied by the UEFI firmware update application. The
> >> actual update action will take place on reboot, e.g., flashing the
> >> inactive partition in an A/B setup and thereafter booting into the newly
> >> flashed, then active partition.
> >>
> >> If so, this would prolong the time the system is unavailable due to disk
> >> flashing I/O in the UEFI firmware update application compared to
> flashing
> >> the inactive partition from within Linux and have the bootloader just
> >> switch the to be booted partitions.
> >>
> >> Generally, but in particular regarding binary diffs, a binary diff
> >> application mechanism would have to be implemented and maintained in the
> >> UEFI realm as opposed to "just" using the respective shared libraries
> >> (e.g. librsync, casync, ...) in the Linux realm. Granted, one could
> >> come up with a unified format to which the output of, e.g, librsync's
> rdiff
> >> or a casync run is converted but nonetheless, this creates some porting/
> >> implementation and maintenance effort.
> >>
> >>
> > Here are the guiding principles of our efforts :
> > 0) we want a cross architecture (x86/Arm/...), cross vendor and cross
> > processor model update solution
> > 1) untrusted world cannot update trusted world
>
> Conceptually, it can. It's a matter of validating the update by the
> trusted
> world before using it. A trusted instance can allow an untrusted one to
> write
> version 2, validate that before switching to it, and stick with version 1
> if
> that fails.
>
> Agreed. Then is a better principle:  untrusted world cannot directly
update trusted world objects that are part of the current chain of trust
   This would allow changing B partition while A is in force.
There may be another aspect to take into account, not every use case need
the same security "level".
May be a principle to define security levels and guidelines to achieve each
level is more relevant than the "untrusted world cannot directly update
trusted world objects that are part of the current chain of trust" which
implies a certain security level goal.

> 2) what the UEFI implementation does with the capsule is platform specific
> > 3) the update capsule payload is opaque
> >
> > 1) is a "philosophy" decision. When you have a root of trust down to
> > the operating system. So in theory everything should be fine. But the
> > attack surface is such that we can't rule out hacking (and history
> > prove this is unfortunately a safe assumption). In addition, there may
> > be liability aspects related to the who does the update: the hardware
> > platform administrator may not be the legal entity than the operating
> > system administrator. For instance:
> > -  on Packet.net could, a customer can flash up to the BL33 untrusted
> > firmware but that is all.
> > - A surveillance camera can be operated by city personnel but only law
> > enforcement agency can see raw video (un-blurred faces and licence
> > plates). This can be implemented by a derivative of OPTEE SecureMedia
> > Path but if you allow untrusted world to update the trusted one, city
> > personnel can overcome the legal restriction.
> > With 1) this means that even U-Boot code shall not be able/allowed to
> > update S-EL3 firmware (be it Trusted Firmware A or something else),
> > Secure EL1/0 software (OPTEE and its applications or something else).
> > If possible, allowing the operating system administrator to
> > selectively (BL33 

Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread Jan Kiszka

On 26.04.19 12:21, Grant Likely wrote:

On 26/04/2019 10:49, Jan Kiszka wrote:

On 26.04.19 11:07, Francois Ozog wrote:

[...]

Here are the guiding principles of our efforts :
0) we want a cross architecture (x86/Arm/...), cross vendor and cross
processor model update solution
1) untrusted world cannot update trusted world


Conceptually, it can. It's a matter of validating the update by the
trusted world before using it. A trusted instance can allow an untrusted
one to write version 2, validate that before switching to it, and stick
with version 1 if that fails.


2) what the UEFI implementation does with the capsule is platform
specific
3) the update capsule payload is opaque

1) is a "philosophy" decision. When you have a root of trust down to
the operating system. So in theory everything should be fine. But the
attack surface is such that we can't rule out hacking (and history
prove this is unfortunately a safe assumption). In addition, there may
be liability aspects related to the who does the update: the hardware
platform administrator may not be the legal entity than the operating
system administrator. For instance:
-  on Packet.net could, a customer can flash up to the BL33 untrusted
firmware but that is all.
- A surveillance camera can be operated by city personnel but only law
enforcement agency can see raw video (un-blurred faces and licence
plates). This can be implemented by a derivative of OPTEE SecureMedia
Path but if you allow untrusted world to update the trusted one, city
personnel can overcome the legal restriction.
With 1) this means that even U-Boot code shall not be able/allowed to
update S-EL3 firmware (be it Trusted Firmware A or something else),
Secure EL1/0 software (OPTEE and its applications or something else).
If possible, allowing the operating system administrator to
selectively (BL33 is OK but not S-EL3) update firmware is at least
platform dependent. Hence defeats 0)

With 2) we do not impose reboot to update. Some platform may impose
reboot or some designers will prefer reboot. We say that there is a
chain of responsibility for updates.
So it is perfectly OK to have a Linux software agent receive an update
by any mean (network, USB, serial...). The agent will pack this (or
those) into a capsule and push it to UEFI implementation.
The UEFI implementation (U-Boot or Tianocore) will then do whatever it
pleases for the update providing it complies with 1) So the UEFI
implementation can live update up to BL33 firmware.
Should the update be targeted to secure world, then the UEFI
implementation can pass it to S-EL3 for update (platform specific)
which means the update can also be live. It is a designer decision.

With 3) we have flexibility but sometimes too much flexibility is a
problem. Alexander Graf suggested we can use a FIT object to pass
diverse objects. It is "half" opaque but I really like the idea.
The contents of individual FIT components can be blocks to be placed
at a fix location in a NOR flash or a file, no importance.

What do everyone think about those design principles ?



UEFI and capsules can be fine for those platform that support it (and
it's still a rare feature) and for stuff like boot and peripheral
firmware. I don't think it's a wise, future-proof idea to use it for more.

UEFI is not a very healthy ecosystem yet, and I'm personally skeptical
it will evolve towards that (looking at that as both a user as well as
an OEM). It's not even present in quite a few of our use cases. In some
it will never be - think of safety-critical system: not affordable with
such a complex approach like UEFI.


Can I challenge that view a bit? On the Tianocore side I agree that the
ecosystem isn't very healthy. That project in particular struggles with
what to do with board support, having decided early on that board
support generally doesn't need to be in the main repository.

However, U-Boot support for the UEFI ABI is improving in leaps and
bounds. SUSE and Fedora both depend on U-Boot UEFI for booting on all
the Arm SBCs that they support, and enabling UEFI in U-Boot is just a
config option or two. There is a fair bit of encouragement from within
the project to enable UEFI by default.


I don't disagree that this aspect is a step forward (though pulling in things 
redundant code via grub & Co is not really progress). But a Unix community would 
have probably designed a technically more elegant solution on a green field than 
the clumsy, legacy-based UEFI interfaces.




UEFI gets a bad rap at being complicated, but I think the U-Boot work
has shown that implementing the core UEFI ABI doesn't require much code
and isn't the complicated mess they everyone fears it to be.


Depends on how much you start to rely on UEFI features.



I don't see the conflict with safety critical for boot services. I can


Everything is certifiable - with infinite time and money. So you will likely 
reduce the boot process to the very essential of your concrete system, removing 
then 

Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread Francois Ozog
- team-le...@linaro.org as it is now a public discussion

On Fri, 26 Apr 2019 at 12:21, Grant Likely  wrote:

> On 26/04/2019 10:49, Jan Kiszka wrote:
> > On 26.04.19 11:07, Francois Ozog wrote:
> [...]
> >> Here are the guiding principles of our efforts :
> >> 0) we want a cross architecture (x86/Arm/...), cross vendor and cross
> >> processor model update solution
> >> 1) untrusted world cannot update trusted world
> >
> > Conceptually, it can. It's a matter of validating the update by the
> > trusted world before using it. A trusted instance can allow an untrusted
> > one to write version 2, validate that before switching to it, and stick
> > with version 1 if that fails.
> >
> >> 2) what the UEFI implementation does with the capsule is platform
> >> specific
> >> 3) the update capsule payload is opaque
> >>
> >> 1) is a "philosophy" decision. When you have a root of trust down to
> >> the operating system. So in theory everything should be fine. But the
> >> attack surface is such that we can't rule out hacking (and history
> >> prove this is unfortunately a safe assumption). In addition, there may
> >> be liability aspects related to the who does the update: the hardware
> >> platform administrator may not be the legal entity than the operating
> >> system administrator. For instance:
> >> -  on Packet.net could, a customer can flash up to the BL33 untrusted
> >> firmware but that is all.
> >> - A surveillance camera can be operated by city personnel but only law
> >> enforcement agency can see raw video (un-blurred faces and licence
> >> plates). This can be implemented by a derivative of OPTEE SecureMedia
> >> Path but if you allow untrusted world to update the trusted one, city
> >> personnel can overcome the legal restriction.
> >> With 1) this means that even U-Boot code shall not be able/allowed to
> >> update S-EL3 firmware (be it Trusted Firmware A or something else),
> >> Secure EL1/0 software (OPTEE and its applications or something else).
> >> If possible, allowing the operating system administrator to
> >> selectively (BL33 is OK but not S-EL3) update firmware is at least
> >> platform dependent. Hence defeats 0)
> >>
> >> With 2) we do not impose reboot to update. Some platform may impose
> >> reboot or some designers will prefer reboot. We say that there is a
> >> chain of responsibility for updates.
> >> So it is perfectly OK to have a Linux software agent receive an update
> >> by any mean (network, USB, serial...). The agent will pack this (or
> >> those) into a capsule and push it to UEFI implementation.
> >> The UEFI implementation (U-Boot or Tianocore) will then do whatever it
> >> pleases for the update providing it complies with 1) So the UEFI
> >> implementation can live update up to BL33 firmware.
> >> Should the update be targeted to secure world, then the UEFI
> >> implementation can pass it to S-EL3 for update (platform specific)
> >> which means the update can also be live. It is a designer decision.
> >>
> >> With 3) we have flexibility but sometimes too much flexibility is a
> >> problem. Alexander Graf suggested we can use a FIT object to pass
> >> diverse objects. It is "half" opaque but I really like the idea.
> >> The contents of individual FIT components can be blocks to be placed
> >> at a fix location in a NOR flash or a file, no importance.
> >>
> >> What do everyone think about those design principles ?
> >>
> >
> > UEFI and capsules can be fine for those platform that support it (and
> > it's still a rare feature) and for stuff like boot and peripheral
> > firmware. I don't think it's a wise, future-proof idea to use it for
> more.
> >
> > UEFI is not a very healthy ecosystem yet, and I'm personally skeptical
> > it will evolve towards that (looking at that as both a user as well as
> > an OEM). It's not even present in quite a few of our use cases. In some
> > it will never be - think of safety-critical system: not affordable with
> > such a complex approach like UEFI.
>
> Can I challenge that view a bit? On the Tianocore side I agree that the
> ecosystem isn't very healthy. That project in particular struggles with
> what to do with board support, having decided early on that board
> support generally doesn't need to be in the main repository.
>
> However, U-Boot support for the UEFI ABI is improving in leaps and
> bounds. SUSE and Fedora both depend on U-Boot UEFI for booting on all
> the Arm SBCs that they support, and enabling UEFI in U-Boot is just a
> config option or two. There is a fair bit of encouragement from within
> the project to enable UEFI by default.
>
> UEFI gets a bad rap at being complicated, but I think the U-Boot work
> has shown that implementing the core UEFI ABI doesn't require much code
> and isn't the complicated mess they everyone fears it to be.
>
> I don't see the conflict with safety critical for boot services. I can
> however see the arguement against UEFI runtime services as a poor
> implementation could result in unbounded 

Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread Christian Storm
Hi,

> > > Background: during the last Linaro connect in Bangkok I was told
> > > that Linaro Edge (LEDGE) were working on a secure software update
> > > mechanism based on UEFI capsules that would flash firmware updates
> > > from a UEFI application, instead of using a Linux agent such as
> > > SWUpdate.
> > 
> > How would capsules help with writing to arbitrary storage, updating
> > only files on filesystem, reducing the update size (binary diffs),
> > or talking to the cloud?
> 
> - arbitrary storage: I guess they can only write to what is supported
>   by the machine's UEFI implementation.
> 
> - updating only files on filesystem: I assume this is out of scope in
>   their architecture (Francois: do you want to support file-based
>   updates or only block-based ones?)

> - reducing the update size (binary diffs), or talking to the cloud:
>   they will do that from non-secure Linux. It would be dangerous to use
>   a fragile network stack from an UEFI application or the secure world.
>   In that sense, they also need a Linux agent.

If I understand the idea correctly, there's then a Linux companion agent
that does, e.g., the cloud communication and sets up the update payload
to be consumed and applied by the UEFI firmware update application. The
actual update action will take place on reboot, e.g., flashing the
inactive partition in an A/B setup and thereafter booting into the newly
flashed, then active partition.

If so, this would prolong the time the system is unavailable due to disk
flashing I/O in the UEFI firmware update application compared to flashing
the inactive partition from within Linux and have the bootloader just
switch the to be booted partitions.

Generally, but in particular regarding binary diffs, a binary diff
application mechanism would have to be implemented and maintained in the
UEFI realm as opposed to "just" using the respective shared libraries
(e.g. librsync, casync, ...) in the Linux realm. Granted, one could
come up with a unified format to which the output of, e.g, librsync's rdiff
or a casync run is converted but nonetheless, this creates some porting/
implementation and maintenance effort.


Kind regards,
   Christian

-- 
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Otto-Hahn-Ring 6, 81739 München, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread Francois Ozog
On Fri, 26 Apr 2019 at 10:30, Christian Storm
 wrote:
>
> Hi,
>
> > > > Background: during the last Linaro connect in Bangkok I was told
> > > > that Linaro Edge (LEDGE) were working on a secure software update
> > > > mechanism based on UEFI capsules that would flash firmware updates
> > > > from a UEFI application, instead of using a Linux agent such as
> > > > SWUpdate.
> > >
> > > How would capsules help with writing to arbitrary storage, updating
> > > only files on filesystem, reducing the update size (binary diffs),
> > > or talking to the cloud?
> >

See below
>
> > - arbitrary storage: I guess they can only write to what is supported
> >   by the machine's UEFI implementation.
> >

Yes, see below
>
> > - updating only files on filesystem: I assume this is out of scope in
> >   their architecture (Francois: do you want to support file-based
> >   updates or only block-based ones?)
>
Both, see below
>
> > - reducing the update size (binary diffs), or talking to the cloud:
> >   they will do that from non-secure Linux. It would be dangerous to use
> >   a fragile network stack from an UEFI application or the secure world.
> >   In that sense, they also need a Linux agent.
>
> If I understand the idea correctly, there's then a Linux companion agent
> that does, e.g., the cloud communication and sets up the update payload
> to be consumed and applied by the UEFI firmware update application. The
> actual update action will take place on reboot, e.g., flashing the
> inactive partition in an A/B setup and thereafter booting into the newly
> flashed, then active partition.
>
> If so, this would prolong the time the system is unavailable due to disk
> flashing I/O in the UEFI firmware update application compared to flashing
> the inactive partition from within Linux and have the bootloader just
> switch the to be booted partitions.
>
> Generally, but in particular regarding binary diffs, a binary diff
> application mechanism would have to be implemented and maintained in the
> UEFI realm as opposed to "just" using the respective shared libraries
> (e.g. librsync, casync, ...) in the Linux realm. Granted, one could
> come up with a unified format to which the output of, e.g, librsync's rdiff
> or a casync run is converted but nonetheless, this creates some porting/
> implementation and maintenance effort.
>
>
Here are the guiding principles of our efforts :
0) we want a cross architecture (x86/Arm/...), cross vendor and cross
processor model update solution
1) untrusted world cannot update trusted world
2) what the UEFI implementation does with the capsule is platform specific
3) the update capsule payload is opaque

1) is a "philosophy" decision. When you have a root of trust down to
the operating system. So in theory everything should be fine. But the
attack surface is such that we can't rule out hacking (and history
prove this is unfortunately a safe assumption). In addition, there may
be liability aspects related to the who does the update: the hardware
platform administrator may not be the legal entity than the operating
system administrator. For instance:
-  on Packet.net could, a customer can flash up to the BL33 untrusted
firmware but that is all.
- A surveillance camera can be operated by city personnel but only law
enforcement agency can see raw video (un-blurred faces and licence
plates). This can be implemented by a derivative of OPTEE SecureMedia
Path but if you allow untrusted world to update the trusted one, city
personnel can overcome the legal restriction.
With 1) this means that even U-Boot code shall not be able/allowed to
update S-EL3 firmware (be it Trusted Firmware A or something else),
Secure EL1/0 software (OPTEE and its applications or something else).
If possible, allowing the operating system administrator to
selectively (BL33 is OK but not S-EL3) update firmware is at least
platform dependent. Hence defeats 0)

With 2) we do not impose reboot to update. Some platform may impose
reboot or some designers will prefer reboot. We say that there is a
chain of responsibility for updates.
So it is perfectly OK to have a Linux software agent receive an update
by any mean (network, USB, serial...). The agent will pack this (or
those) into a capsule and push it to UEFI implementation.
The UEFI implementation (U-Boot or Tianocore) will then do whatever it
pleases for the update providing it complies with 1) So the UEFI
implementation can live update up to BL33 firmware.
Should the update be targeted to secure world, then the UEFI
implementation can pass it to S-EL3 for update (platform specific)
which means the update can also be live. It is a designer decision.

With 3) we have flexibility but sometimes too much flexibility is a
problem. Alexander Graf suggested we can use a FIT object to pass
diverse objects. It is "half" opaque but I really like the idea.
The contents of individual FIT components can be blocks to be placed
at a fix location in a NOR flash or a file, no importance.

What 

Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread daniel.sangorrin
Hi Jan, Francois:

Grant: thanks!

> From: Jan Kiszka 
> On 24.04.19 03:23, daniel.sangor...@toshiba.co.jp wrote:
> > Hello Francois, Jan, Christian, and all
> >  EFI Boot Guard is now shipped in quite a few devices, to my knowledge not 
> > only at
> > Sorry for the late reply, I was waiting for the administrator of the Boot 
> > Architecture mailing list to accept my
> subscription request, but it seems it will take a bit more time. I will send 
> this reply and hope it will not be blocked.
> I have also added the u-boot mailing list to Cc, as Tom suggested (although 
> I'm not a member), the CIP mailing
> list, Jan Kiszka (one of the main developers of Efibootguard) and Christian 
> (an expert in software updates).
> >
> > Background: during the last Linaro connect in Bangkok I was told that 
> > Linaro Edge (LEDGE) were working on
> a secure software update mechanism based on UEFI capsules that would flash 
> firmware updates from a UEFI
> application, instead of using a Linux agent such as SWUpdate.
> 
> How would capsules help with writing to arbitrary storage, updating only files
> on filesystem, reducing the update size (binary diffs), or talking to the 
> cloud?

- arbitrary storage: I guess they can only write to what is supported by the 
machine's UEFI implementation.
- updating only files on filesystem: I assume this is out of scope in their 
architecture (Francois: do you want to support file-based updates or only 
block-based ones?)
- reducing the update size (binary diffs), or talking to the cloud: they will 
do that from non-secure Linux. It would be dangerous to use a fragile network 
stack from an UEFI application or the secure world. In that sense, they also 
need a Linux agent.

I believe that LEDGE is looking for a software update method that works the 
same on any machine (that supports UEFI). To do that they want to use the UEFI 
interfaces/services. They also want the ability to update the TrustZone secure 
world (you can't do that unless you have enough privileges).

> > As far as I know, there is no concept of "Secure Booting" in Efibootguard 
> > at the moment. Adding signature
> checks before booting into the selected kernel would be a possible solution.
> 
> Secure boot is a pending feature on our to-do list. It's a bit more 
> complicated
> than that, like secure boot is "a bit" more complicated than you think once 
> you
> actually try to implement it. Once we do that, it's really about adding
> signature checks or relying on UEFI validating the payloads we boot for us 
> PLUS
> ensuring the our config sections can either be validated (despite being
> volatile) or split the security-wise critical parts (specifically EFI payload
> parameters) from the less critical ones (update states) and remove the latter
> from the validation.

I suppose that those "bits" are hard to predict until you start the 
implementation. From an architectural point of view, I guess that the 
"revision" variables will need to be secured to avoid downgrades (e.g. an 
attacker causing a rollback to a previous revision of the OS image). 

> BTW, what we do in EFI Board Guard could also be done in any other UEFI
> bootloader, may it be grub (if you like to use that complex and fragile beast 
> in
> production), systemd-boot or even TianoCore. But for now, it was easier - and
> more robust - to add our requirements in form of this tiny bootloader to the
> ecosystem. EFI Boot Guard is now shipped in quite a few devices, to my best
> knowledge not only at Siemens.

Jan: do you have a schedule or a list of tasks that need to be done?
Francois: what direction should we take from here?

Thanks,
Daniel

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread Grant Likely
On 26/04/2019 10:49, Jan Kiszka wrote:
> On 26.04.19 11:07, Francois Ozog wrote:
[...]
>> Here are the guiding principles of our efforts :
>> 0) we want a cross architecture (x86/Arm/...), cross vendor and cross
>> processor model update solution
>> 1) untrusted world cannot update trusted world
> 
> Conceptually, it can. It's a matter of validating the update by the 
> trusted world before using it. A trusted instance can allow an untrusted 
> one to write version 2, validate that before switching to it, and stick 
> with version 1 if that fails.
> 
>> 2) what the UEFI implementation does with the capsule is platform 
>> specific
>> 3) the update capsule payload is opaque
>>
>> 1) is a "philosophy" decision. When you have a root of trust down to
>> the operating system. So in theory everything should be fine. But the
>> attack surface is such that we can't rule out hacking (and history
>> prove this is unfortunately a safe assumption). In addition, there may
>> be liability aspects related to the who does the update: the hardware
>> platform administrator may not be the legal entity than the operating
>> system administrator. For instance:
>> -  on Packet.net could, a customer can flash up to the BL33 untrusted
>> firmware but that is all.
>> - A surveillance camera can be operated by city personnel but only law
>> enforcement agency can see raw video (un-blurred faces and licence
>> plates). This can be implemented by a derivative of OPTEE SecureMedia
>> Path but if you allow untrusted world to update the trusted one, city
>> personnel can overcome the legal restriction.
>> With 1) this means that even U-Boot code shall not be able/allowed to
>> update S-EL3 firmware (be it Trusted Firmware A or something else),
>> Secure EL1/0 software (OPTEE and its applications or something else).
>> If possible, allowing the operating system administrator to
>> selectively (BL33 is OK but not S-EL3) update firmware is at least
>> platform dependent. Hence defeats 0)
>>
>> With 2) we do not impose reboot to update. Some platform may impose
>> reboot or some designers will prefer reboot. We say that there is a
>> chain of responsibility for updates.
>> So it is perfectly OK to have a Linux software agent receive an update
>> by any mean (network, USB, serial...). The agent will pack this (or
>> those) into a capsule and push it to UEFI implementation.
>> The UEFI implementation (U-Boot or Tianocore) will then do whatever it
>> pleases for the update providing it complies with 1) So the UEFI
>> implementation can live update up to BL33 firmware.
>> Should the update be targeted to secure world, then the UEFI
>> implementation can pass it to S-EL3 for update (platform specific)
>> which means the update can also be live. It is a designer decision.
>>
>> With 3) we have flexibility but sometimes too much flexibility is a
>> problem. Alexander Graf suggested we can use a FIT object to pass
>> diverse objects. It is "half" opaque but I really like the idea.
>> The contents of individual FIT components can be blocks to be placed
>> at a fix location in a NOR flash or a file, no importance.
>>
>> What do everyone think about those design principles ?
>>
> 
> UEFI and capsules can be fine for those platform that support it (and 
> it's still a rare feature) and for stuff like boot and peripheral 
> firmware. I don't think it's a wise, future-proof idea to use it for more.
> 
> UEFI is not a very healthy ecosystem yet, and I'm personally skeptical 
> it will evolve towards that (looking at that as both a user as well as 
> an OEM). It's not even present in quite a few of our use cases. In some 
> it will never be - think of safety-critical system: not affordable with 
> such a complex approach like UEFI.

Can I challenge that view a bit? On the Tianocore side I agree that the 
ecosystem isn't very healthy. That project in particular struggles with 
what to do with board support, having decided early on that board 
support generally doesn't need to be in the main repository.

However, U-Boot support for the UEFI ABI is improving in leaps and 
bounds. SUSE and Fedora both depend on U-Boot UEFI for booting on all 
the Arm SBCs that they support, and enabling UEFI in U-Boot is just a 
config option or two. There is a fair bit of encouragement from within 
the project to enable UEFI by default.

UEFI gets a bad rap at being complicated, but I think the U-Boot work 
has shown that implementing the core UEFI ABI doesn't require much code 
and isn't the complicated mess they everyone fears it to be.

I don't see the conflict with safety critical for boot services. I can 
however see the arguement against UEFI runtime services as a poor 
implementation could result in unbounded execution times. There's been 
recent movement on the UEFI spec to make runtime services optional, and 
in U-Boot they are mostly empty stubs.

> It should not expand further into OS 
> domains. Updating complete filesystems and their content is beyond its 
> 

Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-26 Thread Jan Kiszka

On 26.04.19 11:07, Francois Ozog wrote:

On Fri, 26 Apr 2019 at 10:30, Christian Storm
 wrote:


Hi,


Background: during the last Linaro connect in Bangkok I was told
that Linaro Edge (LEDGE) were working on a secure software update
mechanism based on UEFI capsules that would flash firmware updates
from a UEFI application, instead of using a Linux agent such as
SWUpdate.


How would capsules help with writing to arbitrary storage, updating
only files on filesystem, reducing the update size (binary diffs),
or talking to the cloud?




See below



- arbitrary storage: I guess they can only write to what is supported
   by the machine's UEFI implementation.



Yes, see below



- updating only files on filesystem: I assume this is out of scope in
   their architecture (Francois: do you want to support file-based
   updates or only block-based ones?)



Both, see below



- reducing the update size (binary diffs), or talking to the cloud:
   they will do that from non-secure Linux. It would be dangerous to use
   a fragile network stack from an UEFI application or the secure world.
   In that sense, they also need a Linux agent.


If I understand the idea correctly, there's then a Linux companion agent
that does, e.g., the cloud communication and sets up the update payload
to be consumed and applied by the UEFI firmware update application. The
actual update action will take place on reboot, e.g., flashing the
inactive partition in an A/B setup and thereafter booting into the newly
flashed, then active partition.

If so, this would prolong the time the system is unavailable due to disk
flashing I/O in the UEFI firmware update application compared to flashing
the inactive partition from within Linux and have the bootloader just
switch the to be booted partitions.

Generally, but in particular regarding binary diffs, a binary diff
application mechanism would have to be implemented and maintained in the
UEFI realm as opposed to "just" using the respective shared libraries
(e.g. librsync, casync, ...) in the Linux realm. Granted, one could
come up with a unified format to which the output of, e.g, librsync's rdiff
or a casync run is converted but nonetheless, this creates some porting/
implementation and maintenance effort.



Here are the guiding principles of our efforts :
0) we want a cross architecture (x86/Arm/...), cross vendor and cross
processor model update solution
1) untrusted world cannot update trusted world


Conceptually, it can. It's a matter of validating the update by the trusted 
world before using it. A trusted instance can allow an untrusted one to write 
version 2, validate that before switching to it, and stick with version 1 if 
that fails.



2) what the UEFI implementation does with the capsule is platform specific
3) the update capsule payload is opaque

1) is a "philosophy" decision. When you have a root of trust down to
the operating system. So in theory everything should be fine. But the
attack surface is such that we can't rule out hacking (and history
prove this is unfortunately a safe assumption). In addition, there may
be liability aspects related to the who does the update: the hardware
platform administrator may not be the legal entity than the operating
system administrator. For instance:
-  on Packet.net could, a customer can flash up to the BL33 untrusted
firmware but that is all.
- A surveillance camera can be operated by city personnel but only law
enforcement agency can see raw video (un-blurred faces and licence
plates). This can be implemented by a derivative of OPTEE SecureMedia
Path but if you allow untrusted world to update the trusted one, city
personnel can overcome the legal restriction.
With 1) this means that even U-Boot code shall not be able/allowed to
update S-EL3 firmware (be it Trusted Firmware A or something else),
Secure EL1/0 software (OPTEE and its applications or something else).
If possible, allowing the operating system administrator to
selectively (BL33 is OK but not S-EL3) update firmware is at least
platform dependent. Hence defeats 0)

With 2) we do not impose reboot to update. Some platform may impose
reboot or some designers will prefer reboot. We say that there is a
chain of responsibility for updates.
So it is perfectly OK to have a Linux software agent receive an update
by any mean (network, USB, serial...). The agent will pack this (or
those) into a capsule and push it to UEFI implementation.
The UEFI implementation (U-Boot or Tianocore) will then do whatever it
pleases for the update providing it complies with 1) So the UEFI
implementation can live update up to BL33 firmware.
Should the update be targeted to secure world, then the UEFI
implementation can pass it to S-EL3 for update (platform specific)
which means the update can also be live. It is a designer decision.

With 3) we have flexibility but sometimes too much flexibility is a
problem. Alexander Graf suggested we can use a FIT object to pass
diverse objects. It is "half" opaque 

Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-24 Thread Grant Likely
On 24/04/2019 02:23, daniel.sangor...@toshiba.co.jp wrote:
> Hello Francois, Jan, Christian, and all
> 
> Sorry for the late reply, I was waiting for the administrator of the Boot 
> Architecture mailing list to accept my subscription request, but it seems it 
> will take a bit more time. I will send this reply and hope it will not be 
> blocked. I have also added the u-boot mailing list to Cc, as Tom suggested 
> (although I'm not a member), the CIP mailing list, Jan Kiszka (one of the 
> main developers of Efibootguard) and Christian (an expert in software 
> updates).

Hmmm, that's weird. The boot-architecture list doesn't require approval 
to subscribe. It just requires confirmation of email address. I think 
there is a problem with lists.linaro.org. I'll send an IT support 
request to Linaro.

Regardless, I've approved this post and added you to the allowed senders 
list. You can post freely. :-)

g.

> Background: during the last Linaro connect in Bangkok I was told that Linaro 
> Edge (LEDGE) were working on a secure software update mechanism based on UEFI 
> capsules that would flash firmware updates from a UEFI application, instead 
> of using a Linux agent such as SWUpdate. Then, I had an online meeting with 
> Francois, director of LEDGE. I explained to Francois that in CIP we are using 
> the Linux agent approach right now, and we are also considering the use of a 
> UEFI application (Efibootguard) to arm a watchdog and deal with the 
> state-machine variables (installed, testing, ok, failed..) needed for A/B 
> software updates. Efibootguard sounds like an excellent place to collaborate 
> with Linaro (particularly on the watchdog drivers front) because it does not 
> strictly depend on where the firmware is flashed (UEFI capsule or Linux 
> agent).
> 
>> On Fri, Apr 19, 2019 at 12:48:51PM +0200, Francois Ozog wrote:
>>> Hi Daniel,
>>>
>>> We will be conducting a UEFI gap analysis to support EFIBootGuard in U-Boot.
>>>
>>> As we are working on UEFI SecureBoot implementation in U-Boot, how do
>>> you expect the boot process to be secured? Would U-Boot UEFI
>>> SecureBoot verify EFIBootGuard signature and in turn EFIBootGuard will
>>> check either grub or Linux signature?
>>>
>>> Please elaborate on your vision of a secured boot process.
> 
> Efibootguard is composed of two parts.
>- A UEFI application that can arm a watchdog and decide what environment 
> (kernel, boot args, etc.) to use next depending on a set of variables (update 
> status, highest revision, etc.) stored in FAT16 partitions.
>- A Linux application that can read and set those variables from Linux 
> (similar to u-boot's fw_setenv). This functionality is also available in the 
> form of a library.
> 
> As far as I know, there is no concept of "Secure Booting" in Efibootguard at 
> the moment. Adding signature checks before booting into the selected kernel 
> would be a possible solution.
> 
> Thanks,
> Daniel
> 
> 
> 
> ___
> boot-architecture mailing list
> boot-architect...@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/boot-architecture
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-24 Thread Jan Kiszka

[prolonging the CCs with the efibootguard mailing list]

On 24.04.19 03:23, daniel.sangor...@toshiba.co.jp wrote:

Hello Francois, Jan, Christian, and all
 EFI Boot Guard is now shipped in quite a few devices, to my knowledge not only at 
Sorry for the late reply, I was waiting for the administrator of the Boot Architecture mailing list to accept my subscription request, but it seems it will take a bit more time. I will send this reply and hope it will not be blocked. I have also added the u-boot mailing list to Cc, as Tom suggested (although I'm not a member), the CIP mailing list, Jan Kiszka (one of the main developers of Efibootguard) and Christian (an expert in software updates).


Background: during the last Linaro connect in Bangkok I was told that Linaro 
Edge (LEDGE) were working on a secure software update mechanism based on UEFI 
capsules that would flash firmware updates from a UEFI application, instead of 
using a Linux agent such as SWUpdate.


How would capsules help with writing to arbitrary storage, updating only files 
on filesystem, reducing the update size (binary diffs), or talking to the cloud?



Then, I had an online meeting with Francois, director of LEDGE. I explained to 
Francois that in CIP we are using the Linux agent approach right now, and we 
are also considering the use of a UEFI application (Efibootguard) to arm a 
watchdog and deal with the state-machine variables (installed, testing, ok, 
failed..) needed for A/B software updates. Efibootguard sounds like an 
excellent place to collaborate with Linaro (particularly on the watchdog 
drivers front) because it does not strictly depend on where the firmware is 
flashed (UEFI capsule or Linux agent).


On Fri, Apr 19, 2019 at 12:48:51PM +0200, Francois Ozog wrote:

Hi Daniel,

We will be conducting a UEFI gap analysis to support EFIBootGuard in U-Boot.

As we are working on UEFI SecureBoot implementation in U-Boot, how do
you expect the boot process to be secured? Would U-Boot UEFI
SecureBoot verify EFIBootGuard signature and in turn EFIBootGuard will
check either grub or Linux signature?

Please elaborate on your vision of a secured boot process.


Efibootguard is composed of two parts.
   - A UEFI application that can arm a watchdog and decide what environment 
(kernel, boot args, etc.) to use next depending on a set of variables (update 
status, highest revision, etc.) stored in FAT16 partitions.
   - A Linux application that can read and set those variables from Linux 
(similar to u-boot's fw_setenv). This functionality is also available in the 
form of a library.

As far as I know, there is no concept of "Secure Booting" in Efibootguard at 
the moment. Adding signature checks before booting into the selected kernel would be a 
possible solution.


Secure boot is a pending feature on our to-do list. It's a bit more complicated 
than that, like secure boot is "a bit" more complicated than you think once you 
actually try to implement it. Once we do that, it's really about adding 
signature checks or relying on UEFI validating the payloads we boot for us PLUS 
ensuring the our config sections can either be validated (despite being 
volatile) or split the security-wise critical parts (specifically EFI payload 
parameters) from the less critical ones (update states) and remove the latter 
from the validation.


BTW, what we do in EFI Board Guard could also be done in any other UEFI 
bootloader, may it be grub (if you like to use that complex and fragile beast in 
production), systemd-boot or even TianoCore. But for now, it was easier - and 
more robust - to add our requirements in form of this tiny bootloader to the 
ecosystem. EFI Boot Guard is now shipped in quite a few devices, to my best 
knowledge not only at Siemens.


Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] EFIBootGuard for CIP and SecureBoot

2019-04-23 Thread daniel.sangorrin
Hello Francois, Jan, Christian, and all

Sorry for the late reply, I was waiting for the administrator of the Boot 
Architecture mailing list to accept my subscription request, but it seems it 
will take a bit more time. I will send this reply and hope it will not be 
blocked. I have also added the u-boot mailing list to Cc, as Tom suggested 
(although I'm not a member), the CIP mailing list, Jan Kiszka (one of the main 
developers of Efibootguard) and Christian (an expert in software updates).

Background: during the last Linaro connect in Bangkok I was told that Linaro 
Edge (LEDGE) were working on a secure software update mechanism based on UEFI 
capsules that would flash firmware updates from a UEFI application, instead of 
using a Linux agent such as SWUpdate. Then, I had an online meeting with 
Francois, director of LEDGE. I explained to Francois that in CIP we are using 
the Linux agent approach right now, and we are also considering the use of a 
UEFI application (Efibootguard) to arm a watchdog and deal with the 
state-machine variables (installed, testing, ok, failed..) needed for A/B 
software updates. Efibootguard sounds like an excellent place to collaborate 
with Linaro (particularly on the watchdog drivers front) because it does not 
strictly depend on where the firmware is flashed (UEFI capsule or Linux agent). 

> On Fri, Apr 19, 2019 at 12:48:51PM +0200, Francois Ozog wrote:
> > Hi Daniel,
> >
> > We will be conducting a UEFI gap analysis to support EFIBootGuard in U-Boot.
> >
> > As we are working on UEFI SecureBoot implementation in U-Boot, how do
> > you expect the boot process to be secured? Would U-Boot UEFI
> > SecureBoot verify EFIBootGuard signature and in turn EFIBootGuard will
> > check either grub or Linux signature?
> >
> > Please elaborate on your vision of a secured boot process.

Efibootguard is composed of two parts.
  - A UEFI application that can arm a watchdog and decide what environment 
(kernel, boot args, etc.) to use next depending on a set of variables (update 
status, highest revision, etc.) stored in FAT16 partitions.
  - A Linux application that can read and set those variables from Linux 
(similar to u-boot's fw_setenv). This functionality is also available in the 
form of a library.

As far as I know, there is no concept of "Secure Booting" in Efibootguard at 
the moment. Adding signature checks before booting into the selected kernel 
would be a possible solution. 

Thanks,
Daniel



___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot