Hello,
I am trying to integrate HAB with our iMX8MP SoM. I have followed instructions using:
- https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx/habv4/introduction_habv4.txt?h=imx...
and
- https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx/habv4/guides/mx8m_secure_boot.txt?...
However, I am seeing HAB events:
Verdin iMX8MP # hab_status
Secure boot disabled
HAB Configuration: 0xf0, HAB State: 0x66
--------- HAB Event 1 -----------------
event data:
0xdb 0x00 0x14 0x45 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x40 0x1f 0xdd 0xc0
0x00 0x00 0x00 0x20
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
--------- HAB Event 2 -----------------
event data:
0xdb 0x00 0x14 0x45 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x40 0x1f 0xcd 0xc0
0x00 0x00 0x00 0x04
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
--------- HAB Event 3 -----------------
event data:
0xdb 0x00 0x34 0x45 0x33 0x18 0xc0 0x00
0xca 0x00 0x2c 0x00 0x02 0xc5 0x1d 0x00
0x00 0x00 0x16 0x54 0x40 0x1f 0xcd 0xc0
0x00 0x00 0x10 0x20 0x40 0x20 0x00 0x00
0x00 0x0c 0x02 0xc8 0x40 0x2c 0x02 0xc8
0x00 0x00 0x79 0xa8 0x00 0x97 0x00 0x00
0x00 0x00 0xb2 0xa0
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_SIGNATURE (0x18)
CTX = HAB_CTX_COMMAND (0xC0)
ENG = HAB_ENG_ANY (0x00)
--------- HAB Event 4 -----------------
event data:
0xdb 0x00 0x34 0x45 0x33 0x18 0xc0 0x00
0xca 0x00 0x2c 0x00 0x02 0xc5 0x1d 0x00
0x00 0x00 0x16 0x54 0x40 0x1f 0xcd 0xc0
0x00 0x00 0x10 0x20 0x40 0x20 0x00 0x00
0x00 0x0c 0x02 0xc8 0x40 0x2c 0x02 0xc8
0x00 0x00 0x79 0xa8 0x00 0x97 0x00 0x00
0x00 0x00 0xb2 0xa0
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_SIGNATURE (0x18)
CTX = HAB_CTX_COMMAND (0xC0)
ENG = HAB_ENG_ANY (0x00)
For troubleshooting, I decided to sign each binary one step at a time:
- signing SPL only -> no HAB events
- + signing FIT IVT -> no HAB events
- + signing u-boot (u-boot-nodtb.bin) -> start getting HAB events
So it looks like the FIT image is having troubles being authenticated. Since SPL and first part of FIT (IVT) passes shows no issues, I assume my fuses are programmed correctly. My guess is the Authenticate Data block portion for u-boot and beyond is incorrect. Could there be an issue with the values generated from print_fit_hab?
This is my build log:
# make SOC=iMX8MP dtbs=imx8mp-verdin.dtb flash_evk_emmc_fastboot
....
========= OFFSET dump =========
Loader IMAGE:
header_image_off 0x0
dcd_off 0x0
image_off 0x40
csf_off 0x25200
spl hab block: 0x91ffc0 0x0 0x25200
Second Loader IMAGE:
sld_header_off 0x60000
sld_csf_off 0x61020
sld hab block: 0x401fcdc0 0x60000 0x1020
# make SOC=iMX8MP dtbs=imx8mp-verdin.dtb print_fit_hab
./../scripts/pad_image.sh tee.bin
Pad file tee.bin NOT found
./../scripts/pad_image.sh bl31.bin
./../scripts/pad_image.sh u-boot-nodtb.bin imx8mp-verdin.dtb
u-boot-nodtb.bin + imx8mp-verdin.dtb are padded to 818288
TEE_LOAD_ADDR=0x56000000 ATF_LOAD_ADDR=0x00970000 VERSION=v2 ./print_fit_hab.sh 0x60000 imx8mp-verdin.dtb
0x40200000 0x5B000 0xC02C8
0x402C02C8 0x11B2C8 0x79A8
0x970000 0x122C70 0xB2A0
Corresponding CSF authenticate blocks:
CSF SPL:
[Authenticate Data]
# Key slot index used to authenticate the image data
Verification index = 2
# Authenticate Start Address, Offset, Length and file
Blocks = 0x91ffc0 0x0 0x25200 "/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/git/imx-boot-verdin-imx8mp-sd.bin-flash_evk_emmc_fastboot"
CSF FIT:
[Authenticate Data]
# Key slot index used to authenticate the image data
Verification index = 2
# Authenticate Start Address, Offset, Length and file
Blocks = 0x401fcdc0 0x60000 0x1020 "/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/git/imx-boot-verdin-imx8mp-sd.bin-flash_evk_emmc_fastboot", \
0x40200000 0x5B000 0xC02C8 "/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/git/imx-boot-verdin-imx8mp-sd.bin-flash_evk_emmc_fastboot", \
0x402C02C8 0x11B2C8 0x79A8 "/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/git/imx-boot-verdin-imx8mp-sd.bin-flash_evk_emmc_fastboot", \
0x970000 0x122C70 0xB2A0 "/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/git/imx-boot-verdin-imx8mp-sd.bin-flash_evk_emmc_fastboot"
and commands to write to final binary:
SPL:
dd if=/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/flash_evk_emmc_fastboot-csf-spl.bin of=/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/git/imx-boot-verdin-imx8mp-sd.bin-flash_evk_emmc_fastboot-signed seek=152064 bs=1 conv=notrun
FIT
dd if=/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/flash_evk_emmc_fastboot-csf-fit.bin of=/home/dfedgebuild/repos/lc-edge/yocto-torizon2/build/tmp/work/verdin_imx8mp-tdx-linux/imx-boot/1.0-r0/git/imx-boot-verdin-imx8mp-sd.bin-flash_evk_emmc_fastboot-signed seek=397344 bs=1 conv=notrunc
I'm wondering if there is an issue with the print_fit_hab that could result in incorrect CSF for fit image?
Any help is appreciated.
Thanks
EDIT: update logs