Kconfig.projbuild 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. menu "Bootloader config"
  2. choice LOG_BOOTLOADER_LEVEL
  3. bool "Bootloader log verbosity"
  4. default LOG_BOOTLOADER_LEVEL_INFO
  5. help
  6. Specify how much output to see in bootloader logs.
  7. config LOG_BOOTLOADER_LEVEL_NONE
  8. bool "No output"
  9. config LOG_BOOTLOADER_LEVEL_ERROR
  10. bool "Error"
  11. config LOG_BOOTLOADER_LEVEL_WARN
  12. bool "Warning"
  13. config LOG_BOOTLOADER_LEVEL_INFO
  14. bool "Info"
  15. config LOG_BOOTLOADER_LEVEL_DEBUG
  16. bool "Debug"
  17. config LOG_BOOTLOADER_LEVEL_VERBOSE
  18. bool "Verbose"
  19. endchoice
  20. config LOG_BOOTLOADER_LEVEL
  21. int
  22. default 0 if LOG_BOOTLOADER_LEVEL_NONE
  23. default 1 if LOG_BOOTLOADER_LEVEL_ERROR
  24. default 2 if LOG_BOOTLOADER_LEVEL_WARN
  25. default 3 if LOG_BOOTLOADER_LEVEL_INFO
  26. default 4 if LOG_BOOTLOADER_LEVEL_DEBUG
  27. default 5 if LOG_BOOTLOADER_LEVEL_VERBOSE
  28. endmenu
  29. menu "Security features"
  30. config SECURE_BOOT_ENABLED
  31. bool "Enable secure boot in bootloader (READ DOCS FIRST)"
  32. default N
  33. help
  34. Build a bootloader which enables secure boot on first boot.
  35. Once enabled, secure boot will not boot a modified bootloader. The bootloader will only load a partition table or boot an app if the data has a verified digital signature. There are implications for reflashing updated apps once secure boot is enabled.
  36. When enabling secure boot, JTAG and ROM BASIC Interpreter are permanently disabled by default.
  37. Refer to http://esp-idf.readthedocs.io/en/latest/security/secure-boot.html before enabling.
  38. choice SECURE_BOOTLOADER_MODE
  39. bool "Secure bootloader mode"
  40. depends on SECURE_BOOT_ENABLED
  41. default SECURE_BOOTLOADER_ONE_TIME_FLASH
  42. config SECURE_BOOTLOADER_ONE_TIME_FLASH
  43. bool "One-time flash"
  44. help
  45. On first boot, the bootloader will generate a key which is not readable externally or by software. A digest is generated from the bootloader image itself. This digest will be verified on each subsequent boot.
  46. Enabling this option means that the bootloader cannot be changed after the first time it is booted.
  47. config SECURE_BOOTLOADER_REFLASHABLE
  48. bool "Reflashable"
  49. help
  50. Generate a reusable secure bootloader key, derived (via SHA-256) from the secure boot signing key.
  51. This allows the secure bootloader to be re-flashed by anyone with access to the secure boot signing key.
  52. This option is less secure than one-time flash, because a leak of the digest key from one device allows reflashing of any device that uses it.
  53. endchoice
  54. config SECURE_BOOT_BUILD_SIGNED_BINARIES
  55. bool "Sign binaries during build"
  56. depends on SECURE_BOOT_ENABLED
  57. default y
  58. help
  59. Once secure boot is enabled, bootloader will only boot if partition table and app image are signed.
  60. If enabled, these binary files are signed as part of the build process. The file named in "Secure boot private signing key" will be used to sign the image.
  61. If disabled, unsigned app/partition data will be built. They must be signed manually using espsecure.py (for example, on a remote signing server.)
  62. config SECURE_BOOT_SIGNING_KEY
  63. string "Secure boot private signing key"
  64. depends on SECURE_BOOT_BUILD_SIGNED_BINARIES
  65. default secure_boot_signing_key.pem
  66. help
  67. Path to the key file used to sign partition tables and app images for secure boot. Once secure boot is enabled, bootloader will only boot if partition table and app image are signed.
  68. Key file is an ECDSA private key (NIST256p curve) in PEM format.
  69. Path is evaluated relative to the project directory.
  70. You can generate a new signing key by running the following command:
  71. espsecure.py generate_signing_key secure_boot_signing_key.pem
  72. See docs/security/secure-boot.rst for details.
  73. config SECURE_BOOT_VERIFICATION_KEY
  74. string "Secure boot public signature verification key"
  75. depends on SECURE_BOOT_ENABLED && !SECURE_BOOT_BUILD_SIGNED_BINARIES
  76. default signature_verification_key.bin
  77. help
  78. Path to a public key file used to verify signed images. This key is compiled into the bootloader,
  79. and may also be used to verify signatures on OTA images after download.
  80. Key file is in raw binary format, and can be extracted from a
  81. PEM formatted private key using the espsecure.py
  82. extract_public_key command.
  83. Refer to http://esp-idf.readthedocs.io/en/latest/security/secure-boot.html before enabling.
  84. config SECURE_BOOT_INSECURE
  85. bool "Allow potentially insecure options"
  86. depends on SECURE_BOOT_ENABLED
  87. default N
  88. help
  89. You can disable some of the default protections offered by secure boot, in order to enable testing or a custom combination of security features.
  90. Only enable these options if you are very sure.
  91. Refer to http://esp-idf.readthedocs.io/en/latest/security/secure-boot.html before enabling.
  92. config FLASH_ENCRYPTION_ENABLED
  93. bool "Enable flash encryption on boot (READ DOCS FIRST)"
  94. default N
  95. help
  96. If this option is set, flash contents will be encrypted by the bootloader on first boot.
  97. Note: After first boot, the system will be permanently encrypted. Re-flashing an encrypted
  98. system is complicated and not always possible.
  99. Read http://esp-idf.readthedocs.io/en/latest/security/flash-encryption.html before enabling.
  100. config FLASH_ENCRYPTION_INSECURE
  101. bool "Allow potentially insecure options"
  102. depends on FLASH_ENCRYPTION_ENABLED
  103. default N
  104. help
  105. You can disable some of the default protections offered by flash encryption, in order to enable testing or a custom combination of security features.
  106. Only enable these options if you are very sure.
  107. Refer to docs/security/secure-boot.rst and docs/security/flash-encryption.rst for details.
  108. menu "Potentially insecure options"
  109. visible if FLASH_ENCRYPTION_INSECURE || SECURE_BOOT_INSECURE
  110. # NOTE: Options in this menu NEED to have SECURE_BOOT_INSECURE
  111. # and/or FLASH_ENCRYPTION_INSECURE in "depends on", as the menu
  112. # itself doesn't enable/disable its children (if it's not set,
  113. # it's possible for the insecure menu to be disabled but the insecure option
  114. # to remain on which is very bad.)
  115. config SECURE_BOOT_ALLOW_ROM_BASIC
  116. bool "Leave ROM BASIC Interpreter available on reset"
  117. depends on SECURE_BOOT_INSECURE
  118. default N
  119. help
  120. If not set (default), bootloader permanently disables ROM BASIC (on UART console) as a fallback if the bootloader image becomes invalid. This happens on first boot.
  121. Only set this option in testing environments.
  122. config SECURE_BOOT_ALLOW_JTAG
  123. bool "Allow JTAG Debugging"
  124. depends on SECURE_BOOT_INSECURE || FLASH_ENCRYPTION_INSECURE
  125. default N
  126. help
  127. If not set (default), the bootloader will permanently disable JTAG (across entire chip) on first boot when either secure boot or flash encryption is enabled.
  128. Setting this option leaves JTAG on for debugging, which negates all protections of flash encryption and some of the protections of secure boot.
  129. Only set this option in testing environments.
  130. config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_ENCRYPT
  131. bool "Leave UART bootloader encryption enabled"
  132. depends on FLASH_ENCRYPTION_INSECURE
  133. default N
  134. help
  135. If not set (default), the bootloader will permanently disable UART bootloader encryption access on first boot. If set, the UART bootloader will still be able to access hardware encryption.
  136. It is recommended to only set this option in testing environments.
  137. config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_DECRYPT
  138. bool "Leave UART bootloader decryption enabled"
  139. depends on FLASH_ENCRYPTION_INSECURE
  140. default N
  141. help
  142. If not set (default), the bootloader will permanently disable UART bootloader decryption access on first boot. If set, the UART bootloader will still be able to access hardware decryption.
  143. Only set this option in testing environments. Setting this option allows complete bypass of flash encryption.
  144. config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_CACHE
  145. bool "Leave UART bootloader flash cache enabled"
  146. depends on FLASH_ENCRYPTION_INSECURE
  147. default N
  148. help
  149. If not set (default), the bootloader will permanently disable UART bootloader flash cache access on first boot. If set, the UART bootloader will still be able to access the flash cache.
  150. Only set this option in testing environments.
  151. config SECURE_BOOT_TEST_MODE
  152. bool "Secure boot test mode: don't permanently set any efuses"
  153. depends on SECURE_BOOT_INSECURE
  154. default N
  155. help
  156. If this option is set, all permanent secure boot changes (via Efuse) are disabled.
  157. Log output will state changes which would be applied, but they will not be.
  158. This option is for testing purposes only - it completely disables secure boot protection.
  159. endmenu # potentially insecure
  160. endmenu