test_suite_ssl: Test EndOfEarlyData on record boundary enforcement

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2026-06-09 13:20:49 +02:00
parent cbef7256ce
commit 2de65b79a3
2 changed files with 36 additions and 0 deletions

View File

@ -3604,3 +3604,7 @@ tls13_record_boundary_alignment:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_HS_FINISHED
TLS 1.3 client Finished record boundary alignement enforcement
tls13_record_boundary_alignment:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_HS_FINISHED
TLS 1.3 EndOfEarlyData record boundary alignement enforcement
depends_on:MBEDTLS_SSL_EARLY_DATA:MBEDTLS_SSL_SESSION_TICKETS
tls13_record_boundary_alignment:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_HS_END_OF_EARLY_DATA

View File

@ -6968,6 +6968,9 @@ void tls13_record_boundary_alignment(int endpoint, int handshake_message)
mbedtls_test_init_handshake_options(&client_options);
mbedtls_test_init_handshake_options(&server_options);
mbedtls_ssl_session saved_session;
mbedtls_ssl_session_init(&saved_session);
tls_tweak_in_msglen_context tweak_in_msglen_ctx;
memset(&tweak_in_msglen_ctx, 0, sizeof(tweak_in_msglen_ctx));
@ -7004,6 +7007,21 @@ void tls13_record_boundary_alignment(int endpoint, int handshake_message)
encrypted = 1;
break;
#if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_SESSION_TICKETS)
case MBEDTLS_SSL_HS_END_OF_EARLY_DATA:
TEST_EQUAL(endpoint, MBEDTLS_SSL_IS_SERVER);
target_state = MBEDTLS_SSL_END_OF_EARLY_DATA;
peer_target_state = MBEDTLS_SSL_CLIENT_CERTIFICATE;
encrypted = 1;
client_options.early_data = MBEDTLS_SSL_EARLY_DATA_ENABLED;
server_options.early_data = MBEDTLS_SSL_EARLY_DATA_ENABLED;
ret = mbedtls_test_get_tls13_ticket(&client_options, &server_options,
&saved_session);
TEST_EQUAL(ret, 0);
break;
#endif
default:
TEST_ASSERT(0);
}
@ -7029,6 +7047,19 @@ void tls13_record_boundary_alignment(int endpoint, int handshake_message)
&client_options), 0);
TEST_EQUAL(mbedtls_test_ssl_endpoint_init(&server_ep, MBEDTLS_SSL_IS_SERVER,
&server_options), 0);
#if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_SESSION_TICKETS)
if (handshake_message == MBEDTLS_SSL_HS_END_OF_EARLY_DATA) {
mbedtls_ssl_conf_session_tickets_cb(&server_ep.conf,
mbedtls_test_ticket_write,
mbedtls_test_ticket_parse,
NULL);
ret = mbedtls_ssl_set_session(&(client_ep.ssl), &saved_session);
TEST_EQUAL(ret, 0);
}
#endif
TEST_EQUAL(mbedtls_test_mock_socket_connect(&(client_ep.socket),
&(server_ep.socket), 1024), 0);
@ -7090,6 +7121,7 @@ exit:
mbedtls_test_free_handshake_options(&client_options);
mbedtls_test_free_handshake_options(&server_options);
mbedtls_debug_set_threshold(0);
mbedtls_ssl_session_free(&saved_session);
PSA_DONE();
}
/* END_CASE */