FitImage signing with FIP enabled on STM32MP157C-DK2
Hi!
I am trying to have full secure booting on the stm32mp platform, using FIP and fitImage on a custom distribution built using Yocto with the meta-st-stm32mp layer.
I currently have a FIP containing u-boot booting on the board, that can then load and boot an unsigned fitImage.
I now want to enable fitImage signing. The signature verification in u-boot is enabled in u-boot's configuration, and u-boot devicetree has been extended to include a signature section, so that mkimage can insert the signing key for u-boot's to verify my fitImage.
The fitImage is signed with the key by setting the following variable in my machine configuration:
UBOOT_SIGN_ENABLE = "1"I checked that the image is indeed signed, and that a u-boot devicetree containing the key is in my deploy directory (I disabled the use of the "u-boot" subfolder with a bbappend on u-boot-stm32mp recipe).
The issue comes from the final dtb included in u-boot´s binary, before the FIP generation by fiptool. By the end of the kernel signing process (which also insert the key in a devicetree to be used by u-boot), the devicetree containing the key is different than the one compiled due to the layer meta-st-stm32mp additions to u-boot's compile step (which compiles a dtb per enabled devicetree in the machine configuration, in addition to the one normally compiled by the base u-boot recipe from poky which is used by kernel-fitimage.bbclass when signing the kernel). The devicetree used when building the FIP is one of those devicetrees compiled due to the append on the compile step of u-boot by the ST layer, which means the FIP won't use at all the updated devicetree with the key necessary to verify fitImages.
To give you an exemple, here the relevant files in my deploy directory:
u-boot-mp1-2020.10.r1-r0.dtb # The devicetree containing the key. The file name is in the variable UBOOT_DTB_IMAGE
u-boot-nodtb-stm32mp15.bin # The uboot binary without a devicetree
u-boot-stm32mp157c-dk2-trusted.dtb # The devicetree from the append on the compile/deploy steps, not containing the key, but that will end up in the FIP.Is there something I am missing, or another way to achieve full secure boot with FIP ? Is this something that was not tested with the layer ?
I would be happy to give more information to get to the bottom of this.
Thanks in advance
--
Guillaume Pagnoux
