Commit 6071ceb1 authored by David Vincze's avatar David Vincze Committed by Jamie
Browse files

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: default avatarDavid Vincze <david.vincze@arm.com>
parent ab4fb329
Loading
Loading
Loading
Loading
+3 −3
Changes for boot/bootutil/src/encrypted.c: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -336,12 +336,12 @@ error:
}
#endif /* MCUBOOT_ENCRYPT_EC256 || MCUBOOT_ENCRYPT_X25519 */

#if !defined(MCUBOOT_HW_KEY)
#if !defined(MCUBOOT_ENC_BUILTIN_KEY)
extern const struct bootutil_key bootutil_enc_key;

/*
 * Default implementation to retrieve the private encryption key which is
 * embedded in the bootloader code (when MCUBOOT_HW_KEY is not defined).
 * embedded in the bootloader code (when MCUBOOT_ENC_BUILTIN_KEY is not defined).
 */
int boot_enc_retrieve_private_key(struct bootutil_key **private_key)
{
@@ -349,7 +349,7 @@ int boot_enc_retrieve_private_key(struct bootutil_key **private_key)

    return 0;
}
#endif /* !MCUBOOT_HW_KEY */
#endif /* !MCUBOOT_ENC_BUILTIN_KEY */

int
boot_enc_init(struct enc_key_data *enc_state, uint8_t slot)
+27 −0
Changes for samples/mcuboot_config/mcuboot_config.template.h: 27 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -88,6 +88,33 @@
/* Uncomment to use Tinycrypt's. */
/* #define MCUBOOT_USE_TINYCRYPT */

/*
 * Encrypted images
 *
 * Uncomment one of the below options (MCUBOOT_ENCRYPT_x) to enable
 * encrypted image upgrades.
 */

/* Uncomment to use RSA-OAEP for key encryption */
/* #define MCUBOOT_ENCRYPT_RSA */
/* Uncomment to use AES-KW for key encryption */
/* #define MCUBOOT_ENCRYPT_KW */
/* Uncomment to use ECIES-P256 for key encryption */
/* #define MCUBOOT_ENCRYPT_EC256 */
/* Uncomment to use ECIES-X25519 for key encryption */
/* #define MCUBOOT_ENCRYPT_X25519 */

/* Uncomment to use a builtin key-encryption key (retrieved from a trusted
 * source - if implemented) instead of a key embedded in the bootloader. */
/* #define MCUBOOT_ENC_BUILTIN_KEY */

#if defined(MCUBOOT_ENCRYPT_RSA)    || \
    defined(MCUBOOT_ENCRYPT_KW)     || \
    defined(MCUBOOT_ENCRYPT_EC256)  || \
    defined(MCUBOOT_ENCRYPT_X25519)
#define MCUBOOT_ENC_IMAGES
#endif

/*
 * Always check the signature of the image in the primary slot before booting,
 * even if no upgrade was performed. This is recommended if the boot