mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	Robustness fix in mbedtls_ssl_derive_keys
In mbedtls_ssl_derive_keys, don't call mbedtls_md_hmac_starts in ciphersuites that don't use HMAC. This doesn't change the behavior of the code, but avoids relying on an uncaught error when attempting to start an HMAC operation that hadn't been initialized.
This commit is contained in:
		
							parent
							
								
									4ba87fc958
								
							
						
					
					
						commit
						039fd12834
					
				| @ -855,8 +855,13 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl ) | |||||||
|     defined(MBEDTLS_SSL_PROTO_TLS1_2) |     defined(MBEDTLS_SSL_PROTO_TLS1_2) | ||||||
|     if( ssl->minor_ver >= MBEDTLS_SSL_MINOR_VERSION_1 ) |     if( ssl->minor_ver >= MBEDTLS_SSL_MINOR_VERSION_1 ) | ||||||
|     { |     { | ||||||
|         mbedtls_md_hmac_starts( &transform->md_ctx_enc, mac_enc, mac_key_len ); |         /* For HMAC-based ciphersuites, initialize the HMAC transforms.
 | ||||||
|         mbedtls_md_hmac_starts( &transform->md_ctx_dec, mac_dec, mac_key_len ); |            For AEAD-based ciphersuites, there is nothing to do here. */ | ||||||
|  |         if( mac_key_len != 0 ) | ||||||
|  |         { | ||||||
|  |             mbedtls_md_hmac_starts( &transform->md_ctx_enc, mac_enc, mac_key_len ); | ||||||
|  |             mbedtls_md_hmac_starts( &transform->md_ctx_dec, mac_dec, mac_key_len ); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
| #endif | #endif | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Gilles Peskine
						Gilles Peskine