mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 08:16:33 +01:00
- Added extra regression and coverage tests for ASN parsing of CRL and Key data
This commit is contained in:
parent
635f4b4cf9
commit
6b0fa4f33b
2 changed files with 126 additions and 6 deletions
|
|
@ -105,7 +105,7 @@ x509_time_expired:crt_file:entity:result
|
|||
END_CASE
|
||||
|
||||
BEGIN_CASE
|
||||
x509parse_key:key_file:password:result
|
||||
x509parse_keyfile:key_file:password:result
|
||||
{
|
||||
rsa_context rsa;
|
||||
int res;
|
||||
|
|
@ -137,8 +137,6 @@ x509parse_crt:crt_data:result_str:result
|
|||
|
||||
data_len = unhexify( buf, {crt_data} );
|
||||
|
||||
res = x509parse_crt( &crt, buf, data_len );
|
||||
|
||||
TEST_ASSERT( x509parse_crt( &crt, buf, data_len ) == ( {result} ) );
|
||||
if( ( {result} ) == 0 )
|
||||
{
|
||||
|
|
@ -152,6 +150,57 @@ x509parse_crt:crt_data:result_str:result
|
|||
}
|
||||
END_CASE
|
||||
|
||||
BEGIN_CASE
|
||||
x509parse_crl:crl_data:result_str:result
|
||||
{
|
||||
x509_crl crl;
|
||||
unsigned char buf[2000];
|
||||
unsigned char output[2000];
|
||||
int data_len, res;
|
||||
|
||||
memset( &crl, 0, sizeof( x509_crl ) );
|
||||
memset( buf, 0, 2000 );
|
||||
memset( output, 0, 2000 );
|
||||
|
||||
data_len = unhexify( buf, {crl_data} );
|
||||
|
||||
TEST_ASSERT( x509parse_crl( &crl, buf, data_len ) == ( {result} ) );
|
||||
if( ( {result} ) == 0 )
|
||||
{
|
||||
res = x509parse_crl_info( (char *) output, 2000, "", &crl );
|
||||
|
||||
TEST_ASSERT( res != -1 );
|
||||
TEST_ASSERT( res != -2 );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) output, {result_str} ) == 0 );
|
||||
}
|
||||
}
|
||||
END_CASE
|
||||
|
||||
BEGIN_CASE
|
||||
x509parse_key:key_data:result_str:result
|
||||
{
|
||||
rsa_context rsa;
|
||||
unsigned char buf[2000];
|
||||
unsigned char output[2000];
|
||||
int data_len, res;
|
||||
|
||||
memset( &rsa, 0, sizeof( rsa_context ) );
|
||||
memset( buf, 0, 2000 );
|
||||
memset( output, 0, 2000 );
|
||||
|
||||
data_len = unhexify( buf, {key_data} );
|
||||
|
||||
res = x509parse_key( &rsa, buf, data_len, NULL, 0 );
|
||||
|
||||
TEST_ASSERT( x509parse_key( &rsa, buf, data_len, NULL, 0 ) == ( {result} ) );
|
||||
if( ( {result} ) == 0 )
|
||||
{
|
||||
TEST_ASSERT( 1 );
|
||||
}
|
||||
}
|
||||
END_CASE
|
||||
|
||||
BEGIN_CASE
|
||||
x509_selftest:
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue