aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Jaouen <michel.jaouen@st.com>2021-04-30 14:19:06 +0200
committerAnton Komlev <Anton.Komlev@arm.com>2021-05-06 00:38:33 +0200
commit76e9c4aca05bf7a366041303f49aa615497408b7 (patch)
tree7f1b8247c0b33c7ffec31f31146cef92c2672aff
parentfd7164f224bba9f9b760a3b7a1fbf9fa46b6d5e6 (diff)
downloadtrusted-firmware-m-76e9c4aca05bf7a366041303f49aa615497408b7.tar.gz
Platform: stm/stm32l562dk: Add support for MCUBOOT_FIH_PROFILE HIGN
Change-Id: Icd9de51c0919e497e6e8cda2d38433b806455216 Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
-rw-r--r--platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt4
-rw-r--r--platform/ext/target/stm/common/stm32l5xx/bl2/boot_hal.c13
-rw-r--r--platform/ext/target/stm/stm32l562e_dk/accelerator/mbedtls_accelerator_config.h2
3 files changed, 18 insertions, 1 deletions
diff --git a/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt b/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt
index b556ce228..03aa9baac 100644
--- a/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt
+++ b/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt
@@ -166,6 +166,7 @@ if(BL2)
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_rcc_ex.c
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c
@@ -174,6 +175,9 @@ if(BL2)
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_hash.c
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_hash_ex.c
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pka.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_rng.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_rng_ex.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/low_level_rng.c
)
target_compile_options(platform_bl2
diff --git a/platform/ext/target/stm/common/stm32l5xx/bl2/boot_hal.c b/platform/ext/target/stm/common/stm32l5xx/bl2/boot_hal.c
index 92d29d205..96011db45 100644
--- a/platform/ext/target/stm/common/stm32l5xx/bl2/boot_hal.c
+++ b/platform/ext/target/stm/common/stm32l5xx/bl2/boot_hal.c
@@ -27,6 +27,10 @@
#include "cmsis.h"
#include "Driver_Flash.h"
#include "region_defs.h"
+#ifdef CRYPTO_HW_ACCELERATOR
+#include "crypto_hw.h"
+#endif
+#include "bootutil/fault_injection_hardening.h"
#if defined(EXTERNAL_FLASH)
#include "flash_map_backend/flash_map_backend.h"
#endif /* defined(EXTERNAL_FLASH) */
@@ -193,7 +197,16 @@ int32_t boot_platform_init(void)
- Set NVIC Group Priority to 3
- Low Level Initialization
*/
+ int result;
HAL_Init();
+#ifdef CRYPTO_HW_ACCELERATOR
+ result = crypto_hw_accelerator_init();
+ if (result) {
+ BOOT_LOG_ERR("Error while initializing Crypto Hw");
+ Error_Handler();
+ }
+ (void)fih_delay_init();
+#endif /* CRYPTO_HW_ACCELERATOR */
/* Configure the System clock to have a frequency of 110 MHz */
SystemClock_Config();
diff --git a/platform/ext/target/stm/stm32l562e_dk/accelerator/mbedtls_accelerator_config.h b/platform/ext/target/stm/stm32l562e_dk/accelerator/mbedtls_accelerator_config.h
index 5b22c9424..89473e4b4 100644
--- a/platform/ext/target/stm/stm32l562e_dk/accelerator/mbedtls_accelerator_config.h
+++ b/platform/ext/target/stm/stm32l562e_dk/accelerator/mbedtls_accelerator_config.h
@@ -20,7 +20,7 @@ extern "C" {
#undef MBEDTLS_ECP_NIST_OPTIM
#define MBEDTLS_PLATFORM_ENTROPY
#define MBEDTLS_ENTROPY_C
-
+#define MBEDTLS_CTR_DRBG_C
#define MBEDTLS_ENTROPY_HARDWARE_ALT