From 7533635e5acbc3d28d1da334ebc006a57386feff Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Wed, 1 Sep 2021 15:59:36 +0800 Subject: [PATCH] Change dummy extension return With error return, server can not receive Client Hello message. If received , we can test current status. Signed-off-by: Jerry Yu --- library/ssl_tls13_client.c | 10 ++++++---- library/ssl_tls13_generic.c | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c index 41c7a4d14..426568cce 100644 --- a/library/ssl_tls13_client.c +++ b/library/ssl_tls13_client.c @@ -101,8 +101,9 @@ static int ssl_tls13_write_supported_groups_ext( mbedtls_ssl_context *ssl, ((void) ssl); ((void) buf); ((void) end); - ((void) olen); - return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); + *olen = 0; + MBEDTLS_SSL_DEBUG_MSG( 3, ( "supported groups extension is not available" ) ); + return( 0 ); } static int ssl_tls13_write_key_shares_ext( mbedtls_ssl_context *ssl, @@ -113,8 +114,9 @@ static int ssl_tls13_write_key_shares_ext( mbedtls_ssl_context *ssl, ((void) ssl); ((void) buf); ((void) end); - ((void) olen); - return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); + *olen = 0; + MBEDTLS_SSL_DEBUG_MSG( 3, ( "key share extension is not available" ) ); + return( 0 ); } #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */ diff --git a/library/ssl_tls13_generic.c b/library/ssl_tls13_generic.c index ca4c16713..1ff23bc01 100644 --- a/library/ssl_tls13_generic.c +++ b/library/ssl_tls13_generic.c @@ -24,9 +24,11 @@ #if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) #include "mbedtls/error.h" +#include "mbedtls/debug.h" #include "ssl_misc.h" + int mbedtls_ssl_tls13_start_handshake_msg( mbedtls_ssl_context *ssl, unsigned hs_type, unsigned char **buf, @@ -108,8 +110,9 @@ int mbedtls_ssl_tls13_write_sig_alg_ext( mbedtls_ssl_context *ssl, ((void) ssl); ((void) buf); ((void) end); - ((void) olen); - return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); + *olen = 0; + MBEDTLS_SSL_DEBUG_MSG( 3, ( "signature_algorithm extension is not available" ) ); + return( 0 ); } #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */