Timing self test: increased tolerance

mbedtls_timing_self_test fails annoyingly often when running on a busy
machine such as can be expected of a continous integration system.
Increase the tolerances in the delay test, to reduce the chance of
failures that are only due to missing a deadline on a busy machine.
This commit is contained in:
Gilles Peskine 2017-10-17 19:39:04 +02:00
parent a66fb3f221
commit e2bf3b802a

View File

@ -445,19 +445,19 @@ int mbedtls_timing_self_test( int verbose )
{
mbedtls_timing_set_delay( &ctx, a, a + b );
busy_msleep( a - a / 8 );
busy_msleep( a - a / 4 );
if( mbedtls_timing_get_delay( &ctx ) != 0 )
FAIL;
busy_msleep( a / 4 );
busy_msleep( a / 2 );
if( mbedtls_timing_get_delay( &ctx ) != 1 )
FAIL;
busy_msleep( b - a / 8 - b / 8 );
busy_msleep( b - a / 4 - b / 4 );
if( mbedtls_timing_get_delay( &ctx ) != 1 )
FAIL;
busy_msleep( b / 4 );
busy_msleep( b / 2 );
if( mbedtls_timing_get_delay( &ctx ) != 2 )
FAIL;
}