diff options
author | Balint Matyi <Balint.Matyi@arm.com> | 2020-03-31 13:15:39 +0100 |
---|---|---|
committer | Tamas Ban <tamas.ban@arm.com> | 2020-07-22 11:40:16 +0000 |
commit | 5c476315f5568ead687e25d34b17efb6c4dab988 (patch) | |
tree | b53f781dda6c7781e57b1a0aafc877605663041e | |
parent | d9abb4973c5d7842f3bab8a7b34736472000f98e (diff) | |
download | trusted-firmware-m-5c476315f5568ead687e25d34b17efb6c4dab988.tar.gz |
Boot: Add encrypted image support
Introduces the 'MCUBOOT_ENCRYPT_RSA' compile time switch. When set to
'ON', adds encrypted image support in the BL2 source and encrypts the
signed images. As a result, BL2 can now accept an encrypted image
for upgrade and decrypt it when applying. It can also re-encrypt the
original image if it is kept and moved back to the secondary slot.
Change-Id: I998861c7175c136eed60ac13c802134705b5c3f3
Signed-off-by: Balint Matyi <Balint.Matyi@arm.com>
-rw-r--r-- | CommonConfig.cmake | 7 | ||||
-rw-r--r-- | bl2/ext/mcuboot/CMakeLists.txt | 12 | ||||
-rw-r--r-- | bl2/ext/mcuboot/MCUBoot.cmake | 9 | ||||
-rw-r--r-- | bl2/ext/mcuboot/MCUBootConfig.cmake | 11 | ||||
-rw-r--r-- | bl2/ext/mcuboot/bl2_main.c | 5 | ||||
-rw-r--r-- | bl2/ext/mcuboot/include/config-rsa.h | 6 | ||||
-rw-r--r-- | bl2/ext/mcuboot/include/hal/hal_flash.h | 40 | ||||
-rw-r--r-- | bl2/ext/mcuboot/include/mcuboot_config/mcuboot_config.h.in | 3 | ||||
-rw-r--r-- | bl2/ext/mcuboot/keys.c | 111 | ||||
-rw-r--r-- | docs/getting_started/tfm_secure_boot.rst | 9 |
10 files changed, 205 insertions, 8 deletions
diff --git a/CommonConfig.cmake b/CommonConfig.cmake index 679a0d38af..b533d04f35 100644 --- a/CommonConfig.cmake +++ b/CommonConfig.cmake @@ -523,8 +523,5 @@ if (NOT DEFINED ATTEST_CLAIM_VALUE_CHECK) set(ATTEST_CLAIM_VALUE_CHECK OFF) endif() -##Set mbedTLS compiler flags for BL2 bootloader -set(MBEDCRYPTO_C_FLAGS_BL2 "${CMSE_FLAGS} -D__thumb2__ ${COMMON_COMPILE_FLAGS_STR} -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-rsa.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include") -if (MCUBOOT_SIGNATURE_TYPE STREQUAL "RSA-3072") - string(APPEND MBEDCRYPTO_C_FLAGS_BL2 " -DMCUBOOT_SIGN_RSA_LEN=3072") -endif() +##Set common mbedTLS compiler flags for BL2 bootloader +set(MBEDCRYPTO_C_FLAGS_BL2 "${CMSE_FLAGS} -D__thumb2__ ${COMMON_COMPILE_FLAGS_STR} -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-rsa.h\\\\\\\"") diff --git a/bl2/ext/mcuboot/CMakeLists.txt b/bl2/ext/mcuboot/CMakeLists.txt index ababed199c..68d817f5e8 100644 --- a/bl2/ext/mcuboot/CMakeLists.txt +++ b/bl2/ext/mcuboot/CMakeLists.txt @@ -105,12 +105,14 @@ else() "${MCUBOOT_DIR}/bootutil/src/swap_scratch.c" "${MCUBOOT_DIR}/bootutil/src/swap_move.c" "${MCUBOOT_DIR}/bootutil/src/swap_misc.c" + "${MCUBOOT_DIR}/bootutil/src/encrypted.c" ) endif() #Define location of Mbed Crypto source, build, and installation directory. set(MBEDTLS_CONFIG_FILE "config-rsa.h") set(MBEDTLS_CONFIG_PATH "${TFM_ROOT_DIR}/bl2/ext/mcuboot/include") + get_filename_component(MBEDCRYPTO_SOURCE_DIR "${TFM_ROOT_DIR}/../mbed-crypto" ABSOLUTE) if(NOT EXISTS ${MBEDCRYPTO_SOURCE_DIR}) message(FATAL_ERROR "Missing mbed-crypto. Please clone the mbed-crypto repo to directory \"${MBEDCRYPTO_SOURCE_DIR}\".") @@ -125,6 +127,16 @@ if (CRYPTO_HW_ACCELERATOR OR CRYPTO_HW_ACCELERATOR_OTP_STATE STREQUAL "PROVISION include(${CRYPTO_HW_ACCELERATOR_CMAKE_BUILD}) endif() +if(MCUBOOT_SIGNATURE_TYPE STREQUAL "RSA-3072") + set(MCUBOOT_MBEDCRYPTO_SIGNATURE " -DMCUBOOT_SIGN_RSA_LEN=3072") +elseif(MCUBOOT_SIGNATURE_TYPE STREQUAL "RSA-2048") + set(MCUBOOT_MBEDCRYPTO_SIGNATURE " -DMCUBOOT_SIGN_RSA_LEN=2048") +else() + set(MCUBOOT_MBEDCRYPTO_SIGNATURE "") +endif() + +string(APPEND MBEDCRYPTO_C_FLAGS_BL2 " ${MCUBOOT_MBEDCRYPTO_SIGNATURE} -I${MBEDTLS_CONFIG_PATH}") + #Build Mbed Crypto as external project. #This ensures Mbed Crypto is built with exactly defined settings. #Mbed Crypto will be used from its install location diff --git a/bl2/ext/mcuboot/MCUBoot.cmake b/bl2/ext/mcuboot/MCUBoot.cmake index 28dd7feaf9..e262955e3e 100644 --- a/bl2/ext/mcuboot/MCUBoot.cmake +++ b/bl2/ext/mcuboot/MCUBoot.cmake @@ -59,6 +59,12 @@ function(mcuboot_create_boot_payload) message(FATAL_ERROR "${MCUBOOT_SIGNATURE_TYPE} is not supported as firmware signing algorithm") endif() + if(MCUBOOT_ENCRYPT_RSA) + set(ADD_ENCRYPTION "-E${TFM_ROOT_DIR}/../mcuboot/enc-rsa2048-pub.pem") + else() + set(ADD_ENCRYPTION "") + endif() + #Configure in which format (full or hash) include the public key to the image manifest # #|-----------------------|-----------------------|-------------------|--------------------| @@ -168,6 +174,7 @@ if (MCUBOOT_IMAGE_NUMBER GREATER 1) #Sign secure binary image with default public key in mcuboot folder COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper/wrapper.py ARGS -k ${KEY_FILE_S} + ${ADD_ENCRYPTION} --public-key-format ${PUBLIC_KEY_FORMAT} --align 1 ${OVERWRITE} @@ -184,6 +191,7 @@ if (MCUBOOT_IMAGE_NUMBER GREATER 1) #Sign non-secure binary image with default public key in mcuboot folder COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper/wrapper.py ARGS -k ${KEY_FILE_NS} + ${ADD_ENCRYPTION} --public-key-format ${PUBLIC_KEY_FORMAT} --align 1 ${OVERWRITE} @@ -265,6 +273,7 @@ else() # MCUBOOT_IMAGE_NUMBER = 1 #Sign concatenated binary image with default public key in mcuboot folder COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper/wrapper.py ARGS -k ${KEY_FILE} + ${ADD_ENCRYPTION} --public-key-format ${PUBLIC_KEY_FORMAT} --align 1 ${OVERWRITE} diff --git a/bl2/ext/mcuboot/MCUBootConfig.cmake b/bl2/ext/mcuboot/MCUBootConfig.cmake index 26c97d5cc6..e77728ea24 100644 --- a/bl2/ext/mcuboot/MCUBootConfig.cmake +++ b/bl2/ext/mcuboot/MCUBootConfig.cmake @@ -39,6 +39,8 @@ if (BL2) set(MCUBOOT_HW_KEY On CACHE BOOL "Configure to use HW key for image verification. Otherwise key is embedded in MCUBoot image.") + set(MCUBOOT_ENCRYPT_RSA Off CACHE BOOL "Add encrypted image support to BL2. Also encrypts the signed images.") + set(MCUBOOT_LOG_LEVEL "LOG_LEVEL_INFO" CACHE STRING "Configure the level of logging in MCUBoot.") set_property(CACHE MCUBOOT_LOG_LEVEL PROPERTY STRINGS "LOG_LEVEL_OFF;LOG_LEVEL_ERROR;LOG_LEVEL_WARNING;LOG_LEVEL_INFO;LOG_LEVEL_DEBUG") if (NOT CMAKE_BUILD_TYPE STREQUAL "debug") @@ -56,6 +58,10 @@ if (BL2) endif() if (MCUBOOT_REPO STREQUAL "UPSTREAM") + if(MCUBOOT_ENCRYPT_RSA) + set(MCUBOOT_ENC_IMAGES On) + endif() + set_property(CACHE MCUBOOT_UPGRADE_STRATEGY PROPERTY STRINGS "OVERWRITE_ONLY;SWAP") if (${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "NO_SWAP" OR ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "RAM_LOADING") @@ -63,6 +69,11 @@ if (BL2) " upstream MCUBoot. Your choice was overriden.") mcuboot_override_upgrade_strategy("OVERWRITE_ONLY") endif() + elseif (MCUBOOT_REPO STREQUAL "TF-M") + if (MCUBOOT_ENCRYPT_RSA) + set(MCUBOOT_ENCRYPT_RSA Off) + message(WARNING "BL2 encryption cannot be used when building against the TF-M MCUBoot fork. Your choice was overridden.") + endif() endif() else() #BL2 is turned off diff --git a/bl2/ext/mcuboot/bl2_main.c b/bl2/ext/mcuboot/bl2_main.c index 3d4ddae166..c428d5e736 100644 --- a/bl2/ext/mcuboot/bl2_main.c +++ b/bl2/ext/mcuboot/bl2_main.c @@ -50,7 +50,12 @@ REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Base); /* Flash device name must be specified by target */ extern ARM_DRIVER_FLASH FLASH_DEV_NAME; +#ifdef MCUBOOT_ENCRYPT_RSA +#define BL2_MBEDTLS_MEM_BUF_LEN 0x225C +#else #define BL2_MBEDTLS_MEM_BUF_LEN 0x2000 +#endif + /* Static buffer to be used by mbedtls for memory allocation */ static uint8_t mbedtls_mem_buf[BL2_MBEDTLS_MEM_BUF_LEN]; diff --git a/bl2/ext/mcuboot/include/config-rsa.h b/bl2/ext/mcuboot/include/config-rsa.h index b721953a63..c345245ab7 100644 --- a/bl2/ext/mcuboot/include/config-rsa.h +++ b/bl2/ext/mcuboot/include/config-rsa.h @@ -1,7 +1,7 @@ /* * Minimal configuration for using TLS in the bootloader * - * Copyright (C) 2006-2019, Arm Limited. All rights reserved. + * Copyright (C) 2006-2020, Arm Limited. All rights reserved. * Copyright (C) 2016, Linaro Ltd * * SPDX-License-Identifier: Apache-2.0 @@ -47,7 +47,7 @@ #define MBEDTLS_PLATFORM_PRINTF_ALT #define MBEDTLS_RSA_C -#define MBEDTLS_PKCS1_V15 +#define MBEDTLS_PKCS1_V21 /* mbed TLS modules */ #define MBEDTLS_ASN1_PARSE_C @@ -56,6 +56,7 @@ #define MBEDTLS_MD_C #define MBEDTLS_OID_C #define MBEDTLS_SHA256_C +#define MBEDTLS_AES_C /* Save RAM by adjusting to our exact needs */ #if MCUBOOT_SIGN_RSA_LEN == 3072 @@ -71,7 +72,6 @@ #ifdef CRYPTO_HW_ACCELERATOR_OTP_PROVISIONING #define MBEDTLS_CIPHER_C -#define MBEDTLS_AES_C #define MBEDTLS_CCM_C #define MBEDTLS_ECDSA_C #define MBEDTLS_ECP_C diff --git a/bl2/ext/mcuboot/include/hal/hal_flash.h b/bl2/ext/mcuboot/include/hal/hal_flash.h new file mode 100644 index 0000000000..dd3d206cd4 --- /dev/null +++ b/bl2/ext/mcuboot/include/hal/hal_flash.h @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Original code taken from mcuboot project at: + * https://github.com/JuulLabs-OSS/mcuboot + * Git SHA of the original version: 50d24a57516f558dac72bef634723b60c5cfb46b + * + * This file is only here for compatibility and build purposes, and was emptied + * of all its meaningful contents. + */ + +#ifndef H_HAL_FLASH_ +#define H_HAL_FLASH_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* H_HAL_FLASH_ */ diff --git a/bl2/ext/mcuboot/include/mcuboot_config/mcuboot_config.h.in b/bl2/ext/mcuboot/include/mcuboot_config/mcuboot_config.h.in index f7b52529ec..49f07dd6f6 100644 --- a/bl2/ext/mcuboot/include/mcuboot_config/mcuboot_config.h.in +++ b/bl2/ext/mcuboot/include/mcuboot_config/mcuboot_config.h.in @@ -62,6 +62,9 @@ extern "C" { */ #define MAX_BOOT_RECORD_SZ (100u) +#cmakedefine MCUBOOT_ENC_IMAGES +#cmakedefine MCUBOOT_ENCRYPT_RSA + /* * Cryptographic settings */ diff --git a/bl2/ext/mcuboot/keys.c b/bl2/ext/mcuboot/keys.c index df2497fee8..a12ef63af4 100644 --- a/bl2/ext/mcuboot/keys.c +++ b/bl2/ext/mcuboot/keys.c @@ -29,6 +29,117 @@ #include "mcuboot_config/mcuboot_config.h" #include "platform/include/tfm_plat_crypto_keys.h" +#ifdef MCUBOOT_ENC_IMAGES +unsigned char enc_priv_key[] = { + 0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, + 0xb4, 0x26, 0x14, 0x49, 0x3d, 0x16, 0x13, 0x3a, 0x6d, 0x9c, 0x84, 0xa9, + 0x8b, 0x6a, 0x10, 0x20, 0x61, 0xef, 0x48, 0x04, 0xa4, 0x4b, 0x24, 0xf3, + 0x00, 0x32, 0xac, 0x22, 0xe0, 0x30, 0x27, 0x70, 0x18, 0xe5, 0x55, 0xc8, + 0xb8, 0x05, 0x34, 0x03, 0xb0, 0xf8, 0xa5, 0x96, 0xd2, 0x48, 0x58, 0xef, + 0x70, 0xb0, 0x09, 0xdb, 0xe3, 0x58, 0x62, 0xef, 0x99, 0x63, 0x01, 0xb2, + 0x89, 0xc4, 0xb3, 0xf6, 0x9e, 0x62, 0xbf, 0x4d, 0xc2, 0x8a, 0xd0, 0xc9, + 0x4d, 0x43, 0xa3, 0xd8, 0xe5, 0x1d, 0xec, 0x62, 0x63, 0x08, 0xe2, 0x20, + 0xa5, 0xfc, 0x78, 0xd0, 0x3e, 0x74, 0xc8, 0xa4, 0x1b, 0x36, 0xad, 0x7b, + 0xf5, 0x06, 0xae, 0x4d, 0x51, 0x9b, 0x40, 0xce, 0x30, 0x4f, 0x6c, 0xea, + 0xf9, 0xe9, 0x74, 0xea, 0x06, 0xee, 0x9c, 0xe4, 0x14, 0x68, 0x20, 0xb9, + 0x3d, 0xe7, 0x11, 0x14, 0x8b, 0x25, 0xa3, 0xff, 0x4c, 0x8a, 0xf3, 0x53, + 0xee, 0x6b, 0x3e, 0xef, 0x34, 0xcd, 0x6a, 0x3f, 0x62, 0x68, 0xc0, 0xff, + 0x78, 0x4c, 0xb0, 0xc3, 0xe6, 0x96, 0x61, 0xfc, 0x1f, 0x18, 0xf1, 0x7a, + 0x82, 0xe2, 0x8f, 0x35, 0xa8, 0x2b, 0x86, 0x16, 0xa4, 0x46, 0xfb, 0xac, + 0x7e, 0x41, 0xdb, 0x02, 0x05, 0x91, 0x6d, 0xdf, 0xc1, 0xde, 0x13, 0x95, + 0x9c, 0xf9, 0x9e, 0x5e, 0x72, 0xba, 0xa7, 0x25, 0x93, 0xfb, 0xdc, 0xe8, + 0xab, 0x86, 0x45, 0x88, 0x47, 0x2d, 0xed, 0xee, 0xee, 0x97, 0x9e, 0xce, + 0x5d, 0x9b, 0x04, 0x04, 0x40, 0x7c, 0xcb, 0x7c, 0x3d, 0x2c, 0x74, 0xab, + 0xa4, 0xcc, 0x64, 0xa3, 0x5c, 0x95, 0x3d, 0xd4, 0xa2, 0xdc, 0x92, 0xb2, + 0xc8, 0x18, 0xcb, 0xf9, 0x00, 0x39, 0x81, 0x8f, 0x8f, 0x40, 0xc2, 0xdf, + 0x99, 0x29, 0xac, 0x8a, 0xc2, 0x3b, 0xd8, 0xa4, 0xf2, 0xad, 0xaf, 0x74, + 0xc0, 0x11, 0xc7, 0x99, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01, + 0x00, 0x42, 0x47, 0x80, 0x4f, 0x31, 0xda, 0x5d, 0x58, 0xb1, 0xdb, 0x54, + 0x33, 0xcc, 0xc7, 0x49, 0x07, 0xa1, 0x00, 0x98, 0x4e, 0x9c, 0xe3, 0xc8, + 0xc4, 0x5e, 0xde, 0x45, 0xd6, 0xcf, 0x04, 0xe8, 0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8f, 0xcb, + 0x71, 0x34, 0x09, 0x1b, 0x6e, 0xe6, 0x87, 0x00, 0xb5, 0xba, 0x70, 0x8a, + 0x29, 0x3d, 0x9a, 0x06, 0x18, 0x2d, 0x66, 0x5e, 0x61, 0x37, 0xeb, 0xdd, + 0x5e, 0xc8, 0x28, 0x92, 0x05, 0x30, 0xfd, 0xb8, 0x65, 0xb1, 0x7f, 0xbf, + 0x2d, 0x55, 0x12, 0x91, 0xc1, 0x02, 0x81, 0x81, 0x00, 0xda, 0x65, 0xda, + 0x38, 0x7c, 0x18, 0xfb, 0x00, 0x11, 0x60, 0xeb, 0x37, 0x65, 0xb8, 0x83, + 0x62, 0x88, 0xc4, 0x3a, 0x4e, 0x64, 0x6a, 0xf3, 0x3e, 0x4e, 0xc0, 0x34, + 0x19, 0x8a, 0xcb, 0x4a, 0xca, 0x2f, 0x5d, 0x50, 0x7a, 0xac, 0xf7, 0x9e, + 0x87, 0x5a, 0xfc, 0x4d, 0x49, 0xd7, 0xf9, 0x21, 0xf5, 0x0b, 0x6f, 0x57, + 0x41, 0x3d, 0x8f, 0xb8, 0xec, 0x7f, 0xcc, 0x92, 0x09, 0xbe, 0xd3, 0xa4, + 0xc3, 0x14, 0x85, 0x21, 0x5d, 0x05, 0xa3, 0xaa, 0x20, 0xf6, 0x62, 0x44, + 0x50, 0x03, 0x5e, 0x53, 0x4a, 0xcd, 0x6a, 0xb6, 0x65, 0x8e, 0x4e, 0x4b, + 0x3f, 0x25, 0xc6, 0x16, 0x31, 0xf5, 0x99, 0x13, 0x77, 0x42, 0xda, 0xdc, + 0x70, 0x4d, 0x65, 0xb0, 0x99, 0x0f, 0xdf, 0x5a, 0xb1, 0x45, 0xf0, 0xb9, + 0x8e, 0xa0, 0xae, 0x4f, 0x4d, 0x65, 0x09, 0x84, 0xb5, 0x38, 0x29, 0xbf, + 0x69, 0xe0, 0x88, 0x1f, 0x27, 0x02, 0x81, 0x81, 0x00, 0xd3, 0x2a, 0x59, + 0xec, 0x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0xf9, 0xdf, 0xa7, 0x73, 0x3c, 0x4f, 0x08, + 0x85, 0xce, 0x03, 0xc4, 0xdd, 0xfd, 0x70, 0x70, 0xc5, 0x99, 0x36, 0x58, + 0x43, 0x98, 0x40, 0x59, 0x02, 0x81, 0x81, 0x00, 0xd5, 0xaa, 0xfb, 0xec, + 0x8d, 0xc6, 0xdd, 0xfa, 0x2b, 0x5a, 0x24, 0xd0, 0xda, 0x58, 0xbd, 0x87, + 0x92, 0x1a, 0x29, 0x62, 0x13, 0x1d, 0x4b, 0x79, 0x1b, 0xbe, 0x79, 0x7d, + 0xad, 0x79, 0xca, 0x17, 0x75, 0xda, 0xe8, 0x32, 0xe8, 0xa0, 0x9e, 0xa8, + 0x77, 0x53, 0xac, 0x38, 0xd6, 0xeb, 0xe6, 0x22, 0x65, 0xc4, 0xaa, 0x4c, + 0xc8, 0xd0, 0x33, 0x1a, 0x1e, 0xbe, 0xbd, 0x73, 0x09, 0x4a, 0xfa, 0x85, + 0x5c, 0xf3, 0x0c, 0x9c, 0x81, 0x56, 0x30, 0xa7, 0xf7, 0x9b, 0xf4, 0x92, + 0x9c, 0x6b, 0x93, 0x6a, 0x00, 0x33, 0xdc, 0x2f, 0x54, 0x1e, 0x78, 0xd4, + 0x97, 0xec, 0x24, 0xa2, 0xdb, 0x3d, 0x03, 0x33, 0x09, 0xb2, 0x2c, 0x03, + 0x05, 0x40, 0xde, 0x52, 0xf2, 0x9b, 0xfa, 0x00, 0x8d, 0x4b, 0xfe, 0x5b, + 0x9b, 0x9c, 0x73, 0xad, 0xfb, 0x7a, 0x00, 0x42, 0x62, 0x9e, 0xa0, 0x95, + 0x55, 0x50, 0x32, 0x87 +}; +static unsigned int enc_priv_key_len = 1192; + +const struct bootutil_key bootutil_enc_key = { + .key = enc_priv_key, + .len = &enc_priv_key_len, +}; +#endif /* MCUBOOT_ENC_IMAGES */ + #if !defined(MCUBOOT_HW_KEY) #if defined(MCUBOOT_SIGN_RSA) #if MCUBOOT_SIGN_RSA_LEN == 2048 diff --git a/docs/getting_started/tfm_secure_boot.rst b/docs/getting_started/tfm_secure_boot.rst index 041da901c0..b59035208d 100644 --- a/docs/getting_started/tfm_secure_boot.rst +++ b/docs/getting_started/tfm_secure_boot.rst @@ -415,6 +415,15 @@ Compile time switches: ``LOG_LEVEL_INFO`` by default. In case of different kinds of ``Release`` builds its value is set to ``LOG_LEVEL_OFF`` (any other value will be overridden). +- MCUBOOT_ENCRYPT_RSA (default: False): + - **True:** Adds encrypted image support in the source and encrypts the + resulting image using the ``enc-rsa2048-pub.pem`` key found in the MCUBoot + repository. + - **False:** Doesn't add encrypted image support and doesn't encrypt the + image. + + .. Warning:: + DO NOT use this key in production code, it is exclusively for testing! Image versioning ================ |