Add buffers with raw issuer/subject data to CRT structure

This commit is contained in:
Hanno Becker 2019-02-20 13:45:16 +00:00
parent a632e3638c
commit f8a42862b7
2 changed files with 8 additions and 0 deletions

View file

@ -64,6 +64,9 @@ typedef struct mbedtls_x509_crt
mbedtls_x509_buf issuer_raw; /**< The raw issuer data (DER). Used for quick comparison. */
mbedtls_x509_buf subject_raw; /**< The raw subject data (DER). Used for quick comparison. */
mbedtls_x509_buf_raw subject_raw_no_hdr;
mbedtls_x509_buf_raw issuer_raw_no_hdr;
mbedtls_x509_name issuer; /**< The parsed issuer data (named information object). */
mbedtls_x509_name subject; /**< The parsed subject data (named information object). */

View file

@ -848,6 +848,7 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt,
mbedtls_x509_crt_free( crt );
return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );
}
crt->issuer_raw_no_hdr.p = p;
if( ( ret = mbedtls_x509_get_name( &p, p + len, &crt->issuer ) ) != 0 )
{
@ -855,6 +856,7 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt,
return( ret );
}
crt->issuer_raw_no_hdr.len = p - crt->issuer_raw_no_hdr.p;
crt->issuer_raw.len = p - crt->issuer_raw.p;
/*
@ -882,12 +884,15 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt,
return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );
}
crt->subject_raw_no_hdr.p = p;
if( len && ( ret = mbedtls_x509_get_name( &p, p + len, &crt->subject ) ) != 0 )
{
mbedtls_x509_crt_free( crt );
return( ret );
}
crt->subject_raw_no_hdr.len = p - crt->subject_raw_no_hdr.p;
crt->subject_raw.len = p - crt->subject_raw.p;
/*