Improve entropy selftest: check default sources
diff --git a/library/entropy.c b/library/entropy.c
index d60250c..e41a593 100644
--- a/library/entropy.c
+++ b/library/entropy.c
@@ -421,11 +421,12 @@
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 )