From 231a0adb6abc35c125d4177749af37042575eca2 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Mon, 24 Apr 2023 11:35:40 +0200 Subject: [PATCH 1/6] fix(stm32mp1): remove boolean check on PLAT_TBBR_IMG_DEF This flag just needs to be defined, and does not need to have a boolean value. Remove it from the assert_booleans check. Signed-off-by: Yann Gautier Change-Id: I4e4c9ae1e5003ca2cf7c0c0e31d1561d032937c8 --- plat/st/stm32mp1/platform.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plat/st/stm32mp1/platform.mk b/plat/st/stm32mp1/platform.mk index 1d93983a8..75c23833e 100644 --- a/plat/st/stm32mp1/platform.mk +++ b/plat/st/stm32mp1/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -158,7 +158,6 @@ $(eval $(call assert_booleans,\ $(sort \ PKA_USE_BRAINPOOL_P256T1 \ PKA_USE_NIST_P256 \ - PLAT_TBBR_IMG_DEF \ STM32MP_CRYPTO_ROM_LIB \ STM32MP_DDR_32BIT_INTERFACE \ STM32MP_DDR_DUAL_AXI_PORT \ From e0e2d64f47654e4d86d0e400977eab0e4a01523e Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Mon, 24 Apr 2023 11:44:51 +0200 Subject: [PATCH 2/6] fix(stm32mp1): always define PKA algos flags The flags to set PKA algo are set to 0 when TRUSTED_BOARD_BOOT is not set. Signed-off-by: Yann Gautier Change-Id: Ib70a2bc51451a2047d7a50a8307e9063d4a2a0ee --- plat/st/stm32mp1/platform.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plat/st/stm32mp1/platform.mk b/plat/st/stm32mp1/platform.mk index 75c23833e..55423aebb 100644 --- a/plat/st/stm32mp1/platform.mk +++ b/plat/st/stm32mp1/platform.mk @@ -73,6 +73,9 @@ $(error "DECRYPTION_SUPPORT not supported on STM32MP15") endif endif +PKA_USE_NIST_P256 ?= 0 +PKA_USE_BRAINPOOL_P256T1 ?= 0 + ifeq ($(AARCH32_SP),sp_min) # Disable Neon support: sp_min runtime may conflict with non-secure world TF_CFLAGS += -mfloat-abi=soft From 6a187a002ee72ef865222870b2ecf99cf4d4efb8 Mon Sep 17 00:00:00 2001 From: Lionel Debieve Date: Wed, 3 May 2023 11:40:09 +0200 Subject: [PATCH 3/6] fix(st-crypto): move flag control into source code Remove the control from the include file to avoid compilation issue. Add the check in the source code instead. Signed-off-by: Lionel Debieve Change-Id: I533f829607f76389399a3e8dbc3c6095278562ab --- drivers/st/crypto/stm32_pka.c | 7 ++++++- include/drivers/st/stm32_pka.h | 15 +-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/st/crypto/stm32_pka.c b/drivers/st/crypto/stm32_pka.c index 2bbb31dc5..5dfad9ab9 100644 --- a/drivers/st/crypto/stm32_pka.c +++ b/drivers/st/crypto/stm32_pka.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, STMicroelectronics - All Rights Reserved + * Copyright (c) 2022-2023, STMicroelectronics - All Rights Reserved * * SPDX-License-Identifier: BSD-3-Clause */ @@ -19,6 +19,11 @@ #include +#if !PKA_USE_NIST_P256 && !PKA_USE_BRAINPOOL_P256R1 && !PKA_USE_BRAINPOOL_P256T1 && \ + !PKA_USE_NIST_P521 +#error "At least one ECDSA curve needs to be selected" +#endif + /* * For our comprehension in this file * _len are in BITs diff --git a/include/drivers/st/stm32_pka.h b/include/drivers/st/stm32_pka.h index ad4690ae5..34b3f6b5f 100644 --- a/include/drivers/st/stm32_pka.h +++ b/include/drivers/st/stm32_pka.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, STMicroelectronics - All Rights Reserved + * Copyright (c) 2022-2023, STMicroelectronics - All Rights Reserved * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,24 +9,11 @@ #include -#if !PKA_USE_NIST_P256 && !PKA_USE_BRAINPOOL_P256R1 && !PKA_USE_BRAINPOOL_P256T1 && \ - !PKA_USE_NIST_P521 -#error "At least one ECDSA curve needs to be selected" -#endif - enum stm32_pka_ecdsa_curve_id { -#if PKA_USE_NIST_P256 PKA_NIST_P256, -#endif -#if PKA_USE_BRAINPOOL_P256R1 PKA_BRAINPOOL_P256R1, -#endif -#if PKA_USE_BRAINPOOL_P256T1 PKA_BRAINPOOL_P256T1, -#endif -#if PKA_USE_NIST_P521 PKA_NIST_P521, -#endif }; struct stm32_pka_platdata { From 115ab63872ab36f8202f4c4aab093c4e9182d4e7 Mon Sep 17 00:00:00 2001 From: Manish Pandey Date: Tue, 2 May 2023 13:43:22 +0100 Subject: [PATCH 4/6] fix(a5ds): add default value for ARM_DISABLE_TRUSTED_WDOG With introduction of check on boolean flags, it should be ensured that each boolean flag has default value provided by platform. Signed-off-by: Manish Pandey Change-Id: Ia92c3dded842e14099b4a7667569605d7066a8f9 --- plat/arm/board/a5ds/platform.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plat/arm/board/a5ds/platform.mk b/plat/arm/board/a5ds/platform.mk index 4f873069a..6fcf080a1 100644 --- a/plat/arm/board/a5ds/platform.mk +++ b/plat/arm/board/a5ds/platform.mk @@ -100,6 +100,8 @@ NEED_BL32 := yes MULTI_CONSOLE_API := 1 +ARM_DISABLE_TRUSTED_WDOG := 1 + PLAT_BL_COMMON_SOURCES += lib/xlat_tables/aarch32/nonlpae_tables.c # Use translation tables library v1 when using Cortex-A5 From 4d32f9138d61719bbaab57fdd853877a7e06b1cd Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Mon, 24 Apr 2023 13:31:27 +0200 Subject: [PATCH 5/6] fix(build): add a default value for INVERTED_MEMMAP It is needed to check the validity of boolean flags with the updated macro assert_boolean. Signed-off-by: Yann Gautier Change-Id: I185beb55606a4ca435d2fee2092fc61725859aa1 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 7368ca59b..4ef02c6c8 100644 --- a/Makefile +++ b/Makefile @@ -1058,6 +1058,7 @@ PYTHON ?= python3 # Variables for use with PRINT_MEMORY_MAP PRINT_MEMORY_MAP_PATH ?= tools/memory PRINT_MEMORY_MAP ?= ${PRINT_MEMORY_MAP_PATH}/print_memory_map.py +INVERTED_MEMMAP ?= 0 # Variables for use with documentation build using Sphinx tool DOCS_PATH ?= docs From 1369fb82c8e809c1a59a0d99184dbfd2d0b81afa Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Mon, 24 Apr 2023 13:38:12 +0200 Subject: [PATCH 6/6] build!: check boolean flags are not empty For numeric flags, there is a check for the value to be set. Do the same for boolean flags. This avoids issues where a flag is defined but without a value, leading to potential unexpected behaviors. Signed-off-by: Yann Gautier Change-Id: Ib00da2784339471058887e93434d96ccba2aebb2 --- make_helpers/build_macros.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index 9ca6bdf0c..cb204a824 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -73,6 +73,7 @@ endef # Convenience function for verifying option has a boolean value # $(eval $(call assert_boolean,FOO)) will assert FOO is 0 or 1 define assert_boolean + $(if $($(1)),,$(error $(1) must not be empty)) $(if $(filter-out 0 1,$($1)),$(error $1 must be boolean)) endef