Refine the server name compare logic

Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
diff --git a/library/ssl_client.c b/library/ssl_client.c
index 9935395..48a19c9 100644
--- a/library/ssl_client.c
+++ b/library/ssl_client.c
@@ -876,19 +876,11 @@
     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 )
         {