From 31e03a8e15c52e8f2dc0ca442689451da8ba2651 Mon Sep 17 00:00:00 2001 From: Thomas Daubney Date: Mon, 25 Jul 2022 15:59:25 +0100 Subject: [PATCH] Replace hard-coded zeroes for constant Replace two occurances of hard-coded zero for MBEDTLS_SSL_COMPRESS_NULL in TLS 1.3 code. Signed-off-by: Thomas Daubney --- library/ssl_tls13_client.c | 2 +- library/ssl_tls13_server.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c index 91c205801..505f8dda8 100644 --- a/library/ssl_tls13_client.c +++ b/library/ssl_tls13_client.c @@ -1461,7 +1461,7 @@ static int ssl_tls13_parse_server_hello( mbedtls_ssl_context *ssl, * ... */ MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, 1 ); - if( p[0] != 0 ) + if( p[0] != MBEDTLS_SSL_COMPRESS_NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad legacy compression method" ) ); fatal_alert = MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER; diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c index 701d044f3..4319ec3ca 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -1779,7 +1779,7 @@ static int ssl_tls13_write_server_hello_body( mbedtls_ssl_context *ssl, * ... */ MBEDTLS_SSL_CHK_BUF_PTR( p, end, 1 ); - *p++ = 0x0; + *p++ = MBEDTLS_SSL_COMPRESS_NULL; /* ... * Extension extensions<6..2^16-1>;