mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-21 15:41:00 +00:00
Fix const time in mpi_core_ct_uint_table_lookup test
Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
8904a2db29
commit
28f85e6683
@ -966,20 +966,22 @@ void mpi_core_ct_uint_table_lookup( int bitlen, int window_size )
|
|||||||
|
|
||||||
for( size_t i = 0; i < count; i++ )
|
for( size_t i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
|
mbedtls_mpi_uint *current = table + i * limbs;
|
||||||
|
memset( dest, 0x00, limbs * sizeof( *dest ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We shouldn't leak anything through timing.
|
* We shouldn't leak anything through timing.
|
||||||
* We need to set these in every loop as we need to make the loop
|
* We need to set these in every loop as we need to make the loop
|
||||||
* variable public for the loop head and comparison macros make the
|
* variable public for the loop head and the buffers for comparison.
|
||||||
* rest public automatically.
|
|
||||||
*/
|
*/
|
||||||
TEST_CF_SECRET( &i, sizeof( i ) );
|
TEST_CF_SECRET( &i, sizeof( i ) );
|
||||||
TEST_CF_SECRET( dest, limbs * sizeof( mbedtls_mpi_uint ) );
|
TEST_CF_SECRET( dest, limbs * sizeof( *dest ) );
|
||||||
TEST_CF_SECRET( table, count * limbs * sizeof( mbedtls_mpi_uint ) );
|
TEST_CF_SECRET( table, count * limbs * sizeof( *table ) );
|
||||||
|
|
||||||
memset( dest, 0x00, limbs * sizeof( *dest ) );
|
|
||||||
mbedtls_mpi_core_ct_uint_table_lookup( dest, table, limbs, count, i );
|
mbedtls_mpi_core_ct_uint_table_lookup( dest, table, limbs, count, i );
|
||||||
|
|
||||||
mbedtls_mpi_uint *current = table + i * limbs;
|
TEST_CF_PUBLIC( dest, limbs * sizeof( *dest ) );
|
||||||
|
TEST_CF_PUBLIC( table, count * limbs * sizeof( *table ) );
|
||||||
ASSERT_COMPARE( dest, limbs * sizeof( *dest ),
|
ASSERT_COMPARE( dest, limbs * sizeof( *dest ),
|
||||||
current, limbs * sizeof( *current ) );
|
current, limbs * sizeof( *current ) );
|
||||||
TEST_CF_PUBLIC( &i, sizeof( i ) );
|
TEST_CF_PUBLIC( &i, sizeof( i ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user