Rename test_ca_list to test_cas_pem

This commit is contained in:
Manuel Pégourié-Gonnard 2015-03-27 10:23:53 +01:00
parent 2f165060f0
commit a958d69a70
10 changed files with 25 additions and 19 deletions

View File

@ -6,7 +6,9 @@ Features
* Support for DTLS 1.0 and 1.2 (RFC 6347). * Support for DTLS 1.0 and 1.2 (RFC 6347).
API Changes API Changes
* Test certificates in cert.s are no longer guaranteed to be nul-terminated * test_ca_list (from certs.h) is renamed to test_cas_pem and is only
available if POLARSSL_PEM_PARSE_C is defined (it never worked without).
* Test certificates in certs.c are no longer guaranteed to be nul-terminated
strings; use the new *_len variables instead of strlen(). strings; use the new *_len variables instead of strlen().
* md_init_ctx() is deprecated in favour of md_setup(), that adds a third * md_init_ctx() is deprecated in favour of md_setup(), that adds a third
argument (allowing memory savings if HMAC is not used) argument (allowing memory savings if HMAC is not used)

View File

@ -30,9 +30,11 @@
extern "C" { extern "C" {
#endif #endif
#if defined(POLARSSL_PEM_PARSE_C)
/* Concatenation of all CA certificates in PEM format if available */ /* Concatenation of all CA certificates in PEM format if available */
extern const char test_ca_list[]; extern const char test_cas_pem[];
extern const size_t test_ca_list_len; extern const size_t test_cas_pem_len;
#endif
/* List of all CA certificates, terminated by NULL */ /* List of all CA certificates, terminated by NULL */
extern const char * test_cas[]; extern const char * test_cas[];

View File

@ -301,9 +301,11 @@ const char test_dhm_params[] =
const size_t test_dhm_params_len = sizeof( test_dhm_params ); const size_t test_dhm_params_len = sizeof( test_dhm_params );
#endif #endif
#if defined(POLARSSL_PEM_PARSE_C)
/* Concatenation of all available CA certificates */ /* Concatenation of all available CA certificates */
const char test_ca_list[] = TEST_CA_CRT_RSA TEST_CA_CRT_EC; const char test_cas_pem[] = TEST_CA_CRT_RSA TEST_CA_CRT_EC;
const size_t test_ca_list_len = sizeof( test_ca_list ); const size_t test_cas_pem_len = sizeof( test_cas_pem );
#endif
/* List of all available CA certificates */ /* List of all available CA certificates */
const char * test_cas[] = { const char * test_cas[] = {

View File

@ -129,8 +129,8 @@ int main( int argc, char *argv[] )
fflush( stdout ); fflush( stdout );
#if defined(POLARSSL_CERTS_C) #if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_list, ret = x509_crt_parse( &cacert, (const unsigned char *) test_cas_pem,
test_ca_list_len ); test_cas_pem_len );
#else #else
ret = 1; ret = 1;
polarssl_printf("POLARSSL_CERTS_C not defined."); polarssl_printf("POLARSSL_CERTS_C not defined.");

View File

@ -135,8 +135,8 @@ int main( void )
goto exit; goto exit;
} }
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_list, ret = x509_crt_parse( &srvcert, (const unsigned char *) test_cas_pem,
test_ca_list_len ); test_cas_pem_len );
if( ret != 0 ) if( ret != 0 )
{ {
printf( " failed\n ! x509_crt_parse returned %d\n\n", ret ); printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );

View File

@ -120,8 +120,8 @@ int main( void )
fflush( stdout ); fflush( stdout );
#if defined(POLARSSL_CERTS_C) #if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_list, ret = x509_crt_parse( &cacert, (const unsigned char *) test_cas_pem,
test_ca_list_len ); test_cas_pem_len );
#else #else
ret = 1; ret = 1;
polarssl_printf("POLARSSL_CERTS_C not defined."); polarssl_printf("POLARSSL_CERTS_C not defined.");

View File

@ -161,8 +161,8 @@ int main( void )
goto exit; goto exit;
} }
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_list, ret = x509_crt_parse( &srvcert, (const unsigned char *) test_cas_pem,
test_ca_list_len ); test_cas_pem_len );
if( ret != 0 ) if( ret != 0 )
{ {
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret ); polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );

View File

@ -507,8 +507,8 @@ int main( int argc, char *argv[] )
else else
#endif #endif
#if defined(POLARSSL_CERTS_C) #if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_list, ret = x509_crt_parse( &cacert, (const unsigned char *) test_cas_pem,
test_ca_list_len ); test_cas_pem_len );
#else #else
{ {
ret = 1; ret = 1;

View File

@ -424,8 +424,8 @@ int main( void )
goto exit; goto exit;
} }
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_list, ret = x509_crt_parse( &srvcert, (const unsigned char *) test_cas_pem,
test_ca_list_len ); test_cas_pem_len );
if( ret != 0 ) if( ret != 0 )
{ {
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret ); polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );

View File

@ -139,8 +139,8 @@ int main( void )
goto exit; goto exit;
} }
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_list, ret = x509_crt_parse( &srvcert, (const unsigned char *) test_cas_pem,
test_ca_list_len ); test_cas_pem_len );
if( ret != 0 ) if( ret != 0 )
{ {
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret ); polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );