diff --git a/library/ssl_client.c b/library/ssl_client.c index 993539573b..48a19c9e4d 100644 --- a/library/ssl_client.c +++ b/library/ssl_client.c @@ -876,19 +876,11 @@ static int ssl_prepare_client_hello( mbedtls_ssl_context *ssl ) if( ssl->tls_version == MBEDTLS_SSL_VERSION_TLS1_3 && ssl->handshake->resume ) { - int hostname_mismatch = 0; - if( ssl->session_negotiate->hostname != NULL ) - { - if( ssl->hostname != NULL ) - { - if( strcmp( ssl->hostname, ssl->session_negotiate->hostname) ) - hostname_mismatch = 1; - } - else - hostname_mismatch = 1; - } - else - hostname_mismatch = ssl->hostname != NULL; + int hostname_mismatch = ssl->hostname != NULL || + ssl->session_negotiate->hostname != NULL; + if( ssl->hostname != NULL && ssl->session_negotiate->hostname != NULL ) + hostname_mismatch = strcmp( + ssl->hostname, ssl->session_negotiate->hostname ) != 0; if( hostname_mismatch ) {