doc: build: signing: document signing key file resolution#3
Open
JPHutchins wants to merge 1 commit into
Open
Conversation
JPHutchins
commented
Jun 22, 2026
JPHutchins
commented
Jun 22, 2026
JPHutchins
commented
Jun 22, 2026
JPHutchins
commented
Jun 22, 2026
103e8eb to
468725d
Compare
JPHutchins
commented
Jun 22, 2026
JPHutchins
commented
Jun 22, 2026
JPHutchins
commented
Jun 22, 2026
JPHutchins
commented
Jun 22, 2026
468725d to
f275391
Compare
JPHutchins
commented
Jun 22, 2026
JPHutchins
commented
Jun 22, 2026
The signing docs only described SB_CONFIG_BOOT_SIGNATURE_KEY_FILE as
"the insecure default" key to "change this appropriately", with no
guidance on where the key file may live or how a relative path to it is
resolved.
A single SB_CONFIG_BOOT_SIGNATURE_KEY_FILE feeds two images that resolve
relative key paths against different bases: the application image
(CONFIG_MCUBOOT_SIGNATURE_KEY_FILE) against APPLICATION_CONFIG_DIR then
WEST_TOPDIR, and the MCUboot image (CONFIG_BOOT_SIGNATURE_KEY_FILE)
against APPLICATION_CONFIG_DIR then the MCUboot module directory. A key
referenced by a bare relative path that one image can resolve is
therefore not resolvable by the other.
Document this on the Signing Binaries page: the value is expanded with
string(CONFIGURE), the per-image relative-path search order, and the
need for either an absolute path or a ${APP_DIR}-anchored path (the only
relative form that resolves identically for both images and keeps the
key in the user-owned application). Cross-reference it from the sysbuild
images page where the shared signing key is introduced.
Signed-off-by: JP Hutchins <jp@intercreate.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
f275391 to
a80c0c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Signing key files section to the Signing Binaries page documenting how the MCUboot signing key file (
SB_CONFIG_BOOT_SIGNATURE_KEY_FILE) is located, and cross-references it from the Sysbuild images page where the shared key is introduced.Why
The signing docs only said the bundled key is "the insecure default" and to "change this appropriately" — silent on where a custom key may live or how a relative path to it resolves. One
SB_CONFIG_BOOT_SIGNATURE_KEY_FILEdrives two images that resolve relative paths against different bases:CONFIG_MCUBOOT_SIGNATURE_KEY_FILEAPPLICATION_CONFIG_DIR→WEST_TOPDIRCONFIG_BOOT_SIGNATURE_KEY_FILEAPPLICATION_CONFIG_DIR→ MCUboot module dirso a bare relative path that one image can resolve is generally not resolvable by the other. The new section documents the
string(CONFIGURE)expansion of the value, the per-image search order, and that an absolute path or a${APP_DIR}-anchored path is the reliable choice — the latter keeps the key in the user-owned application and resolves identically for both images.${APP_DIR}is the maintainer-recommended anchor (zephyr discussion zephyrproject-rtos#59063) but was previously undocumented.References
Maintainer-sanctioned fix (the behavior the docs should state)
SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="${APP_DIR}/my_key.pem"insysbuild.conf(or an absolute path). The${APP_DIR}anchor is recommended here but documented nowhere.${APP_DIR}/my.pem." Establishes that the app-image/bootloader-image resolution asymmetry is by design, so the gap is a documentation gap, not a bug to fix in code.SB_CONFIG_BOOT_SIGNATURE_KEY_FILE(plusSB_CONFIG_BOOT_SIGNATURE_TYPE_*), not the per-imageCONFIG_MCUBOOT_SIGNATURE_KEY_FILE.In-tree source of truth (what the docs should describe)
Pinned at zephyr
main1cfe02062, mcubootmain0fae892:zephyr/share/sysbuild/cmake/modules/sysbuild_extensions.cmake— the singlestring(CONFIGURE …)expansion of the key value in sysbuild scope (where${APP_DIR}= the main application and${CMAKE_CURRENT_LIST_DIR}= the sysbuild module dir inside zephyr). This is why${APP_DIR}works and${CMAKE_CURRENT_LIST_DIR}silently resolves into the zephyr tree.zephyr/cmake/mcuboot.cmake— application-image resolver: absolute →${APPLICATION_CONFIG_DIR}→${WEST_TOPDIR}(theWEST_TOPDIRfallback is flagged in-code aswest signbackward-compat).mcuboot/boot/zephyr/CMakeLists.txt— bootloader-image resolver: absolute →${APPLICATION_CONFIG_DIR}→${MCUBOOT_DIR}(noWEST_TOPDIRfallback — the deliberate asymmetry).zephyr/share/sysbuild/images/bootloader/Kconfig— definesSB_CONFIG_BOOT_SIGNATURE_KEY_FILE(default points inside the mcuboot module).zephyr/share/sysbuild/image_configurations/MAIN_image_default.cmakeandzephyr/share/sysbuild/images/bootloader/CMakeLists.txt— propagate that one symbol to the app image (CONFIG_MCUBOOT_SIGNATURE_KEY_FILE) and the bootloader image (CONFIG_BOOT_SIGNATURE_KEY_FILE) respectively.Docs pages with the gap (targets to amend)
APPLICATION_CONFIG_DIR/WEST_TOPDIR/MCUBOOT_DIR, onstring(CONFIGURE)expansion, and on the dual-image propagation.SB_CONFIG_BOOT_SIGNATURE_KEY_FILEdrives both images (andFILE_SUFFIXcan split them) but says nothing about where the key may live or how relative paths resolve.Downstream vendor guidance (corroborates the gap)
bootloader_signature_keys— the clearest official statement anywhere: "Use only absolute paths" forSB_CONFIG_BOOT_SIGNATURE_KEY_FILE; set it insysbuild.conf; store the private key outside the build directory. Downstream had to write this because upstream is silent.${APPLICATION_CONFIG_DIR}→ empty, confirmed SDK bug, sdk-nrf PR ARM: alignment problems in libc/newlib zephyrproject-rtos/zephyr#16894), #115651 (${APP_DIR}unexpanded →/keys/…), #118977 (set it on the child image, not the parent), #123846 (Nordic: it's a build-system coupling, not an MCUboot flaw), #124004 (nRF Desktop per-boardAPPLICATION_CONFIG_DIRpattern), #80629.MCUboot resolution-logic context (for the "why now" framing)
IS_ABSOLUTE → APPLICATION_CONFIG_DIR → MCUBOOT_DIRblock verbatim. This is the resolution logic visible at mcubootmainHEAD.getpub/verify(underpins the custody model without changing path resolution).APPLICATION_CONFIG_DIR-relative key resolution withstring(CONFIGURE)escaping.Further corroboration (additional trackers & third-party guidance)
SIGNING_SCRIPTfor external / HSM signing; mcuboot issue #599 — HSM support.zephyr-mcuboot-keys, Hubble Zephyr DFU guide.Verification
main, mcubootmain, nrf52840dk/nrf52840, ECDSA-P256): bare relative → resolves into mcuboot (fails);${CMAKE_CURRENT_LIST_DIR}→ resolves into zephyr (fails);${APP_DIR}→ builds, key stays in app.cmake/mcuboot.cmake,bootloader/mcuboot/boot/zephyr/CMakeLists.txt,share/sysbuild/cmake/modules/sysbuild_extensions.cmake, and propagation viashare/sysbuild/image_configurations/MAIN_image_default.cmakeandshare/sysbuild/images/bootloader/CMakeLists.txt.:ref:/:kconfig:option:targets, and code-block conventions checked against existing docs. A full Sphinx build was not run locally (heavy); relying on the CI docs build.🤖 Generated with Claude Code