From 52e08cbcb2a97435ecdf694699b4c059c81b891c Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Tue, 8 Dec 2020 04:46:25 -0500 Subject: [PATCH] Fix unused parameters and ifdefs Signed-off-by: Andrzej Kurek --- library/ssl_cli.c | 4 ++-- library/ssl_tls.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/ssl_cli.c b/library/ssl_cli.c index 123454338..08d5a7117 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -3654,14 +3654,14 @@ static int ssl_out_client_key_exchange_write( mbedtls_ssl_context *ssl, { ((void) n); - + ((void) ret); if( (size_t)( end - p ) < 2 * NUM_ECC_BYTES + 2 ) return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); *p++ = 2 * NUM_ECC_BYTES + 1; *p++ = 0x04; /* uncompressed point presentation */ -#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) && defined(MBEDTLS_USE_TINYCRYPT) +#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) memcpy( p, ssl->handshake->ecdh_publickey, 2 * NUM_ECC_BYTES ); #else ret = uECC_make_key( p, ssl->handshake->ecdh_privkey ); diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 47611552e..64f43f0d1 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -12056,7 +12056,9 @@ void mbedtls_ssl_handshake_free( mbedtls_ssl_context *ssl ) #endif #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ -#if defined(MBEDTLS_SSL_FREE_SERVER_CERTIFICATE) +#if defined(MBEDTLS_SSL_FREE_SERVER_CERTIFICATE) && \ + defined(MBEDTLS_X509_CRT_PARSE_C) && \ + defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) mbedtls_x509_crt_free( ssl->session_negotiate->peer_cert ); mbedtls_free( ssl->session->peer_cert ); ssl->session->peer_cert = NULL;