diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 13439702e..3f29ec5a1 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -1235,6 +1235,8 @@ int main( int argc, char *argv[] ) else #endif #if defined(MBEDTLS_CERTS_C) + { +#if defined(MBEDTLS_PEM_PARSE_C) for( i = 0; mbedtls_test_cas[i] != NULL; i++ ) { ret = mbedtls_x509_crt_parse( &cacert, @@ -1243,12 +1245,23 @@ int main( int argc, char *argv[] ) if( ret != 0 ) break; } + if( ret == 0 ) +#endif /* MBEDTLS_PEM_PARSE_C */ + for( i = 0; mbedtls_test_cas_der[i] != NULL; i++ ) + { + ret = mbedtls_x509_crt_parse_der( &cacert, + (const unsigned char *) mbedtls_test_cas_der[i], + mbedtls_test_cas_der_len[i] ); + if( ret != 0 ) + break; + } + } #else { ret = 1; mbedtls_printf( "MBEDTLS_CERTS_C not defined." ); } -#endif +#endif /* MBEDTLS_CERTS_C */ if( ret < 0 ) { mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned -0x%x\n\n",