Refactor macro-spanning ifs in ssl_tls.c
@@ -1211,9 +1211,11 @@ int mbedtls_ssl_session_reset_int( mbedtls_ssl_context *ssl, int partial )
#endif
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
+ int free_cli_id = 1;
#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE)
- if( partial == 0 )
+ free_cli_id = ( partial == 0 );
#endif
+ if( free_cli_id )
{
mbedtls_free( ssl->cli_id );
ssl->cli_id = NULL;
@@ -7601,11 +7603,16 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
* sequence number).
*/
transform->ivlen = 12;
+
+ int is_chachapoly = 0;
#if defined(MBEDTLS_USE_PSA_CRYPTO)
- if( key_type == PSA_KEY_TYPE_CHACHA20 )
+ is_chachapoly = ( key_type == PSA_KEY_TYPE_CHACHA20 );
#else
- if( mbedtls_cipher_info_get_mode( cipher_info ) == MBEDTLS_MODE_CHACHAPOLY )
+ is_chachapoly = ( mbedtls_cipher_info_get_mode( cipher_info )
+ == MBEDTLS_MODE_CHACHAPOLY );
#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
+ if( is_chachapoly )
transform->fixed_ivlen = 12;
else
transform->fixed_ivlen = 4;
