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

@ -90,7 +90,7 @@ int main( int argc, char *argv[] )
* 0. Initialize the RNG and the session data
*/
memset( &ssl, 0, sizeof( ssl_context ) );
memset( &cacert, 0, sizeof( x509_cert ) );
x509_crt_init( &cacert );
printf( "\n . Seeding the random number generator..." );
fflush( stdout );

View file

@ -269,8 +269,8 @@ int main( int argc, char *argv[] )
memset( &ssl, 0, sizeof( ssl_context ) );
memset( &saved_session, 0, sizeof( ssl_session ) );
#if defined(POLARSSL_X509_CRT_PARSE_C)
memset( &cacert, 0, sizeof( x509_cert ) );
memset( &clicert, 0, sizeof( x509_cert ) );
x509_crt_init( &cacert );
x509_crt_init( &clicert );
pk_init( &pkey );
#endif

View file

@ -134,7 +134,7 @@ int main( int argc, char *argv[] )
printf( " . Loading the server cert. and key..." );
fflush( stdout );
memset( &srvcert, 0, sizeof( x509_cert ) );
x509_crt_init( &srvcert );
/*
* This demonstration program uses embedded test certificates.

View file

@ -363,8 +363,8 @@ int main( int argc, char *argv[] )
* Make sure memory references are valid.
*/
server_fd = 0;
memset( &cacert, 0, sizeof( x509_cert ) );
memset( &clicert, 0, sizeof( x509_cert ) );
x509_crt_init( &cacert );
x509_crt_init( &clicert );
pk_init( &pkey );
if( argc == 0 )

View file

@ -114,7 +114,7 @@ int main( int argc, char *argv[] )
printf( "\n . Loading the server cert. and key..." );
fflush( stdout );
memset( &srvcert, 0, sizeof( x509_cert ) );
x509_crt_init( &srvcert );
/*
* This demonstration program uses embedded test certificates.

View file

@ -237,8 +237,8 @@ int main( int argc, char *argv[] )
*/
listen_fd = 0;
#if defined(POLARSSL_X509_CRT_PARSE_C)
memset( &cacert, 0, sizeof( x509_cert ) );
memset( &srvcert, 0, sizeof( x509_cert ) );
x509_crt_init( &cacert );
x509_crt_init( &srvcert );
pk_init( &pkey );
#endif
#if defined(POLARSSL_SSL_CACHE_C)

View file

@ -89,8 +89,8 @@ int main( int argc, char *argv[] )
((void) argc);
((void) argv);
memset( &cacert, 0, sizeof( x509_cert ) );
memset( &crl, 0, sizeof( x509_crl ) );
x509_crt_init( &cacert );
x509_crl_init( &crl );
/*
* 1.1. Load the trusted CA
@ -142,7 +142,7 @@ int main( int argc, char *argv[] )
x509_cert clicert;
pk_context pk;
memset( &clicert, 0, sizeof( x509_cert ) );
x509_crt_init( &clicert );
pk_init( &pk );
snprintf(name, 512, "ssl/test-ca/%s", client_certificates[i]);

View file

@ -187,7 +187,7 @@ static int ssl_test( struct options *opt )
memset( read_state, 0, sizeof( read_state ) );
memset( write_state, 0, sizeof( write_state ) );
memset( &srvcert, 0, sizeof( x509_cert ) );
x509_crt_init( &srvcert );
pk_init( &pkey );
if( opt->opmode == OPMODE_CLIENT )

View file

@ -168,8 +168,8 @@ int main( int argc, char *argv[] )
* Set to sane values
*/
server_fd = 0;
memset( &cacert, 0, sizeof( x509_cert ) );
memset( &clicert, 0, sizeof( x509_cert ) );
x509_crt_init( &cacert );
x509_crt_init( &clicert );
pk_init( &pkey );
if( argc == 0 )
@ -269,7 +269,7 @@ int main( int argc, char *argv[] )
{
x509_cert crt;
x509_cert *cur = &crt;
memset( &crt, 0, sizeof( x509_cert ) );
x509_crt_init( &crt );
/*
* 1.1. Load the certificate(s)

View file

@ -208,9 +208,9 @@ int main( int argc, char *argv[] )
pk_init( &loaded_subject_key );
mpi_init( &serial );
#if defined(POLARSSL_X509_CSR_PARSE_C)
memset( &csr, 0, sizeof(x509_csr) );
x509_csr_init( &csr );
#endif
memset( &issuer_crt, 0, sizeof(x509_cert) );
x509_crt_init( &issuer_crt );
memset( buf, 0, 1024 );
if( argc == 0 )

View file

@ -76,7 +76,7 @@ int main( int argc, char *argv[] )
/*
* Set to sane values
*/
memset( &crl, 0, sizeof( x509_crl ) );
x509_crl_init( &crl );
if( argc == 0 )
{

View file

@ -76,7 +76,7 @@ int main( int argc, char *argv[] )
/*
* Set to sane values
*/
memset( &csr, 0, sizeof( x509_csr ) );
x509_csr_init( &csr );
if( argc == 0 )
{