Add missing cases to RSA parameter validation test

This commit is contained in:
Hanno Becker 2018-12-18 14:04:28 +00:00
parent 5bdfca926f
commit b06f193d73

View File

@ -302,6 +302,12 @@ void rsa_invalid_param( )
valid_mode, valid_mode,
0, sizeof( buf ), buf, 0, sizeof( buf ), buf,
NULL ) ); NULL ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pkcs1_v15_sign( &ctx, NULL, NULL,
valid_mode,
MBEDTLS_MD_SHA1,
0, NULL,
buf ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA, TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pss_sign( NULL, NULL, NULL, mbedtls_rsa_rsassa_pss_sign( NULL, NULL, NULL,
@ -323,6 +329,12 @@ void rsa_invalid_param( )
valid_mode, valid_mode,
0, sizeof( buf ), buf, 0, sizeof( buf ), buf,
NULL ) ); NULL ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pss_sign( &ctx, NULL, NULL,
valid_mode,
MBEDTLS_MD_SHA1,
0, NULL,
buf ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA, TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_pkcs1_verify( NULL, NULL, NULL, mbedtls_rsa_pkcs1_verify( NULL, NULL, NULL,
@ -344,6 +356,11 @@ void rsa_invalid_param( )
valid_mode, valid_mode,
0, sizeof( buf ), buf, 0, sizeof( buf ), buf,
NULL ) ); NULL ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL,
valid_mode,
MBEDTLS_MD_SHA1, 0, NULL,
buf ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA, TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pkcs1_v15_verify( NULL, NULL, mbedtls_rsa_rsassa_pkcs1_v15_verify( NULL, NULL,
@ -369,6 +386,13 @@ void rsa_invalid_param( )
valid_mode, valid_mode,
0, sizeof( buf ), buf, 0, sizeof( buf ), buf,
NULL ) ); NULL ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pkcs1_v15_verify( &ctx, NULL,
NULL,
valid_mode,
MBEDTLS_MD_SHA1,
0, NULL,
buf ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA, TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pss_verify( NULL, NULL, NULL, mbedtls_rsa_rsassa_pss_verify( NULL, NULL, NULL,
@ -390,6 +414,12 @@ void rsa_invalid_param( )
valid_mode, valid_mode,
0, sizeof( buf ), 0, sizeof( buf ),
buf, NULL ) ); buf, NULL ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pss_verify( &ctx, NULL, NULL,
valid_mode,
MBEDTLS_MD_SHA1,
0, NULL,
buf ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA, TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pss_verify_ext( NULL, NULL, NULL, mbedtls_rsa_rsassa_pss_verify_ext( NULL, NULL, NULL,
@ -417,6 +447,13 @@ void rsa_invalid_param( )
0, sizeof( buf ), 0, sizeof( buf ),
buf, 0, 0, buf, 0, 0,
NULL ) ); NULL ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_rsassa_pss_verify_ext( &ctx, NULL, NULL,
valid_mode,
MBEDTLS_MD_SHA1,
0, NULL,
0, 0,
buf ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA, TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
mbedtls_rsa_copy( NULL, &ctx ) ); mbedtls_rsa_copy( NULL, &ctx ) );