From b3bb31bd90b1b34495db012ad30dab41dd4ccbb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 26 Jul 2019 16:37:45 +0200 Subject: [PATCH] Introduce getter function for disable_renego --- include/mbedtls/ssl_internal.h | 10 ++++++++++ library/ssl_tls.c | 12 ++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/mbedtls/ssl_internal.h b/include/mbedtls/ssl_internal.h index 7cab1e2a0..5786f657e 100644 --- a/include/mbedtls/ssl_internal.h +++ b/include/mbedtls/ssl_internal.h @@ -1243,6 +1243,16 @@ static inline int mbedtls_ssl_get_renego_status( #endif } +static inline int mbedtls_ssl_conf_get_disable_renego( + const mbedtls_ssl_config *conf ) +{ +#if defined(MBEDTLS_SSL_RENEGOTIATION) + return( conf->disable_renegotiation ); +#else + (void) conf; + return( MBEDTLS_SSL_RENEGOTIATION_DISABLED ); +#endif +} /* * Getter functions for fields in mbedtls_ssl_config which may diff --git a/library/ssl_tls.c b/library/ssl_tls.c index bded6c3ec..42ccb780b 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -10855,10 +10855,8 @@ int mbedtls_ssl_context_save( mbedtls_ssl_context *ssl, /* ... with an AEAD ciphersuite. */ mbedtls_ssl_transform_uses_aead( ssl->transform ) != 1 || /* Renegotation is disabled. */ -#if defined(MBEDTLS_SSL_RENEGOTIATION) - ssl->conf->disable_renegotiation != MBEDTLS_SSL_RENEGOTIATION_DISABLED || -#endif - 0 ) + mbedtls_ssl_conf_get_disable_renego( ssl->conf ) + != MBEDTLS_SSL_RENEGOTIATION_DISABLED ) { return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); } @@ -11081,10 +11079,8 @@ static int ssl_context_load( mbedtls_ssl_context *ssl, MBEDTLS_SSL_MINOR_VERSION_3 || mbedtls_ssl_conf_get_min_minor_ver( ssl->conf ) > MBEDTLS_SSL_MINOR_VERSION_3 || -#if defined(MBEDTLS_SSL_RENEGOTIATION) - ssl->conf->disable_renegotiation != MBEDTLS_SSL_RENEGOTIATION_DISABLED || -#endif - 0 ) + mbedtls_ssl_conf_get_disable_renego( ssl->conf ) + != MBEDTLS_SSL_RENEGOTIATION_DISABLED ) { return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); }