mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	Rewrite test to make Coverity happier
With the default config, it noticed the accept_comp was always 0, so the rest of the test was dead code.
This commit is contained in:
		
							parent
							
								
									db5d15e227
								
							
						
					
					
						commit
						1cf7b30dc8
					
				| @ -1147,7 +1147,10 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl ) | |||||||
|     size_t n; |     size_t n; | ||||||
|     size_t ext_len; |     size_t ext_len; | ||||||
|     unsigned char *buf, *ext; |     unsigned char *buf, *ext; | ||||||
|     unsigned char comp, accept_comp; |     unsigned char comp; | ||||||
|  | #if defined(MBEDTLS_ZLIB_SUPPORT) | ||||||
|  |     int accept_comp; | ||||||
|  | #endif | ||||||
| #if defined(MBEDTLS_SSL_RENEGOTIATION) | #if defined(MBEDTLS_SSL_RENEGOTIATION) | ||||||
|     int renegotiation_info_seen = 0; |     int renegotiation_info_seen = 0; | ||||||
| #endif | #endif | ||||||
| @ -1302,19 +1305,19 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl ) | |||||||
|     comp = buf[37 + n]; |     comp = buf[37 + n]; | ||||||
| 
 | 
 | ||||||
| #if defined(MBEDTLS_ZLIB_SUPPORT) | #if defined(MBEDTLS_ZLIB_SUPPORT) | ||||||
|     accept_comp = 1; |  | ||||||
| #else |  | ||||||
|     accept_comp = 0; |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
|     /* See comments in ssl_write_client_hello() */ |     /* See comments in ssl_write_client_hello() */ | ||||||
| #if defined(MBEDTLS_SSL_PROTO_DTLS) | #if defined(MBEDTLS_SSL_PROTO_DTLS) | ||||||
|     if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) |     if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) | ||||||
|         accept_comp = 0; |         accept_comp = 0; | ||||||
|  |     else | ||||||
| #endif | #endif | ||||||
|  |         accept_comp = 1; | ||||||
| 
 | 
 | ||||||
|     if( ( accept_comp == 0 && comp != MBEDTLS_SSL_COMPRESS_NULL ) || |     if( comp != MBEDTLS_SSL_COMPRESS_NULL && | ||||||
|         ( comp != MBEDTLS_SSL_COMPRESS_NULL && comp != MBEDTLS_SSL_COMPRESS_DEFLATE ) ) |         ( comp != MBEDTLS_SSL_COMPRESS_DEFLATE || accept_comp == 0 ) ) | ||||||
|  | #else /* MBEDTLS_ZLIB_SUPPORT */ | ||||||
|  |     if( comp != MBEDTLS_SSL_COMPRESS_NULL ) | ||||||
|  | #endif/* MBEDTLS_ZLIB_SUPPORT */ | ||||||
|     { |     { | ||||||
|         MBEDTLS_SSL_DEBUG_MSG( 1, ( "server hello, bad compression: %d", comp ) ); |         MBEDTLS_SSL_DEBUG_MSG( 1, ( "server hello, bad compression: %d", comp ) ); | ||||||
|         return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); |         return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Manuel Pégourié-Gonnard
						Manuel Pégourié-Gonnard