diff --git a/tests/suites/test_suite_pkparse.data b/tests/suites/test_suite_pkparse.data index 5ffb58036..017eb2e8d 100644 --- a/tests/suites/test_suite_pkparse.data +++ b/tests/suites/test_suite_pkparse.data @@ -1063,32 +1063,32 @@ depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256K1_ENABLED:MB pk_parse_keyfile_ec:"data_files/ec_prv.specdom.der":"NULL":0 Key ASN1 (Incorrect first tag) -pk_parse_key:"":"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +pk_parse_key:"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT Key ASN1 (RSAPrivateKey, incorrect version tag) depends_on:MBEDTLS_RSA_C -pk_parse_key:"300100":"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +pk_parse_key:"300100":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT Key ASN1 (RSAPrivateKey, version tag missing) depends_on:MBEDTLS_RSA_C -pk_parse_key:"3000":"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +pk_parse_key:"3000":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT Key ASN1 (RSAPrivateKey, invalid version) depends_on:MBEDTLS_RSA_C -pk_parse_key:"3003020101":"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +pk_parse_key:"3003020101":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT Key ASN1 (RSAPrivateKey, correct version, incorrect tag) depends_on:MBEDTLS_RSA_C -pk_parse_key:"300402010000":"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +pk_parse_key:"300402010000":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT Key ASN1 (RSAPrivateKey, values present, length mismatch) depends_on:MBEDTLS_RSA_C -pk_parse_key:"301c02010002010102010102010102010102010102010102010102010100":"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +pk_parse_key:"301c02010002010102010102010102010102010102010102010102010100":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT Key ASN1 (RSAPrivateKey, values present, check_privkey fails) depends_on:MBEDTLS_RSA_C -pk_parse_key:"301b020100020102020101020101020101020101020101020101020101":"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +pk_parse_key:"301b020100020102020101020101020101020101020101020101020101":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT Key ASN1 (ECPrivateKey, empty parameters) depends_on:MBEDTLS_ECP_C -pk_parse_key:"30070201010400a000":"":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +pk_parse_key:"30070201010400a000":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT diff --git a/tests/suites/test_suite_pkparse.function b/tests/suites/test_suite_pkparse.function index 94d25e7eb..bbbd6799e 100644 --- a/tests/suites/test_suite_pkparse.function +++ b/tests/suites/test_suite_pkparse.function @@ -114,26 +114,18 @@ exit: /* END_CASE */ /* BEGIN_CASE */ -void pk_parse_key( char *key_data, char *result_str, int result ) +void pk_parse_key( char *key_data, int result ) { mbedtls_pk_context pk; - unsigned char buf[2000]; - unsigned char output[2000]; + unsigned char buf[128]; int data_len; - ((void) result_str); mbedtls_pk_init( &pk ); - memset( buf, 0, 2000 ); - memset( output, 0, 2000 ); - + memset( buf, 0, sizeof( buf ) ); data_len = unhexify( buf, key_data ); - TEST_ASSERT( mbedtls_pk_parse_key( &pk, buf, data_len, NULL, 0 ) == ( result ) ); - if( ( result ) == 0 ) - { - TEST_ASSERT( 1 ); - } + TEST_ASSERT( mbedtls_pk_parse_key( &pk, buf, data_len, NULL, 0 ) == result ); exit: mbedtls_pk_free( &pk );