Skip to content

Commit 5ee96f5

Browse files
ahasztagde-nordic
authored andcommitted
zephyr: Enable building ECDSA PSA variant
Adds Kconfig option CONFIG_BOOT_ECDSA_PSA that allows to switch ECDSA to PSA backend. Signed-off-by: Artur Hadasz <[email protected]>
1 parent 461e060 commit 5ee96f5

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ else()
180180
endif()
181181

182182
if(CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 OR CONFIG_BOOT_ENCRYPT_EC256)
183-
if(MBEDTLS_ASN1_DIR)
183+
# When ECDSA PSA is used, do not pull in additional ASN.1 include
184+
# directories or sources, as it would cause incorrect header files
185+
# to be included.
186+
if(MBEDTLS_ASN1_DIR AND NOT CONFIG_BOOT_ECDSA_PSA)
184187
zephyr_library_include_directories(
185188
${MBEDTLS_ASN1_DIR}/include
186189
)

boot/zephyr/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ config BOOT_X25519_PSA_DEPENDENCIES
113113

114114
endif # BOOT_ENCRYPT_IMAGE
115115

116+
config BOOT_ECDSA_PSA_DEPENDENCIES
117+
bool
118+
select PSA_WANT_ALG_ECDSA
119+
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT
120+
select PSA_WANT_ECC_SECP_R1_256
121+
help
122+
Dependencies for ECDSA signature
123+
116124
if MBEDTLS_ENABLE_HEAP
117125

118126
config MBEDTLS_HEAP_SIZE
@@ -282,6 +290,16 @@ config BOOT_ECDSA_CC310
282290
select NRF_CC310_BL
283291
select NRFXLIB_CRYPTO
284292
select BOOT_USE_CC310
293+
294+
config BOOT_ECDSA_PSA
295+
bool "Use psa cryptoo"
296+
select BOOT_USE_PSA_CRYPTO
297+
select PSA_CRYPTO_CLIENT
298+
select PSA_CRYPTO_C
299+
select BOOT_IMG_HASH_ALG_SHA256_ALLOW
300+
select BOOT_IMG_HASH_ALG_SHA512_ALLOW
301+
select BOOT_ECDSA_PSA_DEPENDENCIES
302+
285303
endchoice # Ecdsa implementation
286304
endif
287305

0 commit comments

Comments
 (0)