mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-03-14 13:26:27 +00:00
Add unit tests for X509 certificate date parsing
This commit is contained in:
committed by
Simon Butcher
parent
f3ebf909c9
commit
ea7054a00c
@@ -613,16 +613,14 @@ void x509_get_time( int tag, char *time_str, int ret,
|
||||
int hour, int min, int sec )
|
||||
{
|
||||
mbedtls_x509_time time;
|
||||
unsigned char buf[17];
|
||||
unsigned char buf[21];
|
||||
unsigned char* start = buf;
|
||||
unsigned char* end = buf;
|
||||
|
||||
memset( &time, 0x00, sizeof( time ) );
|
||||
*end = (unsigned char)tag; end++;
|
||||
if( tag == MBEDTLS_ASN1_UTC_TIME )
|
||||
*end = 13;
|
||||
else
|
||||
*end = 15;
|
||||
*end = strlen( time_str );
|
||||
TEST_ASSERT( *end < 20 );
|
||||
end++;
|
||||
memcpy( end, time_str, (size_t)*(end - 1) );
|
||||
end += *(end - 1);
|
||||
|
||||
Reference in New Issue
Block a user