Add new test for invalid param in pk.c
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com>
This commit is contained in:
parent
78c1d8c299
commit
79bf51a109
2 changed files with 36 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
|||
PK invalid parameters
|
||||
pk_invalid_param:
|
||||
|
||||
PK valid parameters
|
||||
valid_parameters:
|
||||
|
||||
|
|
|
@ -299,6 +299,39 @@ exit:
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void pk_invalid_param()
|
||||
{
|
||||
mbedtls_pk_context ctx;
|
||||
mbedtls_md_type_t md_alg_none = MBEDTLS_MD_NONE;
|
||||
mbedtls_pk_type_t pk_type = 0;
|
||||
unsigned char buf[] = {0x01,0x02,0x03,0x04,0x05,0x06};
|
||||
size_t buf_size = sizeof( buf );
|
||||
|
||||
mbedtls_pk_init( &ctx );
|
||||
|
||||
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||
mbedtls_pk_verify_restartable( &ctx, md_alg_none,
|
||||
NULL, buf_size,
|
||||
buf, buf_size,
|
||||
NULL ) );
|
||||
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||
mbedtls_pk_verify_ext( pk_type, NULL,
|
||||
&ctx, md_alg_none,
|
||||
NULL, buf_size,
|
||||
buf, buf_size ) );
|
||||
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||
mbedtls_pk_sign_restartable( &ctx, md_alg_none,
|
||||
NULL, buf_size,
|
||||
buf, buf_size, &buf_size,
|
||||
NULL, NULL,
|
||||
NULL ) );
|
||||
exit:
|
||||
mbedtls_pk_free( &ctx );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void valid_parameters( )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue