Skip to content

Commit 47d5cdd

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 3e102e4 commit 47d5cdd

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
@@ -70,6 +70,11 @@ add_code
7070
" !defined(MBEDTLS_ENTROPY_HARDWARE_ALT) && !defined(MBEDTLS_ENTROPY_NV_SEED)\n" \
7171
"#error \"No entropy source was found at build time, so TLS \" \\\\\n" \
7272
" \"functionality is not available\"\n" \
73+
"#endif\n" \
74+
"\n" \
75+
"#if defined(FEATURE_EXPERIMENTAL_API) && defined(FEATURE_PSA)\n" \
76+
" #define MBEDTLS_PSA_HAS_ITS_IO\n" \
77+
" #define MBEDTLS_USE_PSA_CRYPTO\n" \
7378
"#endif\n"
7479

7580
# 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
@@ -89,10 +89,6 @@
8989
"features": [
9090
"PSA"
9191
],
92-
"macros_add": [
93-
"MBEDTLS_PSA_HAS_ITS_IO",
94-
"MBEDTLS_USE_PSA_CRYPTO"
95-
],
9692
"public": false,
9793
"config": {}
9894
},
@@ -6233,10 +6229,6 @@
62336229
"features_add": [
62346230
"PSA"
62356231
],
6236-
"macros_add": [
6237-
"MBEDTLS_PSA_HAS_ITS_IO",
6238-
"MBEDTLS_USE_PSA_CRYPTO"
6239-
],
62406232
"extra_labels_add": [
62416233
"MBED_PSA_SRV"
62426234
],
@@ -6764,9 +6756,7 @@
67646756
],
67656757
"macros_add": [
67666758
"CY8C624ABZI_D44",
6767-
"CYBSP_WIFI_CAPABLE",
6768-
"MBEDTLS_PSA_HAS_ITS_IO",
6769-
"MBEDTLS_USE_PSA_CRYPTO"
6759+
"CYBSP_WIFI_CAPABLE"
67706760
],
67716761
"device_name": "CY8C624ABZI-D44",
67726762
"mbed_ram_start": "0x08002000",
@@ -6895,9 +6885,7 @@
68956885
"macros_add": [
68966886
"CYB0644ABZI_S2D44",
68976887
"CYBSP_WIFI_CAPABLE",
6898-
"TFM_MULTI_CORE_MULTI_CLIENT_CALL=1",
6899-
"MBEDTLS_PSA_HAS_ITS_IO",
6900-
"MBEDTLS_USE_PSA_CRYPTO"
6888+
"TFM_MULTI_CORE_MULTI_CLIENT_CALL=1"
69016889
],
69026890
"detect_code": [
69036891
"190A"
@@ -6952,9 +6940,7 @@
69526940
"macros_add": [
69536941
"CYB0644ABZI_S2D44",
69546942
"CYBSP_WIFI_CAPABLE",
6955-
"TFM_MULTI_CORE_MULTI_CLIENT_CALL=1",
6956-
"MBEDTLS_PSA_HAS_ITS_IO",
6957-
"MBEDTLS_USE_PSA_CRYPTO"
6943+
"TFM_MULTI_CORE_MULTI_CLIENT_CALL=1"
69586944
],
69596945
"detect_code": [
69606946
"190A"
@@ -7322,9 +7308,7 @@
73227308
"1702"
73237309
],
73247310
"macros_add": [
7325-
"GD32F450",
7326-
"MBEDTLS_PSA_HAS_ITS_IO",
7327-
"MBEDTLS_USE_PSA_CRYPTO"
7311+
"GD32F450"
73287312
],
73297313
"bootloader_supported": true,
73307314
"release_versions": [

0 commit comments

Comments
 (0)