Fix potential free of uninitialised pointer

A test was added in that could cause a jump to exit prior to
initialisation of a pointer that would get freed if that test failed.

Signed-off-by: Paul Elliott <[email protected]>
This commit is contained in:
Paul Elliott
2021-06-25 11:17:12 +01:00
parent 3698fa1043
commit e57dd2d450
+3 -2
View File
@@ -179,11 +179,12 @@ void rsa_pkcs1_sign_raw( data_t * hash_result,
mbedtls_test_rnd_pseudo_info rnd_info;
mbedtls_rsa_init( &ctx );
TEST_ASSERT( mbedtls_rsa_set_padding( &ctx, padding_mode,
MBEDTLS_MD_NONE ) == 0 );
mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
TEST_ASSERT( mbedtls_rsa_set_padding( &ctx, padding_mode,
MBEDTLS_MD_NONE ) == 0 );
memset( output, 0x00, sizeof( output ) );
memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );