README.mxc_hab 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. High Assurance Boot (HAB) for i.MX6 CPUs
  2. To enable the authenticated or encrypted boot mode of U-Boot, it is
  3. required to set the proper configuration for the target board. This
  4. is done by adding the following configuration in in the proper config
  5. file (e.g. include/configs/mx6qarm2.h)
  6. #define CONFIG_SECURE_BOOT
  7. In addition, the U-Boot image to be programmed into the
  8. boot media needs to be properly constructed, i.e. it must contain a
  9. proper Command Sequence File (CSF).
  10. The Initial Vector Table contains a pointer to the CSF. Please see
  11. doc/README.imximage for how to prepare u-boot.imx.
  12. The CSF itself is being generated by Freescale HAB tools.
  13. mkimage will output additional information about "HAB Blocks"
  14. which can be used in the Freescale tooling to authenticate U-Boot
  15. (entries in the CSF file).
  16. Image Type: Freescale IMX Boot Image
  17. Image Ver: 2 (i.MX53/6 compatible)
  18. Data Size: 327680 Bytes = 320.00 kB = 0.31 MB
  19. Load Address: 177ff420
  20. Entry Point: 17800000
  21. HAB Blocks: 177ff400 00000000 0004dc00
  22. ^^^^^^^^ ^^^^^^^^ ^^^^^^^^
  23. | | |
  24. | | -------- (1)
  25. | |
  26. | ------------------- (2)
  27. |
  28. --------------------------- (3)
  29. (1) Size of area in file u-boot.imx to sign
  30. This area should include the IVT, the Boot Data the DCD
  31. and U-Boot itself.
  32. (2) Start of area in u-boot.imx to sign
  33. (3) Start of area in RAM to authenticate
  34. CONFIG_SECURE_BOOT currently enables only an additional command
  35. 'hab_status' in U-Boot to retrieve the HAB status and events. This
  36. can be useful while developing and testing HAB.
  37. Commands to generate a signed U-Boot using Freescale HAB tools:
  38. cst --o U-Boot_CSF.bin < U-Boot.CSF
  39. objcopy -I binary -O binary --pad-to 0x2000 --gap-fill=0x00 \
  40. U-Boot_CSF.bin U-Boot_CSF_pad.bin
  41. cat u-boot.imx U-Boot_CSF_pad.bin > u-boot-signed.imx
  42. NOTE: U-Boot_CSF.bin needs to be padded to the value specified in
  43. the imximage.cfg file.
  44. Setup U-Boot Image for Encrypted Boot
  45. -------------------------------------
  46. An authenticated U-Boot image is used as starting point for
  47. Encrypted Boot. The image is encrypted by Freescale's Code
  48. Signing Tool (CST). The CST replaces only the image data of
  49. u-boot.imx with the encrypted data. The Initial Vector Table,
  50. DCD, and Boot data, remains in plaintext.
  51. The image data is encrypted with a Encryption Key (DEK).
  52. Therefore, this key is needed to decrypt the data during the
  53. booting process. The DEK is protected by wrapping it in a Blob,
  54. which needs to be appended to the U-Boot image and specified in
  55. the CSF file.
  56. The DEK blob is generated by an authenticated U-Boot image with
  57. the dek_blob cmd enabled. The image used for DEK blob generation
  58. needs to have the following configurations enabled:
  59. CONFIG_SECURE_BOOT
  60. CONFIG_SYS_FSL_SEC_COMPAT 4 /* HAB version */
  61. CONFIG_FSL_CAAM
  62. CONFIG_CMD_DEKBLOB
  63. CONFIG_SYS_FSL_SEC_LE
  64. Note: The encrypted boot feature is only supported by HABv4 or
  65. greater.
  66. The dek_blob command then can be used to generate the DEK blob of
  67. a DEK previously loaded in memory. The command is used as follows:
  68. dek_blob <DEK address> <Output Address> <Key Size in Bits>
  69. example: dek_blob 0x10800000 0x10801000 192
  70. The resulting DEK blob then is used to construct the encrypted
  71. U-Boot image. Note that the blob needs to be transferred back
  72. to the host.Then the following commands are used to construct
  73. the final image.
  74. objcopy -I binary -O binary --pad-to 0x2000 --gap-fill=0x00 \
  75. U-Boot_CSF.bin U-Boot_CSF_pad.bin
  76. cat u-boot.imx U-Boot_CSF_pad.bin > u-boot-signed.imx
  77. objcopy -I binary -O binary --pad-to <blob_dst> --gap-fill=0x00 \
  78. u-boot-signed.imx u-boot-signed-pad.bin
  79. cat u-boot-signed-pad.imx DEK_blob.bin > u-boot-encrypted.imx
  80. NOTE: u-boot-signed.bin needs to be padded to the value
  81. equivalent to the address in which the DEK blob is specified
  82. in the CSF.