Introduced x509_crt_init(), x509_crl_init() and x509_csr_init()

This commit is contained in:
Paul Bakker 2013-09-18 11:58:25 +02:00
parent 86d0c1949e
commit 369d2eb2a2
20 changed files with 79 additions and 34 deletions

View file

@ -279,7 +279,7 @@ int x509parse_crl( x509_crl *chain, const unsigned char *buf, size_t buflen )
}
crl = crl->next;
memset( crl, 0, sizeof( x509_crl ) );
x509_crl_init( crl );
}
#if defined(POLARSSL_PEM_PARSE_C)
@ -514,7 +514,7 @@ int x509parse_crl( x509_crl *chain, const unsigned char *buf, size_t buflen )
}
crl = crl->next;
memset( crl, 0, sizeof( x509_crl ) );
x509_crl_init( crl );
return( x509parse_crl( crl, buf, buflen ) );
}
@ -679,6 +679,14 @@ int x509parse_crl_info( char *buf, size_t size, const char *prefix,
return( (int) ( size - n ) );
}
/*
* Initialize a CRL chain
*/
void x509_crl_init( x509_crl *crl )
{
memset( crl, 0, sizeof(x509_crl) );
}
/*
* Unallocate all CRL data
*/

View file

@ -785,7 +785,7 @@ int x509parse_crt_der( x509_cert *chain, const unsigned char *buf, size_t buflen
prev = crt;
crt = crt->next;
memset( crt, 0, sizeof( x509_cert ) );
x509_crt_init( crt );
}
if( ( ret = x509parse_crt_der_core( crt, buf, buflen ) ) != 0 )
@ -1602,6 +1602,14 @@ int x509parse_verify( x509_cert *crt,
return( 0 );
}
/*
* Initialize a certificate chain
*/
void x509_crt_init( x509_cert *crt )
{
memset( crt, 0, sizeof(x509_cert) );
}
/*
* Unallocate all certificate data
*/

View file

@ -103,7 +103,7 @@ int x509parse_csr( x509_csr *csr, const unsigned char *buf, size_t buflen )
if( csr == NULL || buf == NULL )
return( POLARSSL_ERR_X509_BAD_INPUT_DATA );
memset( csr, 0, sizeof( x509_csr ) );
x509_csr_init( csr );
#if defined(POLARSSL_PEM_PARSE_C)
pem_init( &pem );
@ -405,6 +405,14 @@ int x509parse_csr_info( char *buf, size_t size, const char *prefix,
return( (int) ( size - n ) );
}
/*
* Initialize a CSR
*/
void x509_csr_init( x509_csr *csr )
{
memset( csr, 0, sizeof(x509_csr) );
}
/*
* Unallocate all CSR data
*/