Skip to content

Commit

Permalink
[noup] zephyr: mbedtls: add crypto module test
Browse files Browse the repository at this point in the history
Add crypto module test under macro
CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_TEST,
so that developer can enable it for crypto debug test.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
  • Loading branch information
fengming-ye authored and jukkar committed Oct 8, 2024
1 parent f6792cb commit d84b1ea
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion port/mbedtls/supp_psa_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
*/

#include "supp_psa_api.h"
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_TEST
#include "module_tests.h"
#endif

#define ASSERT_STATUS(actual, expected) \
do \
Expand Down Expand Up @@ -460,7 +463,24 @@ int pbkdf2_sha1_psa(mbedtls_md_type_t md_alg, const u8 *password, size_t plen,

int supp_psa_crypto_init(void)
{
return psa_crypto_init();
int ret;

ret = (int)psa_crypto_init();
if (ret)
{
printk("supp_psa_crypto_init failed ret %d", ret);
return ret;
}

#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_TEST
ret = crypto_module_tests();
if (ret)
{
printk("crypto_module_tests failed ret %d", ret);
return ret;
}
#endif
return ret;
}

void supp_psa_crypto_deinit(void)
Expand Down

0 comments on commit d84b1ea

Please sign in to comment.