verified-boot.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. U-Boot Verified Boot
  2. ====================
  3. Introduction
  4. ------------
  5. Verified boot here means the verification of all software loaded into a
  6. machine during the boot process to ensure that it is authorised and correct
  7. for that machine.
  8. Verified boot extends from the moment of system reset to as far as you wish
  9. into the boot process. An example might be loading U-Boot from read-only
  10. memory, then loading a signed kernel, then using the kernel's dm-verity
  11. driver to mount a signed root filesystem.
  12. A key point is that it is possible to field-upgrade the software on machines
  13. which use verified boot. Since the machine will only run software that has
  14. been correctly signed, it is safe to read software from an updatable medium.
  15. It is also possible to add a secondary signed firmware image, in read-write
  16. memory, so that firmware can easily be upgraded in a secure manner.
  17. Signing
  18. -------
  19. Verified boot uses cryptographic algorithms to 'sign' software images.
  20. Images are signed using a private key known only to the signer, but can
  21. be verified using a public key. As its name suggests the public key can be
  22. made available without risk to the verification process. The private and
  23. public keys are mathematically related. For more information on how this
  24. works look up "public key cryptography" and "RSA" (a particular algorithm).
  25. The signing and verification process looks something like this:
  26. Signing Verification
  27. ======= ============
  28. +--------------+ *
  29. | RSA key pair | * +---------------+
  30. | .key .crt | * | Public key in |
  31. +--------------+ +------> public key ----->| trusted place |
  32. | | * +---------------+
  33. | | * |
  34. v | * v
  35. +---------+ | * +--------------+
  36. | |----------+ * | |
  37. | signer | * | U-Boot |
  38. | |----------+ * | signature |--> yes/no
  39. +---------+ | * | verification |
  40. ^ | * | |
  41. | | * +--------------+
  42. | | * ^
  43. +----------+ | * |
  44. | Software | +----> signed image -------------+
  45. | image | *
  46. +----------+ *
  47. The signature algorithm relies only on the public key to do its work. Using
  48. this key it checks the signature that it finds in the image. If it verifies
  49. then we know that the image is OK.
  50. The public key from the signer allows us to verify and therefore trust
  51. software from updatable memory.
  52. It is critical that the public key be secure and cannot be tampered with.
  53. It can be stored in read-only memory, or perhaps protected by other on-chip
  54. crypto provided by some modern SOCs. If the public key can be changed, then
  55. the verification is worthless.
  56. Chaining Images
  57. ---------------
  58. The above method works for a signer providing images to a run-time U-Boot.
  59. It is also possible to extend this scheme to a second level, like this:
  60. 1. Master private key is used by the signer to sign a first-stage image.
  61. 2. Master public key is placed in read-only memory.
  62. 2. Secondary private key is created and used to sign second-stage images.
  63. 3. Secondary public key is placed in first stage images
  64. 4. We use the master public key to verify the first-stage image. We then
  65. use the secondary public key in the first-stage image to verify the second-
  66. state image.
  67. 5. This chaining process can go on indefinitely. It is recommended to use a
  68. different key at each stage, so that a compromise in one place will not
  69. affect the whole change.
  70. Flattened Image Tree (FIT)
  71. --------------------------
  72. The FIT format is already widely used in U-Boot. It is a flattened device
  73. tree (FDT) in a particular format, with images contained within. FITs
  74. include hashes to verify images, so it is relatively straightforward to
  75. add signatures as well.
  76. The public key can be stored in U-Boot's CONFIG_OF_CONTROL device tree in
  77. a standard place. Then when a FIT is loaded it can be verified using that
  78. public key. Multiple keys and multiple signatures are supported.
  79. See signature.txt for more information.
  80. Simon Glass
  81. sjg@chromium.org
  82. 1-1-13