Skip to content

Commit 6071ceb

Browse files
davidvinczenordicjm
authored andcommitted
boot: Introduce the MCUBOOT_ENC_BUILTIN_KEY option
- Introduce the MCUBOOT_ENC_BUILTIN_KEY config option for controlling the usage of builtin key-encryption keys and replacing the MCUBOOT_HW_KEY option in the image encryption module to avoid ambiguity as the latter mentioned option is meant for configuring the handling of the image verification keys, - Add encryption build configs to template file. Change-Id: Ic633d2103fb4e56d9fafdabef1fbddc3244cb795 Signed-off-by: David Vincze <[email protected]>
1 parent ab4fb32 commit 6071ceb

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

boot/bootutil/src/encrypted.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -336,20 +336,20 @@ hkdf(uint8_t *ikm, uint16_t ikm_len, uint8_t *info, uint16_t info_len,
336336
}
337337
#endif /* MCUBOOT_ENCRYPT_EC256 || MCUBOOT_ENCRYPT_X25519 */
338338

339-
#if !defined(MCUBOOT_HW_KEY)
339+
#if !defined(MCUBOOT_ENC_BUILTIN_KEY)
340340
extern const struct bootutil_key bootutil_enc_key;
341341

342342
/*
343343
* Default implementation to retrieve the private encryption key which is
344-
* embedded in the bootloader code (when MCUBOOT_HW_KEY is not defined).
344+
* embedded in the bootloader code (when MCUBOOT_ENC_BUILTIN_KEY is not defined).
345345
*/
346346
int boot_enc_retrieve_private_key(struct bootutil_key **private_key)
347347
{
348348
*private_key = (struct bootutil_key *)&bootutil_enc_key;
349349

350350
return 0;
351351
}
352-
#endif /* !MCUBOOT_HW_KEY */
352+
#endif /* !MCUBOOT_ENC_BUILTIN_KEY */
353353

354354
int
355355
boot_enc_init(struct enc_key_data *enc_state, uint8_t slot)

samples/mcuboot_config/mcuboot_config.template.h

+27
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,33 @@
8888
/* Uncomment to use Tinycrypt's. */
8989
/* #define MCUBOOT_USE_TINYCRYPT */
9090

91+
/*
92+
* Encrypted images
93+
*
94+
* Uncomment one of the below options (MCUBOOT_ENCRYPT_x) to enable
95+
* encrypted image upgrades.
96+
*/
97+
98+
/* Uncomment to use RSA-OAEP for key encryption */
99+
/* #define MCUBOOT_ENCRYPT_RSA */
100+
/* Uncomment to use AES-KW for key encryption */
101+
/* #define MCUBOOT_ENCRYPT_KW */
102+
/* Uncomment to use ECIES-P256 for key encryption */
103+
/* #define MCUBOOT_ENCRYPT_EC256 */
104+
/* Uncomment to use ECIES-X25519 for key encryption */
105+
/* #define MCUBOOT_ENCRYPT_X25519 */
106+
107+
/* Uncomment to use a builtin key-encryption key (retrieved from a trusted
108+
* source - if implemented) instead of a key embedded in the bootloader. */
109+
/* #define MCUBOOT_ENC_BUILTIN_KEY */
110+
111+
#if defined(MCUBOOT_ENCRYPT_RSA) || \
112+
defined(MCUBOOT_ENCRYPT_KW) || \
113+
defined(MCUBOOT_ENCRYPT_EC256) || \
114+
defined(MCUBOOT_ENCRYPT_X25519)
115+
#define MCUBOOT_ENC_IMAGES
116+
#endif
117+
91118
/*
92119
* Always check the signature of the image in the primary slot before booting,
93120
* even if no upgrade was performed. This is recommended if the boot

0 commit comments

Comments
 (0)