From 16c61aa7385da89712d345b68959ef62d26f1c69 Mon Sep 17 00:00:00 2001 From: XiaokangQian Date: Mon, 27 Sep 2021 09:30:17 +0000 Subject: [PATCH] TLS1.3: Alignment coding styles based on comments Fix kinds of alignment issues in fetch handshake messages. Signed-off-by: XiaokangQian --- library/ssl_misc.h | 6 +++--- library/ssl_tls13_generic.c | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/library/ssl_misc.h b/library/ssl_misc.h index fa777cc93..3f3f50503 100644 --- a/library/ssl_misc.h +++ b/library/ssl_misc.h @@ -1493,9 +1493,9 @@ static inline void mbedtls_ssl_handshake_set_state( mbedtls_ssl_context *ssl, * Fetch TLS 1.3 handshake message header */ int mbedtls_ssl_tls1_3_fetch_handshake_msg( mbedtls_ssl_context *ssl, - unsigned hs_type, - unsigned char **buf, - size_t *buf_len ); + unsigned hs_type, + unsigned char **buf, + size_t *buf_len ); /* * Write TLS 1.3 handshake message header diff --git a/library/ssl_tls13_generic.c b/library/ssl_tls13_generic.c index 4aaafa5ea..f7112332f 100644 --- a/library/ssl_tls13_generic.c +++ b/library/ssl_tls13_generic.c @@ -29,9 +29,9 @@ #include "ssl_misc.h" int mbedtls_ssl_tls1_3_fetch_handshake_msg( mbedtls_ssl_context *ssl, - unsigned hs_type, - unsigned char **buf, - size_t *buflen ) + unsigned hs_type, + unsigned char **buf, + size_t *buflen ) { int ret; @@ -41,10 +41,10 @@ int mbedtls_ssl_tls1_3_fetch_handshake_msg( mbedtls_ssl_context *ssl, goto cleanup; } - if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE || + if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE || ssl->in_msg[0] != hs_type ) { - MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate verify message" ) ); + MBEDTLS_SSL_DEBUG_MSG( 1, ( "Receive unexpected handshake message." ) ); MBEDTLS_SSL_PEND_FATAL_ALERT( MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE, MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); ret = MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE; @@ -54,7 +54,6 @@ int mbedtls_ssl_tls1_3_fetch_handshake_msg( mbedtls_ssl_context *ssl, *buf = ssl->in_msg + 4; *buflen = ssl->in_hslen - 4; - cleanup: return( ret );