Skip to content

Commit 4961d4a

Browse files
committed
psa: Configure Mbed TLS to use PSA as needed
Configure Mbed TLS to automatically enable PSA as needed. When Mbed OS is configured to use PSA, configure Mbed TLS to use PSA. This prevents leaking of the "how to make Mbed TLS use PSA" knowledge up into targets.json, and thus makes porting simpler. There is now one place where "how to make TLS use PSA" exists rather than repeated throughout targets.json for each target that can't inherit from PSA_Target.
1 parent b38c5ed commit 4961d4a

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

features/mbedtls/importer/adjust-config.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ prepend_code
8383
"#error \"No entropy source was found at build time, so TLS \" \\\\\n" \
8484
" \"functionality is not available\"\n" \
8585
"#endif\n" \
86+
"\n" \
87+
"#if defined(FEATURE_EXPERIMENTAL_API) && defined(FEATURE_PSA)\n" \
88+
" #define MBEDTLS_PSA_HAS_ITS_IO\n" \
89+
" #define MBEDTLS_USE_PSA_CRYPTO\n" \
90+
"#endif\n" \
8691
"\n"
8792

8893
# not supported on mbed OS, nor used by mbed Client

targets/targets.json

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@
9393
"features": [
9494
"PSA"
9595
],
96-
"macros_add": [
97-
"MBEDTLS_PSA_HAS_ITS_IO",
98-
"MBEDTLS_USE_PSA_CRYPTO"
99-
],
10096
"public": false,
10197
"config": {}
10298
},
@@ -6273,10 +6269,6 @@
62736269
"features_add": [
62746270
"PSA"
62756271
],
6276-
"macros_add": [
6277-
"MBEDTLS_PSA_HAS_ITS_IO",
6278-
"MBEDTLS_USE_PSA_CRYPTO"
6279-
],
62806272
"extra_labels_add": [
62816273
"MBED_PSA_SRV"
62826274
],
@@ -6621,9 +6613,7 @@
66216613
],
66226614
"macros_add": [
66236615
"CY8C624ABZI_D44",
6624-
"CYBSP_WIFI_CAPABLE",
6625-
"MBEDTLS_PSA_HAS_ITS_IO",
6626-
"MBEDTLS_USE_PSA_CRYPTO"
6616+
"CYBSP_WIFI_CAPABLE"
66276617
],
66286618
"device_name": "CY8C624ABZI-D44",
66296619
"mbed_ram_start": "0x08002000",
@@ -6752,9 +6742,7 @@
67526742
"macros_add": [
67536743
"CYB0644ABZI_S2D44",
67546744
"CYBSP_WIFI_CAPABLE",
6755-
"TFM_MULTI_CORE_MULTI_CLIENT_CALL=1",
6756-
"MBEDTLS_PSA_HAS_ITS_IO",
6757-
"MBEDTLS_USE_PSA_CRYPTO"
6745+
"TFM_MULTI_CORE_MULTI_CLIENT_CALL=1"
67586746
],
67596747
"detect_code": [
67606748
"190A"
@@ -6809,9 +6797,7 @@
68096797
"macros_add": [
68106798
"CYB0644ABZI_S2D44",
68116799
"CYBSP_WIFI_CAPABLE",
6812-
"TFM_MULTI_CORE_MULTI_CLIENT_CALL=1",
6813-
"MBEDTLS_PSA_HAS_ITS_IO",
6814-
"MBEDTLS_USE_PSA_CRYPTO"
6800+
"TFM_MULTI_CORE_MULTI_CLIENT_CALL=1"
68156801
],
68166802
"detect_code": [
68176803
"190A"
@@ -7179,9 +7165,7 @@
71797165
"1702"
71807166
],
71817167
"macros_add": [
7182-
"GD32F450",
7183-
"MBEDTLS_PSA_HAS_ITS_IO",
7184-
"MBEDTLS_USE_PSA_CRYPTO"
7168+
"GD32F450"
71857169
],
71867170
"bootloader_supported": true,
71877171
"release_versions": [

0 commit comments

Comments
 (0)