From dbfb7bd873dfa8e5bf9afb5aae3aa2680e9e2fd4 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Sat, 4 Sep 2021 09:58:58 +0800 Subject: [PATCH] fix various issues - wrong cipher suite filter condition - name conversion - format issue Signed-off-by: Jerry Yu --- library/ssl_tls13_client.c | 6 +++--- library/ssl_tls13_generic.c | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c index f8779a09f..2a62dc6fd 100644 --- a/library/ssl_tls13_client.c +++ b/library/ssl_tls13_client.c @@ -164,8 +164,8 @@ static int ssl_tls13_write_client_hello_cipher_suites( ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( cipher_suite ); if( ciphersuite_info == NULL ) continue; - if( !( MBEDTLS_SSL_MINOR_VERSION_4 > ciphersuite_info->min_minor_ver && - MBEDTLS_SSL_MINOR_VERSION_4 < ciphersuite_info->max_minor_ver ) ) + if( !( MBEDTLS_SSL_MINOR_VERSION_4 >= ciphersuite_info->min_minor_ver && + MBEDTLS_SSL_MINOR_VERSION_4 <= ciphersuite_info->max_minor_ver ) ) continue; MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, add ciphersuite: %04x, %s", @@ -259,7 +259,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl, /* Write cipher_suites */ ret = ssl_tls13_write_client_hello_cipher_suites( ssl, buf, end, &output_len ); - if( ret != 0) + if( ret != 0 ) return( ret ); buf += output_len; diff --git a/library/ssl_tls13_generic.c b/library/ssl_tls13_generic.c index 3c49a379b..ca4c16713 100644 --- a/library/ssl_tls13_generic.c +++ b/library/ssl_tls13_generic.c @@ -53,10 +53,12 @@ int mbedtls_ssl_tls13_finish_handshake_msg( mbedtls_ssl_context *ssl, size_t msg_len ) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; + size_t msg_len_with_header; ((void) buf_len); /* Add reserved 4 bytes for handshake header */ - ssl->out_msglen = msg_len + 4; + msg_len_with_header = msg_len + 4; + ssl->out_msglen = msg_len_with_header; MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_write_handshake_msg_ext( ssl, 0 ) ); cleanup: