From 8903fe0fd3d5878649ebb00a74963dcde58e7fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 12 May 2015 19:30:45 +0200 Subject: [PATCH] Define timing_selftest() even with TIMING_ALT --- include/mbedtls/timing.h | 16 ++++++++++++---- library/timing.c | 8 ++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/mbedtls/timing.h b/include/mbedtls/timing.h index 5ad4f9e7c..0ef182772 100644 --- a/include/mbedtls/timing.h +++ b/include/mbedtls/timing.h @@ -79,6 +79,18 @@ void mbedtls_set_alarm( int seconds ); */ void mbedtls_timing_m_sleep( int milliseconds ); +#ifdef __cplusplus +} +#endif + +#else /* MBEDTLS_TIMING_ALT */ +#include "timing_alt.h" +#endif /* MBEDTLS_TIMING_ALT */ + +#ifdef __cplusplus +extern "C" { +#endif + #if defined(MBEDTLS_SELF_TEST) /** * \brief Checkup routine @@ -92,8 +104,4 @@ int mbedtls_timing_self_test( int verbose ); } #endif -#else /* MBEDTLS_TIMING_ALT */ -#include "timing_alt.h" -#endif /* MBEDTLS_TIMING_ALT */ - #endif /* timing.h */ diff --git a/library/timing.c b/library/timing.c index d9fb89452..13a529ad0 100644 --- a/library/timing.c +++ b/library/timing.c @@ -33,10 +33,12 @@ #define mbedtls_printf printf #endif -#if defined(MBEDTLS_TIMING_C) && !defined(MBEDTLS_TIMING_ALT) +#if defined(MBEDTLS_TIMING_C) #include "mbedtls/timing.h" +#if !defined(MBEDTLS_TIMING_ALT) + #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) #include @@ -333,6 +335,8 @@ void mbedtls_timing_m_sleep( int milliseconds ) #endif /* _WIN32 && !EFIX64 && !EFI32 */ +#endif /* !MBEDTLS_TIMING_ALT */ + #if defined(MBEDTLS_SELF_TEST) /* To test mbedtls_net_usleep against our functions */ @@ -501,4 +505,4 @@ hard_test: #endif /* MBEDTLS_SELF_TEST */ -#endif /* MBEDTLS_TIMING_C && !MBEDTLS_TIMING_ALT */ +#endif /* MBEDTLS_TIMING_C */