Add separate test for mbedtls_mpi_free() accepting NULL

This commit is contained in:
Hanno Becker 2018-12-18 23:25:01 +00:00
parent d01ff493e5
commit b48e1aa846
2 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,7 @@
Parameter validation MPI - Valid parameters
mpi_valid_param:
MPI - Invalid parameters
mpi_invalid_param: mpi_invalid_param:
Arguments with no value Arguments with no value

View File

@ -50,6 +50,13 @@ int mbedtls_test_mpi_miller_rabin_determinizer( void* state,
* END_DEPENDENCIES * END_DEPENDENCIES
*/ */
/* BEGIN_CASE */
void mpi_valid_param( )
{
TEST_VALID_PARAM( mbedtls_mpi_free( NULL ) );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */ /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
void mpi_invalid_param( ) void mpi_invalid_param( )
{ {
@ -62,7 +69,6 @@ void mpi_invalid_param( )
mbedtls_mpi_uint mpi_uint; mbedtls_mpi_uint mpi_uint;
TEST_INVALID_PARAM( mbedtls_mpi_init( NULL ) ); TEST_INVALID_PARAM( mbedtls_mpi_init( NULL ) );
TEST_VALID_PARAM( mbedtls_mpi_free( NULL ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA, TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
mbedtls_mpi_grow( NULL, 42 ) ); mbedtls_mpi_grow( NULL, 42 ) );