Let the allocated memory visible for the memory sanitizer

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
Gabor Mezei 2022-10-20 12:27:36 +02:00
parent 7ba7b3aded
commit a8cf998bc9
No known key found for this signature in database
GPG key ID: F072ACA227ACD71D
2 changed files with 27 additions and 0 deletions

View file

@ -371,6 +371,9 @@ void mpi_core_cond_assign( char * input_X,
mbedtls_mpi_core_cond_assign( X, Y, copy_limbs, 0 );
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
TEST_ASSERT( memcmp( X, Y, bytes ) != 0 );
/* condition is true */
@ -379,10 +382,16 @@ void mpi_core_cond_assign( char * input_X,
mbedtls_mpi_core_cond_assign( X, Y, copy_limbs, 1 );
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
/* Check if the given length is copied even it is smaller
than the length of the given MPIs. */
if( copy_limbs < limbs )
{
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
ASSERT_COMPARE( X, copy_bytes, Y, copy_bytes );
TEST_ASSERT( memcmp( X, Y, bytes ) != 0 );
}
@ -430,6 +439,9 @@ void mpi_core_cond_swap( char * input_X,
mbedtls_mpi_core_cond_swap( X, Y, copy_limbs, 0 );
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
ASSERT_COMPARE( X, bytes, tmp_X, bytes );
ASSERT_COMPARE( Y, bytes, tmp_Y, bytes );
@ -439,6 +451,9 @@ void mpi_core_cond_swap( char * input_X,
mbedtls_mpi_core_cond_swap( X, Y, copy_limbs, 1 );
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
/* Check if the given length is copied even it is smaller
than the length of the given MPIs. */
if( copy_limbs < limbs )

View file

@ -147,6 +147,9 @@ void mpi_mod_raw_cond_assign( char * input_X,
mbedtls_mpi_mod_raw_cond_assign( X, Y, &m, 0 );
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
TEST_ASSERT( memcmp( X, Y, bytes ) != 0 );
/* condition is true */
@ -155,6 +158,9 @@ void mpi_mod_raw_cond_assign( char * input_X,
mbedtls_mpi_mod_raw_cond_assign( X, Y, &m, 1 );
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
/* Check if the given length is copied even it is smaller
than the length of the given MPIs. */
if( copy_limbs <limbs )
@ -220,6 +226,9 @@ void mpi_mod_raw_cond_swap( char * input_X,
mbedtls_mpi_mod_raw_cond_swap( X, Y, &m, 0 );
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
ASSERT_COMPARE( X, bytes, tmp_X, bytes );
ASSERT_COMPARE( Y, bytes, tmp_Y, bytes );
@ -229,6 +238,9 @@ void mpi_mod_raw_cond_swap( char * input_X,
mbedtls_mpi_mod_raw_cond_swap( X, Y, &m, 1 );
TEST_CF_PUBLIC( X, bytes );
TEST_CF_PUBLIC( Y, bytes );
/* Check if the given length is copied even it is smaller
than the length of the given MPIs. */
if( copy_limbs < limbs )