Add unit test for max_early_data_size of ticket

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2022-12-12 15:14:56 +08:00
parent 33bf240e53
commit 34e9516cb6
2 changed files with 10 additions and 0 deletions

View File

@ -1638,6 +1638,10 @@ int mbedtls_test_ssl_tls13_populate_session(mbedtls_ssl_session *session,
session->resumption_key_len = 32; session->resumption_key_len = 32;
memset(session->resumption_key, 0x99, sizeof(session->resumption_key)); memset(session->resumption_key, 0x99, sizeof(session->resumption_key));
#if defined(MBEDTLS_SSL_EARLY_DATA)
session->max_early_data_size = 0x87654321;
#endif
#if defined(MBEDTLS_HAVE_TIME) #if defined(MBEDTLS_HAVE_TIME)
if (session->endpoint == MBEDTLS_SSL_IS_SERVER) { if (session->endpoint == MBEDTLS_SSL_IS_SERVER) {
session->start = mbedtls_time(NULL) - 42; session->start = mbedtls_time(NULL) - 42;

View File

@ -2042,6 +2042,12 @@ void ssl_serialize_session_save_load(int ticket_len, char *crt_file,
restored.resumption_key, restored.resumption_key,
original.resumption_key_len) == 0); original.resumption_key_len) == 0);
} }
#if defined(MBEDTLS_SSL_EARLY_DATA)
TEST_ASSERT(
original.max_early_data_size == restored.max_early_data_size);
#endif
#if defined(MBEDTLS_HAVE_TIME) && defined(MBEDTLS_SSL_SRV_C) #if defined(MBEDTLS_HAVE_TIME) && defined(MBEDTLS_SSL_SRV_C)
if (endpoint_type == MBEDTLS_SSL_IS_SERVER) { if (endpoint_type == MBEDTLS_SSL_IS_SERVER) {
TEST_ASSERT(original.start == restored.start); TEST_ASSERT(original.start == restored.start);