mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
Merge development into development-restricted
This commit is contained in:
commit
184990c1d4
15 changed files with 470 additions and 46 deletions
|
|
@ -677,14 +677,9 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *
|
|||
if( crt == NULL || buf == NULL )
|
||||
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
|
||||
|
||||
p = mbedtls_calloc( 1, len = buflen );
|
||||
if( p == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, buflen );
|
||||
|
||||
crt->raw.p = p;
|
||||
crt->raw.len = len;
|
||||
// Use the original buffer until we figure out actual length
|
||||
p = (unsigned char*) buf;
|
||||
len = buflen;
|
||||
end = p + len;
|
||||
|
||||
/*
|
||||
|
|
@ -708,6 +703,18 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *
|
|||
}
|
||||
crt_end = p + len;
|
||||
|
||||
// Create and populate a new buffer for the raw field
|
||||
crt->raw.len = crt_end - buf;
|
||||
crt->raw.p = p = mbedtls_calloc( 1, crt->raw.len );
|
||||
if( p == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, crt->raw.len );
|
||||
|
||||
// Direct pointers to the new buffer
|
||||
p += crt->raw.len - len;
|
||||
end = crt_end = p + len;
|
||||
|
||||
/*
|
||||
* TBSCertificate ::= SEQUENCE {
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue