Skip to content

Commit 0ee2e4a

Browse files
tests: ssl: Add max_early_data_size option
Signed-off-by: Ronald Cron <[email protected]>
1 parent dcb09ca commit 0ee2e4a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/include/test/ssl_helpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ typedef struct mbedtls_test_handshake_test_options {
114114
void (*cli_log_fun)(void *, int, const char *, int, const char *);
115115
int resize_buffers;
116116
int early_data;
117+
int max_early_data_size;
117118
#if defined(MBEDTLS_SSL_CACHE_C)
118119
mbedtls_ssl_cache_context *cache;
119120
#endif

tests/src/test_helpers/ssl_helpers.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void mbedtls_test_init_handshake_options(
6868
opts->legacy_renegotiation = MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION;
6969
opts->resize_buffers = 1;
7070
opts->early_data = MBEDTLS_SSL_EARLY_DATA_DISABLED;
71+
opts->max_early_data_size = -1;
7172
#if defined(MBEDTLS_SSL_CACHE_C)
7273
TEST_CALLOC(opts->cache, 1);
7374
mbedtls_ssl_cache_init(opts->cache);
@@ -815,6 +816,13 @@ int mbedtls_test_ssl_endpoint_init(
815816

816817
#if defined(MBEDTLS_SSL_EARLY_DATA)
817818
mbedtls_ssl_conf_early_data(&(ep->conf), options->early_data);
819+
#if defined(MBEDTLS_SSL_SRV_C)
820+
if (endpoint_type == MBEDTLS_SSL_IS_SERVER &&
821+
(options->max_early_data_size >= 0)) {
822+
mbedtls_ssl_conf_max_early_data_size(&(ep->conf),
823+
options->max_early_data_size);
824+
}
825+
#endif
818826
#endif
819827

820828
#if defined(MBEDTLS_SSL_CACHE_C) && defined(MBEDTLS_SSL_SRV_C)

0 commit comments

Comments
 (0)