From 7b80c64de424e26013e790dfad0703ebbb0a1f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 2 Jul 2019 16:21:30 +0200 Subject: [PATCH] Fix compile-time guard for optional field in struct --- library/ssl_tls.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 316d537ac..d25942bfc 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -7275,10 +7275,6 @@ static void ssl_handshake_wrapup_free_hs_transform( mbedtls_ssl_context *ssl ) void mbedtls_ssl_handshake_wrapup( mbedtls_ssl_context *ssl ) { -#if !defined(MBEDTLS_SSL_NO_SESSION_CACHE) - int resume = ssl->handshake->resume; -#endif /* !MBEDTLS_SSL_NO_SESSION_CACHE */ - MBEDTLS_SSL_DEBUG_MSG( 3, ( "=> handshake wrapup" ) ); #if defined(MBEDTLS_SSL_RENEGOTIATION) @@ -7306,18 +7302,18 @@ void mbedtls_ssl_handshake_wrapup( mbedtls_ssl_context *ssl ) ssl->session = ssl->session_negotiate; ssl->session_negotiate = NULL; -#if !defined(MBEDTLS_SSL_NO_SESSION_CACHE) +#if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_NO_SESSION_CACHE) /* * Add cache entry */ if( ssl->conf->f_set_cache != NULL && ssl->session->id_len != 0 && - resume == 0 ) + ssl->handshake->resume == 0 ) { if( ssl->conf->f_set_cache( ssl->conf->p_cache, ssl->session ) != 0 ) MBEDTLS_SSL_DEBUG_MSG( 1, ( "cache did not store session" ) ); } -#endif /* !MBEDTLS_SSL_NO_SESSION_CACHE */ +#endif /* MBEDTLS_SSL_SRV_C && !MBEDTLS_SSL_NO_SESSION_CACHE */ #if defined(MBEDTLS_SSL_PROTO_DTLS) if( MBEDTLS_SSL_TRANSPORT_IS_DTLS( ssl->conf->transport ) &&