mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-26 15:08:51 +03:00
Enable the timing.c selftest with MBEDTLS_TIMING_ALT
This caused trouble for users that were using the selftest feature along with an alternative implementation. They were forced to provide their own version of a selftest. Since it was not mentioned in the define description, it should not be required, and is provided roughly as it was before breaking changes in 77daaad198 were introduced. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
parent
160df1d136
commit
cf4e9999bc
@ -352,9 +352,9 @@ int mbedtls_timing_get_delay(void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !MBEDTLS_TIMING_ALT */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST)
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Busy-waits for the given number of milliseconds.
|
* Busy-waits for the given number of milliseconds.
|
||||||
* Used for testing mbedtls_timing_hardclock.
|
* Used for testing mbedtls_timing_hardclock.
|
||||||
@ -383,9 +383,8 @@ static void busy_msleep(unsigned long msec)
|
|||||||
mbedtls_printf(" cycles=%lu ratio=%lu millisecs=%lu secs=%lu hardfail=%d a=%lu b=%lu\n", \
|
mbedtls_printf(" cycles=%lu ratio=%lu millisecs=%lu secs=%lu hardfail=%d a=%lu b=%lu\n", \
|
||||||
cycles, ratio, millisecs, secs, hardfail, \
|
cycles, ratio, millisecs, secs, hardfail, \
|
||||||
(unsigned long) a, (unsigned long) b); \
|
(unsigned long) a, (unsigned long) b); \
|
||||||
mbedtls_printf(" elapsed(hires)=%lu elapsed(ctx)=%lu status(ctx)=%d\n", \
|
mbedtls_printf(" elapsed(hires)=%lu status(ctx)=%d\n", \
|
||||||
mbedtls_timing_get_timer(&hires, 0), \
|
mbedtls_timing_get_timer(&hires, 0), \
|
||||||
mbedtls_timing_get_timer(&ctx.timer, 0), \
|
|
||||||
mbedtls_timing_get_delay(&ctx)); \
|
mbedtls_timing_get_delay(&ctx)); \
|
||||||
} \
|
} \
|
||||||
return 1; \
|
return 1; \
|
||||||
@ -526,5 +525,4 @@ hard_test_done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_SELF_TEST */
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
#endif /* !MBEDTLS_TIMING_ALT */
|
|
||||||
#endif /* MBEDTLS_TIMING_C */
|
#endif /* MBEDTLS_TIMING_C */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user