mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 17:55:40 +01:00
Timing self test: increased duration
Increase the duration of the self test, otherwise it tends to fail on a busy machine even with the recently upped tolerance. But run the loop only once, it's enough for a simple smoke test.
This commit is contained in:
parent
0f59b130a9
commit
8873bcc4de
@ -6,7 +6,8 @@ Features
|
|||||||
* Allow comments in test data files.
|
* Allow comments in test data files.
|
||||||
* The selftest program can execute a subset of the tests based on command
|
* The selftest program can execute a subset of the tests based on command
|
||||||
line arguments.
|
line arguments.
|
||||||
* New unit tests for timing.
|
* New unit tests for timing. Improve the self-test to be more robust
|
||||||
|
when run on a heavily-loaded machine.
|
||||||
|
|
||||||
Bugfix
|
Bugfix
|
||||||
* Fix memory leak in mbedtls_ssl_set_hostname() when called multiple times.
|
* Fix memory leak in mbedtls_ssl_set_hostname() when called multiple times.
|
||||||
|
@ -444,29 +444,23 @@ int mbedtls_timing_self_test( int verbose )
|
|||||||
if( verbose != 0 )
|
if( verbose != 0 )
|
||||||
mbedtls_printf( " TIMING test #2 (set/get_delay ): " );
|
mbedtls_printf( " TIMING test #2 (set/get_delay ): " );
|
||||||
|
|
||||||
for( a = 200; a <= 400; a += 200 )
|
|
||||||
{
|
{
|
||||||
for( b = 200; b <= 400; b += 200 )
|
a = 800;
|
||||||
{
|
b = 400;
|
||||||
mbedtls_timing_set_delay( &ctx, a, a + b );
|
mbedtls_timing_set_delay( &ctx, a, a + b ); /* T = 0 */
|
||||||
|
|
||||||
busy_msleep( a - a / 4 );
|
busy_msleep( a - a / 4 ); /* T = a - a/4 */
|
||||||
if( mbedtls_timing_get_delay( &ctx ) != 0 )
|
if( mbedtls_timing_get_delay( &ctx ) != 0 )
|
||||||
FAIL;
|
FAIL;
|
||||||
|
|
||||||
busy_msleep( a / 2 );
|
busy_msleep( a / 4 + b / 4 ); /* T = a + b/4 */
|
||||||
if( mbedtls_timing_get_delay( &ctx ) != 1 )
|
if( mbedtls_timing_get_delay( &ctx ) != 1 )
|
||||||
FAIL;
|
FAIL;
|
||||||
|
|
||||||
busy_msleep( b - a / 4 - b / 4 );
|
busy_msleep( b ); /* T = a + b + b/4 */
|
||||||
if( mbedtls_timing_get_delay( &ctx ) != 1 )
|
|
||||||
FAIL;
|
|
||||||
|
|
||||||
busy_msleep( b / 2 );
|
|
||||||
if( mbedtls_timing_get_delay( &ctx ) != 2 )
|
if( mbedtls_timing_get_delay( &ctx ) != 2 )
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mbedtls_timing_set_delay( &ctx, 0, 0 );
|
mbedtls_timing_set_delay( &ctx, 0, 0 );
|
||||||
busy_msleep( 200 );
|
busy_msleep( 200 );
|
||||||
|
Loading…
Reference in New Issue
Block a user