Add double check for checking if source is strong

To prevent glitching past a strong source.
This commit is contained in:
Jarno Lamsa 2019-11-14 10:12:36 +02:00
parent 552e8f2d6a
commit d05da1fa45

View file

@ -271,7 +271,13 @@ static int entropy_gather_internal( mbedtls_entropy_context *ctx )
*/
for( i = 0; i < ctx->source_count; i++ )
{
if( ctx->source[i].strong == MBEDTLS_ENTROPY_SOURCE_STRONG )
volatile int strong_fi = ctx->source[i].strong;
if( strong_fi == MBEDTLS_ENTROPY_SOURCE_STRONG )
have_one_strong_fi = 1;
mbedtls_platform_enforce_volatile_reads();
if( strong_fi == MBEDTLS_ENTROPY_SOURCE_STRONG )
have_one_strong_fi = 1;
olen = 0;