mbedtls: Run mbedtls_timing_self_test if MBEDTLS_TIMING_C

This allows us to verify the support for Mbed TLS timing on Mbed OS.

Note: The macros MBEDTLS_TIMING_C and MBEDTLS_TIMING_ALT are not
enabled by default and need to be additionally enabled to run this
test.
pull/14772/head
Lingkai Dong 2021-06-11 12:32:59 +01:00
parent ca719a96a8
commit d6f825ebf0
1 changed files with 9 additions and 0 deletions

View File

@ -35,6 +35,7 @@ using namespace utest::v1;
#include "mbedtls/sha512.h"
#include "mbedtls/entropy.h"
#include "mbedtls/entropy_poll.h"
#include "mbedtls/timing.h"
#include <string.h>
@ -65,6 +66,10 @@ MBEDTLS_SELF_TEST_TEST_CASE(mbedtls_sha512_self_test)
MBEDTLS_SELF_TEST_TEST_CASE(mbedtls_entropy_self_test)
#endif
#if defined(MBEDTLS_TIMING_C)
MBEDTLS_SELF_TEST_TEST_CASE(mbedtls_timing_self_test)
#endif
#else
#warning "MBEDTLS_SELF_TEST not enabled"
#endif /* MBEDTLS_SELF_TEST */
@ -84,6 +89,10 @@ Case cases[] = {
Case("mbedtls_entropy_self_test", mbedtls_entropy_self_test_test_case),
#endif
#if defined(MBEDTLS_TIMING_C)
Case("mbedtls_timing_self_test", mbedtls_timing_self_test_test_case),
#endif
#endif /* MBEDTLS_SELF_TEST */
};