Skip to content

Commit 22bf92b

Browse files
Ron EldorRon Eldor
authored andcommitted
Initialize platform in trng test
Add calls to `mbedtls_platform_setup()` and `mbedtls_platform_terminate()` to the trng greentea test, to initialize the hardware acceleration engines, in some platforms.
1 parent f95ec95 commit 22bf92b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

TESTS/mbed_hal/trng/main.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#include "base64b.h"
4444
#include "pithy.h"
4545
#include <stdio.h>
46+
#include "mbedtls/config.h"
47+
#include "mbedtls/platform.h"
4648

4749
#if !DEVICE_TRNG
4850
#error [NOT_SUPPORTED] TRNG API not supported for this target
@@ -268,11 +270,17 @@ Specification specification(greentea_test_setup, cases, greentea_test_teardown_h
268270

269271
int main()
270272
{
273+
int ret = 0;
274+
#if defined(MBEDTLS_PLATFORM_C)
275+
ret = mbedtls_platform_setup(NULL);
276+
#endif /* MBEDTLS_PLATFORM_C */
271277
#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
272278
inject_entropy_for_psa();
273279
#endif
274-
bool ret = !Harness::run(specification);
275-
280+
ret = !Harness::run(specification);
281+
#if defined(MBEDTLS_PLATFORM_C)
282+
mbedtls_platform_teardown(NULL);
283+
#endif /* MBEDTLS_PLATFORM_C */
276284
return ret;
277285
}
278286

0 commit comments

Comments
 (0)