Address review comments
diff --git a/library/entropy.c b/library/entropy.c
index 6b0b47b..78ea6d4 100644
--- a/library/entropy.c
+++ b/library/entropy.c
@@ -258,7 +258,8 @@
*/
static int entropy_gather_internal( mbedtls_entropy_context *ctx )
{
- int ret, i;
+ int i;
+ volatile int ret = MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE;
volatile int have_one_strong_fi = 0;
unsigned char buf[MBEDTLS_ENTROPY_MAX_GATHER];
size_t olen;
@@ -299,19 +300,19 @@
}
}
- if( have_one_strong_fi == 0 )
- {
- mbedtls_platform_enforce_volatile_reads();
- if( have_one_strong_fi == 0)
- {
- ret = MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE;
- }
- }
-
cleanup:
mbedtls_platform_zeroize( buf, sizeof( buf ) );
- return( ret );
+ if( have_one_strong_fi == 1 )
+ {
+ mbedtls_platform_enforce_volatile_reads();
+ if( have_one_strong_fi == 1 )
+ {
+ return( ret );
+ }
+ }
+
+ return( MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE );
}
/*
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index e0c104e..a1d2e19 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -3051,6 +3051,10 @@
#endif /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
return( ret );
}
+ else
+ {
+ return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
+ }
}
#if defined(MBEDTLS_SSL__ECP_RESTARTABLE)
if( ret != MBEDTLS_ERR_ECP_IN_PROGRESS )