11. Setup U-Boot Image for Encrypted Boot 2---------------------------------------- 3An authenticated U-Boot image is used as starting point for 4Encrypted Boot. The image is encrypted by i.MX Code Signing 5Tool (CST). The CST replaces only the image data of 6u-boot-dtb.imx with the encrypted data. The Initial Vector Table, 7DCD, and Boot data, remains in plaintext. 8 9The image data is encrypted with a Encryption Key (DEK). 10Therefore, this key is needed to decrypt the data during the 11booting process. The DEK is protected by wrapping it in a Blob, 12which needs to be appended to the U-Boot image and specified in 13the CSF file. 14 15The DEK blob is generated by an authenticated U-Boot image with 16the dek_blob cmd enabled. The image used for DEK blob generation 17needs to have the following configurations enabled in Kconfig: 18 19CONFIG_SECURE_BOOT=y 20CONFIG_CMD_DEKBLOB=y 21 22Note: The encrypted boot feature is only supported by HABv4 or 23greater. 24 25The dek_blob command then can be used to generate the DEK blob of 26a DEK previously loaded in memory. The command is used as follows: 27 28dek_blob <DEK address> <Output Address> <Key Size in Bits> 29example: dek_blob 0x10800000 0x10801000 192 30 31The resulting DEK blob then is used to construct the encrypted 32U-Boot image. Note that the blob needs to be transferred back 33to the host.Then the following commands are used to construct 34the final image. 35 36cat u-boot-dtb.imx csf-u-boot.bin > u-boot-signed.imx 37objcopy -I binary -O binary --pad-to <blob_dst> --gap-fill=0x00 \ 38 u-boot-signed.imx u-boot-signed-pad.bin 39cat u-boot-signed-pad.imx DEK_blob.bin > u-boot-encrypted.imx 40 41 NOTE: u-boot-signed.bin needs to be padded to the value 42 equivalent to the address in which the DEK blob is specified 43 in the CSF. 44