From aad9b0a286434da1bf129a600ffed8a95de69725 Mon Sep 17 00:00:00 2001 From: XiaokangQian Date: Mon, 9 May 2022 01:11:21 +0000 Subject: [PATCH] Update code base on comments Change-Id: Ibc5043154515d2801565a2b99741dfda1344211c Signed-off-by: XiaokangQian --- library/ssl_tls.c | 4 ---- library/ssl_tls13_server.c | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 1a62eff03..d18758537 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -8085,14 +8085,10 @@ int mbedtls_ssl_write_sig_alg_ext( mbedtls_ssl_context *ssl, unsigned char *buf, 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 ef9cd1796..775443cd6 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -1140,14 +1140,11 @@ static int ssl_tls13_write_encrypted_extensions( mbedtls_ssl_context *ssl ) 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 @@ static int ssl_tls13_write_certificate_request_body( mbedtls_ssl_context *ssl, 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;