Update code base on comments

Change-Id: Ibc5043154515d2801565a2b99741dfda1344211c
Signed-off-by: XiaokangQian <xiaokang.qian@arm.com>
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 1a62eff..d187585 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -8085,14 +8085,10 @@
         return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
     }
 
-    /* Write extension_type */
     MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_SIG_ALG, buf, 0 );
-    /* Write extension_data_length */
     MBEDTLS_PUT_UINT16_BE( supported_sig_alg_len + 2, buf, 2 );
-    /* Write length of supported_signature_algorithms */
     MBEDTLS_PUT_UINT16_BE( supported_sig_alg_len, buf, 4 );
 
-    /* Output the total length of signature algorithms extension. */
     *out_len = p - buf;
 
 #if defined(MBEDTLS_SSL_PROTO_TLS1_3)
diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c
index ef9cd17..775443c 100644
--- a/library/ssl_tls13_server.c
+++ b/library/ssl_tls13_server.c
@@ -1140,14 +1140,11 @@
     MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_finish_handshake_msg(
                               ssl, buf_len, msg_len ) );
 
-    /* Update state */
 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
     if( mbedtls_ssl_tls13_some_psk_enabled( ssl ) )
         mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_SERVER_FINISHED );
     else
-    {
         mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CERTIFICATE_REQUEST );
-    }
 #else
     mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_SERVER_FINISHED );
 #endif
@@ -1226,9 +1223,8 @@
     if( ret != 0 )
         return( ret );
 
-    /* length field for all extensions */
-    MBEDTLS_PUT_UINT16_BE( output_len, p_extensions_len, 0 );
     p += output_len;
+    MBEDTLS_PUT_UINT16_BE( p - p_extensions_len - 2, p_extensions_len, 0 );
 
     *out_len = p - buf;