From d6bbf05f7c663802cd092e2fbf7fc89ae5c4b4d9 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Tue, 5 Mar 2019 16:22:07 +0000 Subject: [PATCH] ssl_server2: Skip CA setup if `ca_path` or `ca_file` argument "none" This allows to test PSK-based ciphersuites via ssl_server2 in builds which have MBEDTLS_X509_CRT_PARSE_C enabled but both MBEDTLS_FS_IO and MBEDTLS_CERTS_C disabled. --- programs/ssl/ssl_server2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index ec23c8a85..2c5a8cee9 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -1582,17 +1582,17 @@ int main( int argc, char *argv[] ) mbedtls_printf( " . Loading the CA root certificate ..." ); fflush( stdout ); + if( strcmp( opt.ca_path, "none" ) == 0 || + strcmp( opt.ca_file, "none" ) == 0 ) + { + ret = 0; + } + else #if defined(MBEDTLS_FS_IO) if( strlen( opt.ca_path ) ) - if( strcmp( opt.ca_path, "none" ) == 0 ) - ret = 0; - else - ret = mbedtls_x509_crt_parse_path( &cacert, opt.ca_path ); + ret = mbedtls_x509_crt_parse_path( &cacert, opt.ca_path ); else if( strlen( opt.ca_file ) ) - if( strcmp( opt.ca_file, "none" ) == 0 ) - ret = 0; - else - ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file ); + ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file ); else #endif #if defined(MBEDTLS_CERTS_C)