Skip to content

[Backport ncs-v3.4-branch] [nrf noup] zephyr: imgtool: sim: support multiple keys - #729

Open
NordicBuilder wants to merge 2 commits into
ncs-v3.4-branchfrom
backport-722-to-ncs-v3.4-branch
Open

[Backport ncs-v3.4-branch] [nrf noup] zephyr: imgtool: sim: support multiple keys#729
NordicBuilder wants to merge 2 commits into
ncs-v3.4-branchfrom
backport-722-to-ncs-v3.4-branch

Conversation

@NordicBuilder

Copy link
Copy Markdown

Backport 9182123 from #722.

zephyr: support multiple signing keys

CONFIG_BOOT_SIGNATURE_KEY_FILE accepts a comma-separated list
of PEMs. The first entry may be a keypair or public-only PEM —
only the public bytes are ever embedded in the bootloader binary;
subsequent entries must be public-only and are validated at CMake
configure time. This enables the prod/dev custody model: a
development bootloader can boot both production-signed and
development-signed images, while production bootloaders embed only
the production public key.

imgtool: add --name-suffix to getpub and getpubhash

Emits suffixed C/Rust symbol names so more than one key of the
same signature type can be embedded without collisions.

imgtool: add keyinfo subcommand

Reports whether a PEM is a keypair (private) or public-only.
Used by the Zephyr build to enforce that verification-only entries
past the first are public-only PEMs.

sim: tests for multiple ed25519 keys

Add the sig-second-key feature and multi_key test scenarios
covering single-key and dual-key builds.

Documentation updated in docs/readme-zephyr.md, docs/signed_images.md,
and docs/imgtool.md.

Closes #2700.

Signed-off-by: JP Hutchins <jp@intercreate.io>

NCS adaptation notes:
- Simulator changes excluded (not applicable to sdk-mcuboot).
- CMakeLists.txt: NCS-specific key resolution (CONF_FILE scanning and
  KEY_FILE global property) preserved for the primary key; additional
  keys use CONF_DIR (same source as primary key) rather than
  APPLICATION_CONFIG_DIR for relative path resolution. zephyr_library_sources()
  used instead of target_sources() to match existing NCS conventions.
  MCUBOOT_SIGN_KEY_COUNT=1 set in else() branch to cover KMU, ITS,
  builtin-key, and any other no-key-file configurations.
- Kconfig: BOOT_BUILTIN_KEY replaced with BOOT_SIGNATURE_USING_KMU and
  NCS_BOOT_SIGNATURE_USING_ITS in the mutually-exclusive list; help text
  updated to reflect NCS CONF_FILE-based path resolution behaviour.
- imgtool: keyinfo uses hasattr(key_obj, "private_bytes") on the underlying
  cryptography key object to detect private keys, replacing
  keys.PayloadSigner/DigestSigner (absent in NCS) and keys.PrivateBytesMixin
  (which Ed25519 does not inherit in this fork).

(cherry picked from commit 5497c95f1c8cde55a2d0da0db96e53fad77b8c8d)
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
(cherry picked from commit 9182123)
…91 only

Scope the comma separated BOOT_SIGNATURE_KEY_FILE to only 91
series devices in NCS 3.4.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Aug 20, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-mcuboot#729

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@sonarqubecloud

Copy link
Copy Markdown

@nvlsianpu nvlsianpu added this to the ncs-3.4.1 milestone Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants