mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-04 13:20:23 +00:00
Added new tests in pk_invalid_param
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com>
This commit is contained in:
parent
ed99ed34f3
commit
0050b918f0
@ -303,7 +303,6 @@ exit:
|
|||||||
void pk_invalid_param()
|
void pk_invalid_param()
|
||||||
{
|
{
|
||||||
mbedtls_pk_context ctx;
|
mbedtls_pk_context ctx;
|
||||||
mbedtls_md_type_t md_alg_none = MBEDTLS_MD_NONE;
|
|
||||||
mbedtls_pk_type_t pk_type = 0;
|
mbedtls_pk_type_t pk_type = 0;
|
||||||
unsigned char buf[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
|
unsigned char buf[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
|
||||||
size_t buf_size = sizeof( buf );
|
size_t buf_size = sizeof( buf );
|
||||||
@ -311,21 +310,37 @@ void pk_invalid_param()
|
|||||||
mbedtls_pk_init( &ctx );
|
mbedtls_pk_init( &ctx );
|
||||||
|
|
||||||
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||||
mbedtls_pk_verify_restartable( &ctx, md_alg_none,
|
mbedtls_pk_verify_restartable( &ctx, MBEDTLS_MD_NONE,
|
||||||
NULL, buf_size,
|
NULL, buf_size,
|
||||||
buf, buf_size,
|
buf, buf_size,
|
||||||
NULL ) );
|
NULL ) );
|
||||||
|
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||||
|
mbedtls_pk_verify_restartable( &ctx, MBEDTLS_MD_SHA256,
|
||||||
|
NULL, 0,
|
||||||
|
buf, buf_size,
|
||||||
|
NULL ) );
|
||||||
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||||
mbedtls_pk_verify_ext( pk_type, NULL,
|
mbedtls_pk_verify_ext( pk_type, NULL,
|
||||||
&ctx, md_alg_none,
|
&ctx, MBEDTLS_MD_NONE,
|
||||||
NULL, buf_size,
|
NULL, buf_size,
|
||||||
buf, buf_size ) );
|
buf, buf_size ) );
|
||||||
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||||
mbedtls_pk_sign_restartable( &ctx, md_alg_none,
|
mbedtls_pk_verify_ext( pk_type, NULL,
|
||||||
|
&ctx, MBEDTLS_MD_SHA256,
|
||||||
|
NULL, 0,
|
||||||
|
buf, buf_size ) );
|
||||||
|
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||||
|
mbedtls_pk_sign_restartable( &ctx, MBEDTLS_MD_NONE,
|
||||||
NULL, buf_size,
|
NULL, buf_size,
|
||||||
buf, buf_size, &buf_size,
|
buf, buf_size, &buf_size,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL ) );
|
NULL ) );
|
||||||
|
TEST_EQUAL( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||||
|
mbedtls_pk_sign_restartable( &ctx, MBEDTLS_MD_SHA256,
|
||||||
|
NULL, 0,
|
||||||
|
buf, buf_size, &buf_size,
|
||||||
|
NULL, NULL,
|
||||||
|
NULL ) );
|
||||||
exit:
|
exit:
|
||||||
mbedtls_pk_free( &ctx );
|
mbedtls_pk_free( &ctx );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user