From 525990fb62a9b72cc59e37e4a3342e4285f3c2f2 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Wed, 15 Nov 2023 14:51:18 +0800 Subject: [PATCH] set init value for max_early_data_size in session Signed-off-by: Jerry Yu --- library/ssl_tls.c | 3 +++ library/ssl_tls13_server.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 4daf2e7ee..02e828e58 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -1100,6 +1100,9 @@ static int ssl_handshake_init(mbedtls_ssl_context *ssl) /* Initialize structures */ mbedtls_ssl_session_init(ssl->session_negotiate); ssl_handshake_params_init(ssl->handshake); +#if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_SRV_C) + ssl->session_negotiate->max_early_data_size = ssl->conf->max_early_data_size; +#endif #if defined(MBEDTLS_SSL_PROTO_TLS1_2) mbedtls_ssl_transform_init(ssl->transform_negotiate); diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c index df10cc64f..c04b8bd46 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -564,6 +564,9 @@ static int ssl_tls13_parse_pre_shared_key_ext( #if defined(MBEDTLS_SSL_SESSION_TICKETS) mbedtls_ssl_session session; mbedtls_ssl_session_init(&session); +#if defined(MBEDTLS_SSL_EARLY_DATA) + session.max_early_data_size = ssl->conf->max_early_data_size; +#endif #endif MBEDTLS_SSL_CHK_BUF_READ_PTR(p_identity_len, identities_end, 2 + 1 + 4);