mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-07 15:09:28 +01:00
- Added a lot of ASN1 Certificate parsing tests
This commit is contained in:
parent
94101362e8
commit
b2c38f54b4
2 changed files with 177 additions and 0 deletions
|
|
@ -123,6 +123,35 @@ x509parse_key:key_file:password:result
|
|||
}
|
||||
END_CASE
|
||||
|
||||
BEGIN_CASE
|
||||
x509parse_crt:crt_data:result_str:result
|
||||
{
|
||||
x509_cert crt;
|
||||
unsigned char buf[2000];
|
||||
unsigned char output[2000];
|
||||
int data_len, res;
|
||||
|
||||
memset( &crt, 0, sizeof( x509_cert ) );
|
||||
memset( buf, 0, 2000 );
|
||||
memset( output, 0, 2000 );
|
||||
|
||||
data_len = unhexify( buf, {crt_data} );
|
||||
|
||||
res = x509parse_crt( &crt, buf, data_len );
|
||||
printf(" %04x ", res);
|
||||
TEST_ASSERT( x509parse_crt( &crt, buf, data_len ) == ( {result} ) );
|
||||
if( ( {result} ) == 0 )
|
||||
{
|
||||
res = x509parse_cert_info( (char *) output, 2000, "", &crt );
|
||||
|
||||
TEST_ASSERT( res != -1 );
|
||||
TEST_ASSERT( res != -2 );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) output, {result_str} ) == 0 );
|
||||
}
|
||||
}
|
||||
END_CASE
|
||||
|
||||
BEGIN_CASE
|
||||
x509_selftest:
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue