Renamed x509parse_* functions to new form
e.g. x509parse_crtfile -> x509_crt_parse_file
diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c
index da4fe82..cc935b4 100644
--- a/programs/ssl/ssl_client1.c
+++ b/programs/ssl/ssl_client1.c
@@ -113,8 +113,8 @@
fflush( stdout );
#if defined(POLARSSL_CERTS_C)
- ret = x509parse_crt( &cacert, (const unsigned char *) test_ca_crt,
- strlen( test_ca_crt ) );
+ ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_crt,
+ strlen( test_ca_crt ) );
#else
ret = 1;
printf("POLARSSL_CERTS_C not defined.");
@@ -122,7 +122,7 @@
if( ret < 0 )
{
- printf( " failed\n ! x509parse_crt returned -0x%x\n\n", -ret );
+ printf( " failed\n ! x509_crt_parse returned -0x%x\n\n", -ret );
goto exit;
}
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index d5e43f6..b342349 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -121,7 +121,7 @@
((void) data);
printf( "\nVerify requested for (Depth %d):\n", depth );
- x509parse_cert_info( buf, sizeof( buf ) - 1, "", crt );
+ x509_crt_info( buf, sizeof( buf ) - 1, "", crt );
printf( "%s", buf );
if( ( (*flags) & BADCERT_EXPIRED ) != 0 )
@@ -574,13 +574,13 @@
#if defined(POLARSSL_FS_IO)
if( strlen( opt.ca_path ) )
- ret = x509parse_crtpath( &cacert, opt.ca_path );
+ ret = x509_crt_parse_path( &cacert, opt.ca_path );
else if( strlen( opt.ca_file ) )
- ret = x509parse_crtfile( &cacert, opt.ca_file );
+ ret = x509_crt_parse_file( &cacert, opt.ca_file );
else
#endif
#if defined(POLARSSL_CERTS_C)
- ret = x509parse_crt( &cacert, (const unsigned char *) test_ca_crt,
+ ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_crt,
strlen( test_ca_crt ) );
#else
{
@@ -590,7 +590,7 @@
#endif
if( ret < 0 )
{
- printf( " failed\n ! x509parse_crt returned -0x%x\n\n", -ret );
+ printf( " failed\n ! x509_crt_parse returned -0x%x\n\n", -ret );
goto exit;
}
@@ -606,11 +606,11 @@
#if defined(POLARSSL_FS_IO)
if( strlen( opt.crt_file ) )
- ret = x509parse_crtfile( &clicert, opt.crt_file );
+ ret = x509_crt_parse_file( &clicert, opt.crt_file );
else
#endif
#if defined(POLARSSL_CERTS_C)
- ret = x509parse_crt( &clicert, (const unsigned char *) test_cli_crt,
+ ret = x509_crt_parse( &clicert, (const unsigned char *) test_cli_crt,
strlen( test_cli_crt ) );
#else
{
@@ -620,7 +620,7 @@
#endif
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crt returned -0x%x\n\n", -ret );
+ printf( " failed\n ! x509_crt_parse returned -0x%x\n\n", -ret );
goto exit;
}
@@ -790,8 +790,8 @@
if( ssl_get_peer_cert( &ssl ) != NULL )
{
printf( " . Peer certificate information ...\n" );
- x509parse_cert_info( (char *) buf, sizeof( buf ) - 1, " ",
- ssl_get_peer_cert( &ssl ) );
+ x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
+ ssl_get_peer_cert( &ssl ) );
printf( "%s\n", buf );
}
#endif /* POLARSSL_X509_CRT_PARSE_C */
diff --git a/programs/ssl/ssl_fork_server.c b/programs/ssl/ssl_fork_server.c
index df75d92..724bf2f 100644
--- a/programs/ssl/ssl_fork_server.c
+++ b/programs/ssl/ssl_fork_server.c
@@ -138,22 +138,22 @@
/*
* This demonstration program uses embedded test certificates.
- * Instead, you may want to use x509parse_crtfile() to read the
- * server and CA certificates, as well as x509parse_keyfile().
+ * Instead, you may want to use x509_crt_parse_file() to read the
+ * server and CA certificates, as well as pk_parse_keyfile().
*/
- ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt,
- strlen( test_srv_crt ) );
+ ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
+ strlen( test_srv_crt ) );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
goto exit;
}
- ret = x509parse_crt( &srvcert, (const unsigned char *) test_ca_crt,
- strlen( test_ca_crt ) );
+ ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_crt,
+ strlen( test_ca_crt ) );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
goto exit;
}
diff --git a/programs/ssl/ssl_mail_client.c b/programs/ssl/ssl_mail_client.c
index a95e2da..970d553 100644
--- a/programs/ssl/ssl_mail_client.c
+++ b/programs/ssl/ssl_mail_client.c
@@ -173,8 +173,8 @@
printf( " ok\n" );
printf( " . Peer certificate information ...\n" );
- x509parse_cert_info( (char *) buf, sizeof( buf ) - 1, " ",
- ssl_get_peer_cert( ssl ) );
+ x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
+ ssl_get_peer_cert( ssl ) );
printf( "%s\n", buf );
return( 0 );
@@ -483,12 +483,12 @@
#if defined(POLARSSL_FS_IO)
if( strlen( opt.ca_file ) )
- ret = x509parse_crtfile( &cacert, opt.ca_file );
+ ret = x509_crt_parse_file( &cacert, opt.ca_file );
else
#endif
#if defined(POLARSSL_CERTS_C)
- ret = x509parse_crt( &cacert, (const unsigned char *) test_ca_crt,
- strlen( test_ca_crt ) );
+ ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_crt,
+ strlen( test_ca_crt ) );
#else
{
ret = 1;
@@ -497,7 +497,7 @@
#endif
if( ret < 0 )
{
- printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
goto exit;
}
@@ -513,12 +513,12 @@
#if defined(POLARSSL_FS_IO)
if( strlen( opt.crt_file ) )
- ret = x509parse_crtfile( &clicert, opt.crt_file );
- else
+ ret = x509_crt_parse_file( &clicert, opt.crt_file );
+ else
#endif
#if defined(POLARSSL_CERTS_C)
- ret = x509parse_crt( &clicert, (const unsigned char *) test_cli_crt,
- strlen( test_cli_crt ) );
+ ret = x509_crt_parse( &clicert, (const unsigned char *) test_cli_crt,
+ strlen( test_cli_crt ) );
#else
{
ret = -1;
@@ -527,7 +527,7 @@
#endif
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
goto exit;
}
diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c
index 1929c9e..2b10923 100644
--- a/programs/ssl/ssl_server.c
+++ b/programs/ssl/ssl_server.c
@@ -118,22 +118,22 @@
/*
* This demonstration program uses embedded test certificates.
- * Instead, you may want to use x509parse_crtfile() to read the
- * server and CA certificates, as well as x509parse_keyfile().
+ * Instead, you may want to use x509_crt_parse_file() to read the
+ * server and CA certificates, as well as pk_parse_keyfile().
*/
- ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt,
- strlen( test_srv_crt ) );
+ ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
+ strlen( test_srv_crt ) );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
goto exit;
}
- ret = x509parse_crt( &srvcert, (const unsigned char *) test_ca_crt,
- strlen( test_ca_crt ) );
+ ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_crt,
+ strlen( test_ca_crt ) );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
goto exit;
}
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index b024e4b..3a18e13 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -525,14 +525,14 @@
#if defined(POLARSSL_FS_IO)
if( strlen( opt.ca_path ) )
- ret = x509parse_crtpath( &cacert, opt.ca_path );
+ ret = x509_crt_parse_path( &cacert, opt.ca_path );
else if( strlen( opt.ca_file ) )
- ret = x509parse_crtfile( &cacert, opt.ca_file );
- else
+ ret = x509_crt_parse_file( &cacert, opt.ca_file );
+ else
#endif
#if defined(POLARSSL_CERTS_C)
- ret = x509parse_crt( &cacert, (const unsigned char *) test_ca_crt,
- strlen( test_ca_crt ) );
+ ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_crt,
+ strlen( test_ca_crt ) );
#else
{
ret = 1;
@@ -541,7 +541,7 @@
#endif
if( ret < 0 )
{
- printf( " failed\n ! x509parse_crt returned -0x%x\n\n", -ret );
+ printf( " failed\n ! x509_crt_parse returned -0x%x\n\n", -ret );
goto exit;
}
@@ -555,12 +555,12 @@
#if defined(POLARSSL_FS_IO)
if( strlen( opt.crt_file ) )
- ret = x509parse_crtfile( &srvcert, opt.crt_file );
- else
+ ret = x509_crt_parse_file( &srvcert, opt.crt_file );
+ else
#endif
#if defined(POLARSSL_CERTS_C)
- ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt,
- strlen( test_srv_crt ) );
+ ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
+ strlen( test_srv_crt ) );
#else
{
ret = 1;
@@ -569,7 +569,7 @@
#endif
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crt returned -0x%x\n\n", -ret );
+ printf( " failed\n ! x509_crt_parse returned -0x%x\n\n", -ret );
goto exit;
}
@@ -777,8 +777,8 @@
if( ssl_get_peer_cert( &ssl ) )
{
printf( " . Peer certificate information ...\n" );
- x509parse_cert_info( (char *) buf, sizeof( buf ) - 1, " ",
- ssl_get_peer_cert( &ssl ) );
+ x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
+ ssl_get_peer_cert( &ssl ) );
printf( "%s\n", buf );
}
#endif /* POLARSSL_X509_CRT_PARSE_C */
diff --git a/programs/test/ssl_cert_test.c b/programs/test/ssl_cert_test.c
index 9b58a6d..81d81ed 100644
--- a/programs/test/ssl_cert_test.c
+++ b/programs/test/ssl_cert_test.c
@@ -100,18 +100,18 @@
/*
* Alternatively, you may load the CA certificates from a .pem or
- * .crt file by calling x509parse_crtfile( &cacert, "myca.crt" ).
+ * .crt file by calling x509_crt_parse_file( &cacert, "myca.crt" ).
*/
- ret = x509parse_crtfile( &cacert, "ssl/test-ca/test-ca.crt" );
+ ret = x509_crt_parse_file( &cacert, "ssl/test-ca/test-ca.crt" );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crtfile returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse_file returned %d\n\n", ret );
goto exit;
}
printf( " ok\n" );
- x509parse_cert_info( buf, 1024, "CRT: ", &cacert );
+ x509_crt_info( buf, 1024, "CRT: ", &cacert );
printf("%s\n", buf );
/*
@@ -120,16 +120,16 @@
printf( " . Loading the CRL ..." );
fflush( stdout );
- ret = x509parse_crlfile( &crl, "ssl/test-ca/crl.pem" );
+ ret = x509_crl_parse_file( &crl, "ssl/test-ca/crl.pem" );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crlfile returned %d\n\n", ret );
+ printf( " failed\n ! x509_crl_parse_file returned %d\n\n", ret );
goto exit;
}
printf( " ok\n" );
- x509parse_crl_info( buf, 1024, "CRL: ", &crl );
+ x509_crl_info( buf, 1024, "CRL: ", &crl );
printf("%s\n", buf );
for( i = 0; i < MAX_CLIENT_CERTS; i++ )
@@ -150,10 +150,10 @@
printf( " . Loading the client certificate %s...", name );
fflush( stdout );
- ret = x509parse_crtfile( &clicert, name );
+ ret = x509_crt_parse_file( &clicert, name );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse_file returned %d\n\n", ret );
goto exit;
}
@@ -165,7 +165,8 @@
printf( " . Verify the client certificate with CA certificate..." );
fflush( stdout );
- ret = x509parse_verify( &clicert, &cacert, &crl, NULL, &flags, NULL, NULL );
+ ret = x509_crt_verify( &clicert, &cacert, &crl, NULL, &flags, NULL,
+ NULL );
if( ret != 0 )
{
if( ret == POLARSSL_ERR_X509_CERT_VERIFY_FAILED )
@@ -183,7 +184,7 @@
if( flags & BADCRL_EXPIRED )
printf( " CRL_EXPIRED " );
} else {
- printf( " failed\n ! x509parse_verify returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_verify returned %d\n\n", ret );
goto exit;
}
}
diff --git a/programs/test/ssl_test.c b/programs/test/ssl_test.c
index 1677aa9..eba3483 100644
--- a/programs/test/ssl_test.c
+++ b/programs/test/ssl_test.c
@@ -214,19 +214,19 @@
printf("POLARSSL_CERTS_C not defined.\n");
goto exit;
#else
- ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt,
- strlen( test_srv_crt ) );
+ ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
+ strlen( test_srv_crt ) );
if( ret != 0 )
{
- printf( " ! x509parse_crt returned %d\n\n", ret );
+ printf( " ! x509_crt_parse returned %d\n\n", ret );
goto exit;
}
- ret = x509parse_crt( &srvcert, (const unsigned char *) test_ca_crt,
- strlen( test_ca_crt ) );
+ ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_crt,
+ strlen( test_ca_crt ) );
if( ret != 0 )
{
- printf( " ! x509parse_crt returned %d\n\n", ret );
+ printf( " ! x509_crt_parse returned %d\n\n", ret );
goto exit;
}
diff --git a/programs/x509/cert_app.c b/programs/x509/cert_app.c
index 160e65d..eff906d 100644
--- a/programs/x509/cert_app.c
+++ b/programs/x509/cert_app.c
@@ -101,7 +101,7 @@
((void) data);
printf( "\nVerify requested for (Depth %d):\n", depth );
- x509parse_cert_info( buf, sizeof( buf ) - 1, "", crt );
+ x509_crt_info( buf, sizeof( buf ) - 1, "", crt );
printf( "%s", buf );
if( ( (*flags) & BADCERT_EXPIRED ) != 0 )
@@ -248,18 +248,18 @@
if( strlen( opt.ca_path ) )
{
- ret = x509parse_crtpath( &cacert, opt.ca_path );
+ ret = x509_crt_parse_path( &cacert, opt.ca_path );
verify = 1;
}
else if( strlen( opt.ca_file ) )
{
- ret = x509parse_crtfile( &cacert, opt.ca_file );
+ ret = x509_crt_parse_file( &cacert, opt.ca_file );
verify = 1;
}
if( ret < 0 )
{
- printf( " failed\n ! x509parse_crt returned -0x%x\n\n", -ret );
+ printf( " failed\n ! x509_crt_parse returned -0x%x\n\n", -ret );
goto exit;
}
@@ -277,18 +277,18 @@
printf( "\n . Loading the certificate(s) ..." );
fflush( stdout );
- ret = x509parse_crtfile( &crt, opt.filename );
+ ret = x509_crt_parse_file( &crt, opt.filename );
if( ret < 0 )
{
- printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_parse_file returned %d\n\n", ret );
x509_crt_free( &crt );
goto exit;
}
if( opt.permissive == 0 && ret > 0 )
{
- printf( " failed\n ! x509parse_crt failed to parse %d certificates\n\n", ret );
+ printf( " failed\n ! x509_crt_parse failed to parse %d certificates\n\n", ret );
x509_crt_free( &crt );
goto exit;
}
@@ -301,10 +301,11 @@
while( cur != NULL )
{
printf( " . Peer certificate information ...\n" );
- ret = x509parse_cert_info( (char *) buf, sizeof( buf ) - 1, " ", cur );
+ ret = x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
+ cur );
if( ret == -1 )
{
- printf( " failed\n ! x509parse_cert_info returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_info returned %d\n\n", ret );
x509_crt_free( &crt );
goto exit;
}
@@ -321,8 +322,8 @@
{
printf( " . Verifying X.509 certificate..." );
- if( ( ret = x509parse_verify( &crt, &cacert, NULL, NULL, &flags,
- my_verify, NULL ) ) != 0 )
+ if( ( ret = x509_crt_verify( &crt, &cacert, NULL, NULL, &flags,
+ my_verify, NULL ) ) != 0 )
{
printf( " failed\n" );
@@ -426,11 +427,11 @@
* 5. Print the certificate
*/
printf( " . Peer certificate information ...\n" );
- ret = x509parse_cert_info( (char *) buf, sizeof( buf ) - 1, " ",
- ssl.session->peer_cert );
+ ret = x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
+ ssl.session->peer_cert );
if( ret == -1 )
{
- printf( " failed\n ! x509parse_cert_info returned %d\n\n", ret );
+ printf( " failed\n ! x509_crt_info returned %d\n\n", ret );
ssl_free( &ssl );
goto exit;
}
diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c
index c50cf81..f020225 100644
--- a/programs/x509/cert_write.c
+++ b/programs/x509/cert_write.c
@@ -409,10 +409,10 @@
printf( " . Loading the issuer certificate ..." );
fflush( stdout );
- if( ( ret = x509parse_crtfile( &issuer_crt, opt.issuer_crt ) ) != 0 )
+ if( ( ret = x509_crt_parse_file( &issuer_crt, opt.issuer_crt ) ) != 0 )
{
error_strerror( ret, buf, 1024 );
- printf( " failed\n ! x509parse_crtfile returned -0x%02x - %s\n\n", -ret, buf );
+ printf( " failed\n ! x509_crt_parse_file returned -0x%02x - %s\n\n", -ret, buf );
goto exit;
}
@@ -441,10 +441,10 @@
printf( " . Loading the certificate request ..." );
fflush( stdout );
- if( ( ret = x509parse_csrfile( &csr, opt.request_file ) ) != 0 )
+ if( ( ret = x509_csr_parse_file( &csr, opt.request_file ) ) != 0 )
{
error_strerror( ret, buf, 1024 );
- printf( " failed\n ! x509parse_csrfile returned -0x%02x - %s\n\n", -ret, buf );
+ printf( " failed\n ! x509_csr_parse_file returned -0x%02x - %s\n\n", -ret, buf );
goto exit;
}
diff --git a/programs/x509/crl_app.c b/programs/x509/crl_app.c
index 2213f81..20754fd 100644
--- a/programs/x509/crl_app.c
+++ b/programs/x509/crl_app.c
@@ -114,11 +114,11 @@
printf( "\n . Loading the CRL ..." );
fflush( stdout );
- ret = x509parse_crlfile( &crl, opt.filename );
+ ret = x509_crl_parse_file( &crl, opt.filename );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_crl returned %d\n\n", ret );
+ printf( " failed\n ! x509_crl_parse_file returned %d\n\n", ret );
x509_crl_free( &crl );
goto exit;
}
@@ -129,10 +129,10 @@
* 1.2 Print the CRL
*/
printf( " . CRL information ...\n" );
- ret = x509parse_crl_info( (char *) buf, sizeof( buf ) - 1, " ", &crl );
+ ret = x509_crl_info( (char *) buf, sizeof( buf ) - 1, " ", &crl );
if( ret == -1 )
{
- printf( " failed\n ! x509parse_crl_info returned %d\n\n", ret );
+ printf( " failed\n ! x509_crl_info returned %d\n\n", ret );
x509_crl_free( &crl );
goto exit;
}
diff --git a/programs/x509/req_app.c b/programs/x509/req_app.c
index 3d35524..6b11fc4 100644
--- a/programs/x509/req_app.c
+++ b/programs/x509/req_app.c
@@ -114,11 +114,11 @@
printf( "\n . Loading the CSR ..." );
fflush( stdout );
- ret = x509parse_csrfile( &csr, opt.filename );
+ ret = x509_csr_parse_file( &csr, opt.filename );
if( ret != 0 )
{
- printf( " failed\n ! x509parse_csr returned %d\n\n", ret );
+ printf( " failed\n ! x509_csr_parse_file returned %d\n\n", ret );
x509_csr_free( &csr );
goto exit;
}
@@ -129,10 +129,10 @@
* 1.2 Print the CSR
*/
printf( " . CSR information ...\n" );
- ret = x509parse_csr_info( (char *) buf, sizeof( buf ) - 1, " ", &csr );
+ ret = x509_csr_info( (char *) buf, sizeof( buf ) - 1, " ", &csr );
if( ret == -1 )
{
- printf( " failed\n ! x509parse_csr_info returned %d\n\n", ret );
+ printf( " failed\n ! x509_csr_info returned %d\n\n", ret );
x509_csr_free( &csr );
goto exit;
}