1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Add len constants to certs.c

This commit is contained in:
Manuel Pégourié-Gonnard
2015-03-27 09:56:18 +01:00
parent 5cbb60bfa3
commit 75f901006b
12 changed files with 115 additions and 55 deletions

View File

@ -130,7 +130,7 @@ int main( int argc, char *argv[] )
#if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
#else
ret = 1;
polarssl_printf("POLARSSL_CERTS_C not defined.");

View File

@ -128,7 +128,7 @@ int main( void )
* server and CA certificates, as well as pk_parse_keyfile().
*/
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
strlen( test_srv_crt ) );
test_srv_crt_len );
if( ret != 0 )
{
printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
@ -136,7 +136,7 @@ int main( void )
}
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
if( ret != 0 )
{
printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
@ -144,7 +144,7 @@ int main( void )
}
ret = pk_parse_key( &pkey, (const unsigned char *) test_srv_key,
strlen( test_srv_key ), NULL, 0 );
test_srv_key_len, NULL, 0 );
if( ret != 0 )
{
printf( " failed\n ! pk_parse_key returned %d\n\n", ret );

View File

@ -121,7 +121,7 @@ int main( void )
#if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
#else
ret = 1;
polarssl_printf("POLARSSL_CERTS_C not defined.");

View File

@ -947,7 +947,7 @@ int main( int argc, char *argv[] )
#endif
#if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
#else
{
ret = 1;
@ -980,7 +980,7 @@ int main( int argc, char *argv[] )
#endif
#if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &clicert, (const unsigned char *) test_cli_crt,
strlen( test_cli_crt ) );
test_cli_crt_len );
#else
{
ret = 1;
@ -1003,7 +1003,7 @@ int main( int argc, char *argv[] )
#endif
#if defined(POLARSSL_CERTS_C)
ret = pk_parse_key( &pkey, (const unsigned char *) test_cli_key,
strlen( test_cli_key ), NULL, 0 );
test_cli_key_len, NULL, 0 );
#else
{
ret = 1;

View File

@ -154,7 +154,7 @@ int main( void )
* server and CA certificates, as well as pk_parse_keyfile().
*/
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
strlen( test_srv_crt ) );
test_srv_crt_len );
if( ret != 0 )
{
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
@ -162,7 +162,7 @@ int main( void )
}
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
if( ret != 0 )
{
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
@ -170,7 +170,7 @@ int main( void )
}
ret = pk_parse_key( &pkey, (const unsigned char *) test_srv_key,
strlen( test_srv_key ), NULL, 0 );
test_srv_key_len, NULL, 0 );
if( ret != 0 )
{
polarssl_printf( " failed\n ! pk_parse_key returned %d\n\n", ret );

View File

@ -508,7 +508,7 @@ int main( int argc, char *argv[] )
#endif
#if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
#else
{
ret = 1;
@ -538,7 +538,7 @@ int main( int argc, char *argv[] )
#endif
#if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &clicert, (const unsigned char *) test_cli_crt,
strlen( test_cli_crt ) );
test_cli_crt_len );
#else
{
ret = -1;
@ -558,7 +558,7 @@ int main( int argc, char *argv[] )
#endif
#if defined(POLARSSL_CERTS_C)
ret = pk_parse_key( &pkey, (const unsigned char *) test_cli_key,
strlen( test_cli_key ), NULL, 0 );
test_cli_key_len, NULL, 0 );
#else
{
ret = -1;

View File

@ -417,7 +417,7 @@ int main( void )
* server and CA certificates, as well as pk_parse_keyfile().
*/
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
strlen( test_srv_crt ) );
test_srv_crt_len );
if( ret != 0 )
{
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
@ -425,7 +425,7 @@ int main( void )
}
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
if( ret != 0 )
{
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
@ -434,7 +434,7 @@ int main( void )
pk_init( &pkey );
ret = pk_parse_key( &pkey, (const unsigned char *) test_srv_key,
strlen( test_srv_key ), NULL, 0 );
test_srv_key_len, NULL, 0 );
if( ret != 0 )
{
polarssl_printf( " failed\n ! pk_parse_key returned %d\n\n", ret );

View File

@ -132,7 +132,7 @@ int main( void )
* server and CA certificates, as well as pk_parse_keyfile().
*/
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
strlen( test_srv_crt ) );
test_srv_crt_len );
if( ret != 0 )
{
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
@ -140,7 +140,7 @@ int main( void )
}
ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
if( ret != 0 )
{
polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
@ -148,7 +148,7 @@ int main( void )
}
ret = pk_parse_key( &pkey, (const unsigned char *) test_srv_key,
strlen( test_srv_key ), NULL, 0 );
test_srv_key_len, NULL, 0 );
if( ret != 0 )
{
polarssl_printf( " failed\n ! pk_parse_key returned %d\n\n", ret );

View File

@ -1328,7 +1328,7 @@ int main( int argc, char *argv[] )
#endif
#if defined(POLARSSL_CERTS_C)
ret = x509_crt_parse( &cacert, (const unsigned char *) test_ca_list,
strlen( test_ca_list ) );
test_ca_list_len );
#else
{
ret = 1;
@ -1416,14 +1416,14 @@ int main( int argc, char *argv[] )
#if defined(POLARSSL_RSA_C)
if( ( ret = x509_crt_parse( &srvcert,
(const unsigned char *) test_srv_crt_rsa,
strlen( test_srv_crt_rsa ) ) ) != 0 )
test_srv_crt_rsa_len ) ) != 0 )
{
polarssl_printf( " failed\n ! x509_crt_parse returned -0x%x\n\n", -ret );
goto exit;
}
if( ( ret = pk_parse_key( &pkey,
(const unsigned char *) test_srv_key_rsa,
strlen( test_srv_key_rsa ), NULL, 0 ) ) != 0 )
test_srv_key_rsa_len, NULL, 0 ) ) != 0 )
{
polarssl_printf( " failed\n ! pk_parse_key returned -0x%x\n\n", -ret );
goto exit;
@ -1433,14 +1433,14 @@ int main( int argc, char *argv[] )
#if defined(POLARSSL_ECDSA_C)
if( ( ret = x509_crt_parse( &srvcert2,
(const unsigned char *) test_srv_crt_ec,
strlen( test_srv_crt_ec ) ) ) != 0 )
test_srv_crt_ec_len ) ) != 0 )
{
polarssl_printf( " failed\n ! x509_crt_parse2 returned -0x%x\n\n", -ret );
goto exit;
}
if( ( ret = pk_parse_key( &pkey2,
(const unsigned char *) test_srv_key_ec,
strlen( test_srv_key_ec ), NULL, 0 ) ) != 0 )
test_srv_key_ec_len, NULL, 0 ) ) != 0 )
{
polarssl_printf( " failed\n ! pk_parse_key2 returned -0x%x\n\n", -ret );
goto exit;