Skip to content

Commit

Permalink
Fix CSR parsing header call
Browse files Browse the repository at this point in the history
Change the secondary X509 CSR parsing call for the alternative MS header to only
occur if the first call fails due to the header being unfound, instead of any
call.
  • Loading branch information
redtangent committed Oct 7, 2018
1 parent 5199227 commit e1660af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/x509_csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,14 @@ int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, siz
"-----BEGIN CERTIFICATE REQUEST-----",
"-----END CERTIFICATE REQUEST-----",
buf, NULL, 0, &use_len );
if( ret != 0 )
if( ret == MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT )
{
ret = mbedtls_pem_read_buffer( &pem,
"-----BEGIN NEW CERTIFICATE REQUEST-----",
"-----END NEW CERTIFICATE REQUEST-----",
buf, NULL, 0, &use_len );
}

if( ret == 0 )
{
/*
Expand Down

0 comments on commit e1660af

Please sign in to comment.