mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	ssl_client2: Skip CA setup if ca_path or ca_file argument "none"
				
					
				
			This allows to test PSK-based ciphersuites via ssl_client2 in builds which have MBEDTLS_X509_CRT_PARSE_C enabled but both MBEDTLS_FS_IO and MBEDTLS_CERTS_C disabled. A similar change is applied to the `crt_file` and `key_file` arguments.
This commit is contained in:
		
							parent
							
								
									a0c5ceb2af
								
							
						
					
					
						commit
						623e7b4422
					
				| @ -1497,16 +1497,16 @@ int main( int argc, char *argv[] ) | |||||||
|     mbedtls_printf( "  . Loading the CA root certificate ..." ); |     mbedtls_printf( "  . Loading the CA root certificate ..." ); | ||||||
|     fflush( stdout ); |     fflush( stdout ); | ||||||
| 
 | 
 | ||||||
|  |     if( strcmp( opt.ca_path, "none" ) == 0 || | ||||||
|  |         strcmp( opt.ca_file, "none" ) == 0 ) | ||||||
|  |     { | ||||||
|  |         ret = 0; | ||||||
|  |     } | ||||||
|  |     else | ||||||
| #if defined(MBEDTLS_FS_IO) | #if defined(MBEDTLS_FS_IO) | ||||||
|     if( strlen( opt.ca_path ) ) |     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 ) ) |     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 |     else | ||||||
| #endif | #endif | ||||||
| @ -1555,11 +1555,11 @@ int main( int argc, char *argv[] ) | |||||||
|     mbedtls_printf( "  . Loading the client cert. and key..." ); |     mbedtls_printf( "  . Loading the client cert. and key..." ); | ||||||
|     fflush( stdout ); |     fflush( stdout ); | ||||||
| 
 | 
 | ||||||
| #if defined(MBEDTLS_FS_IO) |  | ||||||
|     if( strlen( opt.crt_file ) ) |  | ||||||
|     if( strcmp( opt.crt_file, "none" ) == 0 ) |     if( strcmp( opt.crt_file, "none" ) == 0 ) | ||||||
|         ret = 0; |         ret = 0; | ||||||
|     else |     else | ||||||
|  | #if defined(MBEDTLS_FS_IO) | ||||||
|  |     if( strlen( opt.crt_file ) ) | ||||||
|         ret = mbedtls_x509_crt_parse_file( &clicert, opt.crt_file ); |         ret = mbedtls_x509_crt_parse_file( &clicert, opt.crt_file ); | ||||||
|     else |     else | ||||||
| #endif | #endif | ||||||
| @ -1580,11 +1580,11 @@ int main( int argc, char *argv[] ) | |||||||
|         goto exit; |         goto exit; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #if defined(MBEDTLS_FS_IO) |  | ||||||
|     if( strlen( opt.key_file ) ) |  | ||||||
|     if( strcmp( opt.key_file, "none" ) == 0 ) |     if( strcmp( opt.key_file, "none" ) == 0 ) | ||||||
|         ret = 0; |         ret = 0; | ||||||
|     else |     else | ||||||
|  | #if defined(MBEDTLS_FS_IO) | ||||||
|  |     if( strlen( opt.key_file ) ) | ||||||
|         ret = mbedtls_pk_parse_keyfile( &pkey, opt.key_file, "" ); |         ret = mbedtls_pk_parse_keyfile( &pkey, opt.key_file, "" ); | ||||||
|     else |     else | ||||||
| #endif | #endif | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hanno Becker
						Hanno Becker