fix various issues

- adjust guards. Remove duplicate guards and adjust format.
- Return success at function end. Not `ret`
- change input len

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c
index f90e66e..ee4c24d 100644
--- a/library/ssl_tls13_client.c
+++ b/library/ssl_tls13_client.c
@@ -837,7 +837,7 @@
     /* Get current state of handshake transcript. */
     ret = mbedtls_ssl_get_handshake_transcript(
             ssl, mbedtls_hash_info_md_from_psa( hash_alg ),
-            transcript, MBEDTLS_MD_MAX_SIZE, &transcript_len );
+            transcript, sizeof( transcript ), &transcript_len );
     if( ret != 0 )
         return( ret );
 
@@ -853,7 +853,7 @@
 
     *out_len = 1 + binder_len;
 
-    return( ret );
+    return( 0 );
 }
 
 /*
@@ -918,12 +918,11 @@
     if( ssl_tls13_ticket_get_identity(
             ssl, &hash_alg, &identity, &identity_len ) == 0 )
     {
-
 #if defined(MBEDTLS_HAVE_TIME)
-        uint32_t obfuscated_ticket_age = 0;
         mbedtls_time_t now = mbedtls_time( NULL );
         mbedtls_ssl_session *session = ssl->session_negotiate;
-        obfuscated_ticket_age = (uint32_t)( now - session->ticket_received );
+        uint32_t obfuscated_ticket_age =
+                                (uint32_t)( now - session->ticket_received );
 
         obfuscated_ticket_age *= 1000;
         obfuscated_ticket_age += session->ticket_age_add;
@@ -963,7 +962,7 @@
 
     /* Take into account the two bytes for the length of the binders. */
     l_binders_len += 2;
-    /* Check if there are enough space for binders */
+    /* Check if there is enough space for binders */
     MBEDTLS_SSL_CHK_BUF_PTR( p, end, l_binders_len );
 
     /*
@@ -1105,11 +1104,12 @@
     if( ret != 0 )
     {
         MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_set_hs_psk", ret );
+        return( ret );
     }
-    else
-        ssl->handshake->extensions_present |= MBEDTLS_SSL_EXT_PRE_SHARED_KEY;
 
-    return( ret );
+    ssl->handshake->extensions_present |= MBEDTLS_SSL_EXT_PRE_SHARED_KEY;
+
+    return( 0 );
 }
 
 #endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index a209eef..a68136c 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -1353,8 +1353,7 @@
 }
 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
 
-#if defined(MBEDTLS_SSL_SESSION_TICKETS) && \
-    defined(MBEDTLS_HAVE_TIME)
+#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_HAVE_TIME)
 /* Functions for session ticket tests */
 int dummy_ticket_write( void *p_ticket, const mbedtls_ssl_session *session,
                         unsigned char *start, const unsigned char *end,
@@ -1400,7 +1399,6 @@
             return( MBEDTLS_ERR_SSL_INVALID_MAC );
         case 2:
             return( MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED );
-#if defined(MBEDTLS_HAVE_TIME)
         case 3:
             session->start = mbedtls_time( NULL ) + 10;
             break;
@@ -1416,15 +1414,13 @@
             session->ticket_age_add -= 1000;
 #endif
             break;
-#endif
         default:
             break;
     }
 
     return( ret );
 }
-#endif /* MBEDTLS_SSL_SESSION_TICKETS &&
-          MBEDTLS_HAVE_TIME */
+#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_HAVE_TIME */
 
 int main( int argc, char *argv[] )
 {