mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-07-09 03:30:45 +00:00
Lift function call out of inner loop
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
f37b9f73c7
commit
e4f937f5d3
|
@ -1530,6 +1530,8 @@ void mpi_random_many( int min, data_t *bound_bytes, int iterations )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int statistically_safe_all_the_way =
|
||||||
|
is_significantly_above_a_power_of_2( bound_bytes );
|
||||||
for( b = 0; b < n_bits; b++ )
|
for( b = 0; b < n_bits; b++ )
|
||||||
{
|
{
|
||||||
mbedtls_test_set_step( 1000000 + b );
|
mbedtls_test_set_step( 1000000 + b );
|
||||||
|
@ -1541,8 +1543,7 @@ void mpi_random_many( int min, data_t *bound_bytes, int iterations )
|
||||||
* As an exception, the top bit may legitimately never be set
|
* As an exception, the top bit may legitimately never be set
|
||||||
* if bound is a power of 2 or only slightly above.
|
* if bound is a power of 2 or only slightly above.
|
||||||
*/
|
*/
|
||||||
if( b != n_bits - 1 ||
|
if( statistically_safe_all_the_way || b != n_bits - 1 )
|
||||||
is_significantly_above_a_power_of_2( bound_bytes ) )
|
|
||||||
{
|
{
|
||||||
TEST_ASSERT( stats[b] > 0 );
|
TEST_ASSERT( stats[b] > 0 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue