Skip to content

Commit faf6152

Browse files
ahasztagnvlsianpu
authored andcommitted
[nrf fromtree] 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]> (cherry picked from commit 5ee96f5)
1 parent 81f694c commit faf6152

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
@@ -206,7 +206,10 @@ else()
206206
endif()
207207

208208
if(CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 OR CONFIG_BOOT_ENCRYPT_EC256)
209-
if(MBEDTLS_ASN1_DIR)
209+
# When ECDSA PSA is used, do not pull in additional ASN.1 include
210+
# directories or sources, as it would cause incorrect header files
211+
# to be included.
212+
if(MBEDTLS_ASN1_DIR AND NOT CONFIG_BOOT_ECDSA_PSA)
210213
zephyr_library_include_directories(
211214
${MBEDTLS_ASN1_DIR}/include
212215
)

boot/zephyr/Kconfig

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

116116
endif # BOOT_ENCRYPT_IMAGE
117117

118+
config BOOT_ECDSA_PSA_DEPENDENCIES
119+
bool
120+
select PSA_WANT_ALG_ECDSA
121+
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT
122+
select PSA_WANT_ECC_SECP_R1_256
123+
help
124+
Dependencies for ECDSA signature
125+
118126
if MBEDTLS_ENABLE_HEAP
119127

120128
config MBEDTLS_HEAP_SIZE
@@ -288,6 +296,16 @@ config BOOT_ECDSA_CC310
288296
select NRF_CC310_BL
289297
select NRFXLIB_CRYPTO
290298
select BOOT_USE_CC310
299+
300+
config BOOT_ECDSA_PSA
301+
bool "Use psa cryptoo"
302+
select BOOT_USE_PSA_CRYPTO
303+
select PSA_CRYPTO_CLIENT
304+
select PSA_CRYPTO_C
305+
select BOOT_IMG_HASH_ALG_SHA256_ALLOW
306+
select BOOT_IMG_HASH_ALG_SHA512_ALLOW
307+
select BOOT_ECDSA_PSA_DEPENDENCIES
308+
291309
endchoice # Ecdsa implementation
292310
endif
293311

0 commit comments

Comments
 (0)