Fix various errors

Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c
index cd36ea8..b796525 100644
--- a/library/ssl_tls13_client.c
+++ b/library/ssl_tls13_client.c
@@ -1106,7 +1106,8 @@
     }
 
 #if defined(MBEDTLS_SSL_SESSION_TICKETS)
-    if (ssl->session_negotiate->res_ciphersuite !=
+    if (ssl->handshake->resume &&
+        ssl->session_negotiate->res_ciphersuite !=
         ssl->session_negotiate->ciphersuite) {
         MBEDTLS_SSL_DEBUG_MSG(
             1, ("Invalid ciphersuite for session ticket psk."));
@@ -1702,8 +1703,10 @@
     mbedtls_ssl_optimize_checksum(ssl, ciphersuite_info);
 
     handshake->ciphersuite_info = ciphersuite_info;
+#if defined(MBEDTLS_SSL_SESSION_TICKETS)
     ssl->session_negotiate->res_ciphersuite =
         ssl->session_negotiate->ciphersuite;
+#endif
     ssl->session_negotiate->ciphersuite = cipher_suite;
 
     MBEDTLS_SSL_DEBUG_MSG(3, ("server hello, chosen ciphersuite: ( %04x ) - %s",
@@ -2984,10 +2987,12 @@
             if (ret == 0) {
                 mbedtls_ssl_handshake_set_state(ssl, MBEDTLS_SSL_SERVER_HELLO);
 
+#if defined(MBEDTLS_SSL_EARLY_DATA)
                 MBEDTLS_SSL_DEBUG_MSG(
                     1, ("Switch to early data keys for outbound traffic"));
                 mbedtls_ssl_set_outbound_transform(
                     ssl, ssl->handshake->transform_earlydata);
+#endif
             }
             break;
 #endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */