Skip to contentSkip to conversation

Injecting public keys into FTDs for FIT verification

DISCUSSION Jan Kiszka 3 participants 5 messages Nov 5, 2021

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Hi all,

in order to use CONFIG_FIT_SIGNATURE and also CONFIG_SPL_FIT_SIGNATURE, a public key needs to be placed into the control FDT. So far, I only found mkimage being able to do that during FIT image signing. That is fairly unhandy and often incompatible with how firmware is built & signed vs. how the lifecycle of the artifacts to be loaded and verified look like. Is there really no other way than mkimage -K?

I'm currently considering to derive a tool that, given a public key (which is easy to hand around, compared to the private key needed for signing), injects them into a FDT. Then I would hook that up as generic feature for U-Boot builds, enriching all control FTDs already during the first build with this when requested.

Am I missing an even simpler approach?

Thanks,
Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#1 lore raw
Quoted 10 lines · Jan Kiszka

Hi all,

in order to use CONFIG_FIT_SIGNATURE and also CONFIG_SPL_FIT_SIGNATURE, a public key needs to be placed into the control FDT. So far, I only found mkimage being able to do that during FIT image signing. That is fairly unhandy and often incompatible with how firmware is built & signed vs. how the lifecycle of the artifacts to be loaded and verified look like. Is there really no other way than mkimage -K?

Quoted 7 lines

I'm currently considering to derive a tool that, given a public key (which is easy to hand around, compared to the private key needed for signing), injects them into a FDT. Then I would hook that up as generic feature for U-Boot builds, enriching all control FTDs already during the first build with this when requested.

Am I missing an even simpler approach?

You're not missing an existing upstream simpler approach, but it's certainly an itch that others have had [1] [2]. My latest attempt

https://lore.kernel.org/u-boot/[email protected]/

does now have an R-b by Simon, so now I'm just waiting for that to actually make it into master. I have the script(s) that will convert a public key to a .dtsi fragment, and I'm happy to share that.

Rasmus

[1]
https://lore.kernel.org/u-boot/CAO5Uq5TyTMacERo01weTEda-5X4Fx-VUoYFHa=mBYhW-RvmVSQ@mail.gmail.com/
[2]
https://lore.kernel.org/u-boot/[email protected]/

author
#2 lore raw
Quoted 19 lines · Rasmus Villemoes
Quoted 10 lines · Jan Kiszka

Hi all,

in order to use CONFIG_FIT_SIGNATURE and also CONFIG_SPL_FIT_SIGNATURE, a public key needs to be placed into the control FDT. So far, I only found mkimage being able to do that during FIT image signing. That is fairly unhandy and often incompatible with how firmware is built & signed vs. how the lifecycle of the artifacts to be loaded and verified look like. Is there really no other way than mkimage -K?

Quoted 7 lines

I'm currently considering to derive a tool that, given a public key (which is easy to hand around, compared to the private key needed for signing), injects them into a FDT. Then I would hook that up as generic feature for U-Boot builds, enriching all control FTDs already during the first build with this when requested.

Am I missing an even simpler approach?

Quoted 9 lines

You're not missing an existing upstream simpler approach, but it's certainly an itch that others have had [1] [2]. My latest attempt

https://lore.kernel.org/u-boot/[email protected]/

does now have an R-b by Simon, so now I'm just waiting for that to actually make it into master. I have the script(s) that will convert a public key to a .dtsi fragment, and I'm happy to share that.

Cool, that would be very welcome!

Jan

Quoted 7 lines

Rasmus

[1]
https://lore.kernel.org/u-boot/CAO5Uq5TyTMacERo01weTEda-5X4Fx-VUoYFHa=mBYhW-RvmVSQ@mail.gmail.com/
[2]
https://lore.kernel.org/u-boot/[email protected]/

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
author
#3 lore raw
Quoted 18 lines · Jan Kiszka
Quoted 17 lines · Rasmus Villemoes
Quoted 16 lines · Jan Kiszka

Hi all,

in order to use CONFIG_FIT_SIGNATURE and also CONFIG_SPL_FIT_SIGNATURE, a public key needs to be placed into the control FDT. So far, I only found mkimage being able to do that during FIT image signing. That is fairly unhandy and often incompatible with how firmware is built & signed vs. how the lifecycle of the artifacts to be loaded and verified look like. Is there really no other way than mkimage -K?

I'm currently considering to derive a tool that, given a public key (which is easy to hand around, compared to the private key needed for signing), injects them into a FDT. Then I would hook that up as generic feature for U-Boot builds, enriching all control FTDs already during the first build with this when requested.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Am I missing an even simpler approach?

You're not missing an existing upstream simpler approach, but it's certainly an itch that others have had [1] [2]. My latest attempt

https://lore.kernel.org/u-boot/[email protected]/

Looking at this path: I would also need it for SPL, so that SPL can validate the container for the main U-Boot. Seems that is missing here, isn't it?

Jan

Quoted 17 lines
Quoted 4 lines

does now have an R-b by Simon, so now I'm just waiting for that to actually make it into master. I have the script(s) that will convert a public key to a .dtsi fragment, and I'm happy to share that.

Cool, that would be very welcome!

Jan

Quoted 7 lines

Rasmus

[1]
https://lore.kernel.org/u-boot/CAO5Uq5TyTMacERo01weTEda-5X4Fx-VUoYFHa=mBYhW-RvmVSQ@mail.gmail.com/
[2]
https://lore.kernel.org/u-boot/[email protected]/

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#4 lore raw

Hi,

Quoted 25 lines · Jan Kiszka
Quoted 23 lines · Jan Kiszka
Quoted 22 lines · Rasmus Villemoes
Quoted 10 lines · Jan Kiszka

Hi all,

in order to use CONFIG_FIT_SIGNATURE and also CONFIG_SPL_FIT_SIGNATURE, a public key needs to be placed into the control FDT. So far, I only found mkimage being able to do that during FIT image signing. That is fairly unhandy and often incompatible with how firmware is built & signed vs. how the lifecycle of the artifacts to be loaded and verified look like. Is there really no other way than mkimage -K?

Quoted 7 lines

I'm currently considering to derive a tool that, given a public key (which is easy to hand around, compared to the private key needed for signing), injects them into a FDT. Then I would hook that up as generic feature for U-Boot builds, enriching all control FTDs already during the first build with this when requested.

Am I missing an even simpler approach?

You're not missing an existing upstream simpler approach, but it's certainly an itch that others have had [1] [2]. My latest attempt

Quoted 15 lines
Quoted 2 lines
Quoted 2 lines

https://lore.kernel.org/u-boot/[email protected]/

Looking at this path: I would also need it for SPL, so that SPL can validate the container for the main U-Boot. Seems that is missing here, isn't it?

Jan

Quoted 6 lines
Quoted 4 lines

does now have an R-b by Simon, so now I'm just waiting for that to actually make it into master. I have the script(s) that will convert a public key to a .dtsi fragment, and I'm happy to share that.

Cool, that would be very welcome!

What I'd really like is a separate tool. It was sent as attachments but we are waiting for the author to send them as patches on the thread "Introduce CONFIG_DEVICE_TREE_INCLUDES".

BTW, Rasmus, some documentation on this patch would be helpful.

Regards,
Simon

Quoted 15 lines
Quoted 11 lines

Jan

Quoted 7 lines

Rasmus

[1]
https://lore.kernel.org/u-boot/CAO5Uq5TyTMacERo01weTEda-5X4Fx-VUoYFHa=mBYhW-RvmVSQ@mail.gmail.com/
[2]
https://lore.kernel.org/u-boot/[email protected]/

--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux