-
Notifications
You must be signed in to change notification settings - Fork 845
Support for Embedded Plain AES keys #2516
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
base: main
Are you sure you want to change the base?
Conversation
daae031 to
5b663a9
Compare
nvlsianpu
left a comment
There was a problem hiding this 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.
882fb1f to
01a3b55
Compare
5b76934 to
7b5d80c
Compare
59f09d6 to
78f3a0e
Compare
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>
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>
Once TF-M stops using internal imgtool APIs this commit should be reverted. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
|
|
||
| if (MUST_DECRYPT(fa_p, BOOT_CURR_IMG(state), hdr)) { | ||
| #ifdef MCUBOOT_EMBEDDED_ENC_KEY | ||
| rc = boot_en_take_key(bs->enckey[BOOT_SLOT_SECONDARY], BOOT_CUR_IMG(state), BOOT_SLOT_SECONDARY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess wrapping this API function under boot_enc_load() doesn't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crap, there is bug in this line actually.
Anyway, I was considering doing the opposite so that boot_enc_load would become one of boot_take_enc_key implementations, but could not get rid of boot_loader_state for various reasons.
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.
Update: I will move imgtool script to separate PR, at this point. Fighting with FIH tests that from, what seems to be a timeout, without any feedback is impossible. Running personal docker is impossible either, because after getting authorized with docker registry I am denied access to required data anyway.Finally fixed the scripts to make FIH and TrustedFirmware-M happy.