mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-24 19:35:43 +00:00
ssl_server2: Fail gracefully if no PEM-encoded CRTs are available
This commit is contained in:
parent
d6bbf05f7c
commit
beaf3d0eaa
|
@ -1595,7 +1595,7 @@ int main( int argc, char *argv[] )
|
|||
ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file );
|
||||
else
|
||||
#endif
|
||||
#if defined(MBEDTLS_CERTS_C)
|
||||
#if defined(MBEDTLS_CERTS_C) && defined(MBEDTLS_PEM_PARSE_C)
|
||||
for( i = 0; mbedtls_test_cas[i] != NULL; i++ )
|
||||
{
|
||||
ret = mbedtls_x509_crt_parse( &cacert,
|
||||
|
@ -1607,9 +1607,13 @@ int main( int argc, char *argv[] )
|
|||
#else
|
||||
{
|
||||
ret = 1;
|
||||
mbedtls_printf("MBEDTLS_CERTS_C not defined.");
|
||||
#if !defined(MBEDTLS_CERTS_C)
|
||||
mbedtls_printf( "MBEDTLS_CERTS_C not defined." );
|
||||
#else
|
||||
mbedtls_printf( "All test CRTs loaded via MBEDTLS_CERTS_C are PEM-encoded, but MBEDTLS_PEM_PARSE_C is disabled." );
|
||||
}
|
||||
#endif
|
||||
#endif /* MBEDTLS_CERTS_C */
|
||||
#endif /* MBEDTLS_CERTS_C && MBEDTLS_PEM_PARSE_C */
|
||||
if( ret < 0 )
|
||||
{
|
||||
mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned -0x%x\n\n", -ret );
|
||||
|
|
Loading…
Reference in a new issue