Skip to content

Commit d3b3aa1

Browse files
fengming-yenashif
authored andcommitted
hostap: add PSA apis support for mbedtls 3.x
Add Platform Secure Architecture support support to use HW acceleration, which needs to be called under PSA driver wrapper in mbedtls 3.x. Signed-off-by: Fengming Ye <[email protected]>
1 parent 6f0c836 commit d3b3aa1

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

modules/hostap/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,10 @@ zephyr_library_sources(
419419
${HOSTAP_SRC_BASE}/crypto/rc4.c
420420
)
421421

422+
zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA
423+
${HOSTAP_BASE}/port/mbedtls/supp_psa_api.c
424+
)
425+
422426
zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
423427
${HOSTAP_SRC_BASE}/crypto/ms_funcs.c
424428
${HOSTAP_SRC_BASE}/crypto/aes-eax.c

modules/hostap/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE
152152

153153
endchoice
154154

155+
config WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA
156+
bool "Crypto Platform Secure Architecture support for WiFi"
157+
default y if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT
158+
help
159+
Support Mbedtls 3.x to use PSA apis instead of legacy apis.
160+
155161
config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
156162
bool "Enterprise Crypto support for WiFi"
157163
depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE

modules/hostap/src/supp_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ LOG_MODULE_REGISTER(wifi_supplicant, CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL);
1414
#if !defined(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE) && !defined(CONFIG_MBEDTLS_ENABLE_HEAP)
1515
#include <mbedtls/platform.h>
1616
#endif /* !CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE && !CONFIG_MBEDTLS_ENABLE_HEAP */
17+
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA
18+
#include "supp_psa_api.h"
19+
#endif
1720

1821
#include <zephyr/net/wifi_mgmt.h>
1922
#include <zephyr/net/wifi_nm.h>
@@ -523,6 +526,10 @@ static void handler(void)
523526
mbedtls_platform_set_calloc_free(calloc, free);
524527
#endif /* !CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE && !CONFIG_MBEDTLS_ENABLE_HEAP */
525528

529+
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA
530+
supp_psa_crypto_init();
531+
#endif
532+
526533
ctx = get_default_context();
527534

528535
k_work_queue_init(&ctx->iface_wq);

0 commit comments

Comments
 (0)