From a855cb635d3e22cab70c9e817b9e3455928d876a Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Wed, 24 Jul 2019 14:57:54 +0100 Subject: [PATCH] Avoid unused variable warning in ServerKeyExchange parsing ssl_server_key_exchange_parse() is compiled even if there's no ciphersuite enabled which uses it (for example, that's the case in RSA-only builds). The rationale for that is to avoid cluttering the code with numerous compile-time guards. A consequence, however, is the top of ssl_server_key_exchange_parse() contains declarations for variables which are never put to use, and rightfully leading to compiler warnings. This commit silences these warnings by putting `((void) VAR);` statements in the branch which detects if we ever happen to call the function in an unexpected ciphersuite. --- library/ssl_cli.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/ssl_cli.c b/library/ssl_cli.c index e672af129..e8c4a09b4 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -2892,6 +2892,10 @@ static int ssl_server_key_exchange_parse( mbedtls_ssl_context *ssl, else #endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ { + ((void) ret); + ((void) p); + ((void) end); + ((void) ciphersuite_info); MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); }