Skip to content

Conversation

@de-nordic
Copy link
Collaborator

Support in code for querying user provided function for an AES encryption key.

Extra Zephyr code and template that allows to use the new functionality.

Although I think this is ready for review I am still working, in different set of commits, on redefining encryption key type so that we could abstract that type across the MCUboot code; this means that this PR may change in how boot_take_enc_key function is defined.

@de-nordic de-nordic force-pushed the aes-plain branch 3 times, most recently from daae031 to 5b663a9 Compare October 23, 2025 15:38
Copy link
Collaborator

@nvlsianpu nvlsianpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes in scripts/imgtool/image.py looks good.

@nvlsianpu nvlsianpu added crypto Encryption support area: core Affects core functionality area: zephyr Affects the Zephyr port labels Oct 28, 2025
The change adds --aes-key option that allows to pass a key
via command line. The key is used to encrypt the image and there
is not key exchange TLV added to the image.
The options is provided for encrypting images for devices that store
AES key on them so they do not expect it to be passed with image,
in encrypted form.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Commit provides support for MCUBOOT_EMBEDDED_ENC_KEY config
option, that allows to compile code with embedded key.
When this option is enabled, compilation requires
definition of boot_take_enc_key function to be provided by user;
prototype for the function is provided.

The boot_take_enc_key function is supposed to provide encryption
AES key to be used for image encryption and decryption.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit provides Kconfig options that allow to configure
MCUboot to use embedded AES key. Primary option is
CONFIG_BOOT_ENCRYPT_IMAGE_WITH_EMBEDDED_KEY that allows to select
usage of embedded key in the code.
After it follow sets of Kconfigs:
 - CONFIG_BOOT_ENCRYPT_IMAGE_GENERATE_BASIC_KEY_PROVIDER
 - CONFIG_BOOT_ENCRYPT_IMAGE_USE_CUSTOM_KEY_PROVIDER

The above set allows to select source of the key. The first option
will choose to generate default key provider, with a single
embedded key, where the key is provided as a string assigned to
CONFIG_BOOOT_ENCRYPT_IMAGE_EMBEDDED_RAW_KEY.
The second option selects user provided code as source of key(s).

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Once TF-M stops using internal imgtool APIs this commit should
be reverted.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Affects core functionality area: zephyr Affects the Zephyr port crypto Encryption support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants