Improve entropy selftest: check default sources

This commit is contained in:
Manuel Pégourié-Gonnard 2015-05-14 13:57:50 +02:00
parent 151dc77732
commit e94bfe6cd6

View File

@ -421,11 +421,12 @@ int mbedtls_entropy_self_test( int verbose )
mbedtls_entropy_init( &ctx );
ret = mbedtls_entropy_add_source( &ctx, entropy_dummy_source, NULL, 16 );
if( ret != 0 )
/* First do a gather to mek sure we have default sources */
if( ( ret = mbedtls_entropy_gather( &ctx ) ) != 0 )
goto cleanup;
if( ( ret = mbedtls_entropy_gather( &ctx ) ) != 0 )
ret = mbedtls_entropy_add_source( &ctx, entropy_dummy_source, NULL, 16 );
if( ret != 0 )
goto cleanup;
if( ( ret = mbedtls_entropy_update_manual( &ctx, buf, sizeof buf ) ) != 0 )