Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysbuild: Add support for MCUboot/app encryption keys #60451

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/releases/release-notes-3.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ Build system and infrastructure

* Added support for shared interrupts

* Added support for setting MCUboot encryption key in sysbuild which is then
propagated to the bootloader and target images to automatically create
encrypted updates.

Drivers and Sensors
*******************

Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/check_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ def check_no_undef_outside_kconfig(self, kconf):
# toolchain Kconfig which is sourced based on
# Zephyr toolchain variant and therefore not
# visible to compliance.
"BOOT_ENCRYPTION_KEY_FILE", # Used in sysbuild
"BOOT_ENCRYPT_IMAGE", # Used in sysbuild
"BOOT_UPGRADE_ONLY", # Used in example adjusting MCUboot config, but
# symbol is defined in MCUboot itself.
"BOOT_SERIAL_BOOT_MODE", # Used in (sysbuild-based) test/
Expand Down
3 changes: 3 additions & 0 deletions share/sysbuild/image_configurations/MAIN_image_default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOTLOADER_MCUBOOT "${SB_CONFIG_BOO
set_config_string(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_SIGNATURE_KEY_FILE
"${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}"
)
set_config_string(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_ENCRYPTION_KEY_FILE
"${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}"
)

if(SB_CONFIG_BOOTLOADER_MCUBOOT)
if("${SB_CONFIG_SIGNATURE_TYPE}" STREQUAL "NONE")
Expand Down
4 changes: 4 additions & 0 deletions share/sysbuild/images/bootloader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT)
sysbuild_add_dependencies(FLASH ${DEFAULT_IMAGE} ${image})

set_config_string(${image} CONFIG_BOOT_SIGNATURE_KEY_FILE "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}")
set_config_bool(${image} CONFIG_BOOT_ENCRYPT_IMAGE "${SB_CONFIG_BOOT_ENCRYPTION}")
if(SB_CONFIG_BOOT_ENCRYPTION)
set_config_string(${image} CONFIG_BOOT_ENCRYPTION_KEY_FILE "${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}")
endif()
endif()
20 changes: 18 additions & 2 deletions share/sysbuild/images/bootloader/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,28 @@ config BOOT_SIGNATURE_TYPE_ED25519
endchoice

config BOOT_SIGNATURE_KEY_FILE
string "PEM key file"
string "Signing PEM key file"
default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-ec-p256.pem" if BOOT_SIGNATURE_TYPE_ECDSA_P256
default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-ed25519.pem" if BOOT_SIGNATURE_TYPE_ED25519
default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-rsa-2048.pem" if BOOT_SIGNATURE_TYPE_RSA
default ""
help
Absolute path to key file to use with MCUBoot.
Absolute path to signing key file to use with MCUBoot.

config BOOT_ENCRYPTION
bool "Encrypted image support"
depends on !BOOT_SIGNATURE_TYPE_NONE
help
Support encrypted images.

config BOOT_ENCRYPTION_KEY_FILE
string "Encryption PEM key file"
depends on BOOT_ENCRYPTION
default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/enc-ec256-priv.pem" if BOOT_SIGNATURE_TYPE_ECDSA_P256
default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/enc-x25519-priv.pem" if BOOT_SIGNATURE_TYPE_ED25519
default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/enc-rsa2048-priv.pem" if BOOT_SIGNATURE_TYPE_RSA
default ""
help
Absolute path to encryption key file to use with MCUBoot.

endif
Loading