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