pk parse: the password is optional

For mbedtls_pk_parse_key and mbedtls_pk_parse_keyfile, the password is
optional. Clarify what this means: NULL is ok and means no password.
Validate parameters and test accordingly.
This commit is contained in:
Gilles Peskine 2018-12-19 17:12:01 +01:00
parent ee3cfec3cc
commit d54b97503b
2 changed files with 12 additions and 7 deletions

View file

@ -432,10 +432,6 @@ void invalid_parameters( )
mbedtls_pk_parse_key( &pk,
NULL, sizeof( buf ),
buf, sizeof( buf ) ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
mbedtls_pk_parse_key( &pk,
buf, sizeof( buf ),
NULL, sizeof( buf ) ) );
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
mbedtls_pk_parse_public_key( NULL,