mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 11:48:12 +00:00
Clean up test function pk_parse_key
- remove incorrect compile-time dependency (the individual cases already have correct run-time dependency information) - remove unused argument - remove unused stack buffer - remove useless code block
This commit is contained in:
parent
25bb8dc228
commit
12fb9c383d
2 changed files with 11 additions and 20 deletions
|
@ -1073,32 +1073,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
|
pk_parse_keyfile_ec:"data_files/ec_prv.specdom.der":"NULL":0
|
||||||
|
|
||||||
Key ASN1 (Incorrect first tag)
|
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)
|
Key ASN1 (RSAPrivateKey, incorrect version tag)
|
||||||
depends_on:MBEDTLS_RSA_C
|
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)
|
Key ASN1 (RSAPrivateKey, version tag missing)
|
||||||
depends_on:MBEDTLS_RSA_C
|
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)
|
Key ASN1 (RSAPrivateKey, invalid version)
|
||||||
depends_on:MBEDTLS_RSA_C
|
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)
|
Key ASN1 (RSAPrivateKey, correct version, incorrect tag)
|
||||||
depends_on:MBEDTLS_RSA_C
|
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)
|
Key ASN1 (RSAPrivateKey, values present, length mismatch)
|
||||||
depends_on:MBEDTLS_RSA_C
|
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)
|
Key ASN1 (RSAPrivateKey, values present, check_privkey fails)
|
||||||
depends_on:MBEDTLS_RSA_C
|
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)
|
Key ASN1 (ECPrivateKey, empty parameters)
|
||||||
depends_on:MBEDTLS_ECP_C
|
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
|
||||||
|
|
|
@ -113,23 +113,14 @@ exit:
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
|
/* BEGIN_CASE */
|
||||||
void pk_parse_key( data_t * buf, char * result_str, int result )
|
void pk_parse_key( data_t * buf, int result )
|
||||||
{
|
{
|
||||||
mbedtls_pk_context pk;
|
mbedtls_pk_context pk;
|
||||||
unsigned char output[2000];
|
|
||||||
((void) result_str);
|
|
||||||
|
|
||||||
mbedtls_pk_init( &pk );
|
mbedtls_pk_init( &pk );
|
||||||
|
|
||||||
memset( output, 0, 2000 );
|
TEST_ASSERT( mbedtls_pk_parse_key( &pk, buf->x, buf->len, NULL, 0 ) == result );
|
||||||
|
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_pk_parse_key( &pk, buf->x, buf->len, NULL, 0 ) == ( result ) );
|
|
||||||
if( ( result ) == 0 )
|
|
||||||
{
|
|
||||||
TEST_ASSERT( 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_pk_free( &pk );
|
mbedtls_pk_free( &pk );
|
||||||
|
|
Loading…
Reference in a new issue