mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 11:34:15 +01:00
Make timing selftest less sensitive
- allow up to 12.5% security/error margin - use larger delays - this avoid the security/error margin being too low The test used to fail about 1 out of 6 times on some buildbots VMs, but never failed on the physical machines used for development.
This commit is contained in:
parent
4b7027a8da
commit
91bbfb6fb7
@ -429,25 +429,25 @@ 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 = 100; a <= 200; a += 100 )
|
for( a = 200; a <= 400; a += 200 )
|
||||||
{
|
{
|
||||||
for( b = 100; b <= 200; b += 100 )
|
for( b = 200; b <= 400; b += 200 )
|
||||||
{
|
{
|
||||||
mbedtls_timing_set_delay( &ctx, a, a + b );
|
mbedtls_timing_set_delay( &ctx, a, a + b );
|
||||||
|
|
||||||
busy_msleep( a - a / 10 );
|
busy_msleep( a - a / 8 );
|
||||||
if( mbedtls_timing_get_delay( &ctx ) != 0 )
|
if( mbedtls_timing_get_delay( &ctx ) != 0 )
|
||||||
FAIL;
|
FAIL;
|
||||||
|
|
||||||
busy_msleep( a / 5 );
|
busy_msleep( a / 4 );
|
||||||
if( mbedtls_timing_get_delay( &ctx ) != 1 )
|
if( mbedtls_timing_get_delay( &ctx ) != 1 )
|
||||||
FAIL;
|
FAIL;
|
||||||
|
|
||||||
busy_msleep( b - a / 5 );
|
busy_msleep( b - a / 8 - b / 8 );
|
||||||
if( mbedtls_timing_get_delay( &ctx ) != 1 )
|
if( mbedtls_timing_get_delay( &ctx ) != 1 )
|
||||||
FAIL;
|
FAIL;
|
||||||
|
|
||||||
busy_msleep( b / 5 );
|
busy_msleep( b / 4 );
|
||||||
if( mbedtls_timing_get_delay( &ctx ) != 2 )
|
if( mbedtls_timing_get_delay( &ctx ) != 2 )
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user