README.mxc_hab 3.5 KB

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