@@ -5855,7 +5855,9 @@ static int test_ssl_memio_do_handshake(test_ssl_memio_ctx* ctx, int max_rounds,
58555855 }
58565856 while ((!handshake_complete) && (max_rounds > 0)) {
58575857 if (!hs_c) {
5858+ wolfSSL_SetLoggingPrefix("client");
58585859 ret = wolfSSL_connect(ctx->c_ssl);
5860+ wolfSSL_SetLoggingPrefix(NULL);
58595861 if (ret == WOLFSSL_SUCCESS) {
58605862 hs_c = 1;
58615863 }
@@ -5872,7 +5874,9 @@ static int test_ssl_memio_do_handshake(test_ssl_memio_ctx* ctx, int max_rounds,
58725874 }
58735875 }
58745876 if (!hs_s) {
5877+ wolfSSL_SetLoggingPrefix("server");
58755878 ret = wolfSSL_accept(ctx->s_ssl);
5879+ wolfSSL_SetLoggingPrefix(NULL);
58765880 if (ret == WOLFSSL_SUCCESS) {
58775881 hs_s = 1;
58785882 }
@@ -5921,15 +5925,19 @@ static int test_ssl_memio_read_write(test_ssl_memio_ctx* ctx)
59215925 msglen_s = ctx->s_msglen;
59225926 }
59235927
5928+ wolfSSL_SetLoggingPrefix("client");
59245929 ExpectIntEQ(wolfSSL_write(ctx->c_ssl, msg_c, msglen_c), msglen_c);
5930+ wolfSSL_SetLoggingPrefix("server");
59255931 ExpectIntGT(idx = wolfSSL_read(ctx->s_ssl, input, sizeof(input) - 1), 0);
59265932 if (idx >= 0) {
59275933 input[idx] = '\0';
59285934 }
59295935 ExpectIntGT(fprintf(stderr, "Client message: %s\n", input), 0);
59305936 ExpectIntEQ(wolfSSL_write(ctx->s_ssl, msg_s, msglen_s), msglen_s);
59315937 ctx->s_cb.return_code = EXPECT_RESULT();
5938+ wolfSSL_SetLoggingPrefix("client");
59325939 ExpectIntGT(idx = wolfSSL_read(ctx->c_ssl, input, sizeof(input) - 1), 0);
5940+ wolfSSL_SetLoggingPrefix(NULL);
59335941 if (idx >= 0) {
59345942 input[idx] = '\0';
59355943 }
@@ -64445,6 +64453,91 @@ static int test_session_ticket_no_id(void)
6444564453}
6444664454#endif
6444764455
64456+ static int test_session_ticket_hs_update(void)
64457+ {
64458+ EXPECT_DECLS;
64459+ #if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_TLS13) && \
64460+ defined(HAVE_SESSION_TICKET) && !defined(WOLFSSL_NO_DEF_TICKET_ENC_CB)
64461+ struct test_memio_ctx test_ctx;
64462+ struct test_memio_ctx test_ctx2;
64463+ struct test_memio_ctx test_ctx3;
64464+ WOLFSSL_CTX *ctx_c = NULL;
64465+ WOLFSSL_CTX *ctx_s = NULL;
64466+ WOLFSSL *ssl_c = NULL;
64467+ WOLFSSL *ssl_c2 = NULL;
64468+ WOLFSSL *ssl_c3 = NULL;
64469+ WOLFSSL *ssl_s = NULL;
64470+ WOLFSSL *ssl_s2 = NULL;
64471+ WOLFSSL *ssl_s3 = NULL;
64472+ WOLFSSL_SESSION *sess = NULL;
64473+ byte read_data[1];
64474+
64475+ XMEMSET(&test_ctx, 0, sizeof(test_ctx));
64476+ XMEMSET(&test_ctx2, 0, sizeof(test_ctx2));
64477+ XMEMSET(&test_ctx3, 0, sizeof(test_ctx3));
64478+ ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
64479+ wolfTLSv1_3_client_method, wolfTLSv1_3_server_method), 0);
64480+
64481+ /* Generate tickets */
64482+ ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
64483+ wolfSSL_SetLoggingPrefix("client");
64484+ /* Read the ticket msg */
64485+ ExpectIntEQ(wolfSSL_read(ssl_c, read_data, sizeof(read_data)),
64486+ WOLFSSL_FATAL_ERROR);
64487+ ExpectIntEQ(wolfSSL_get_error(ssl_c, WOLFSSL_FATAL_ERROR),
64488+ WOLFSSL_ERROR_WANT_READ);
64489+ wolfSSL_SetLoggingPrefix(NULL);
64490+
64491+ ExpectIntEQ(test_memio_setup(&test_ctx2, &ctx_c, &ctx_s, &ssl_c2, &ssl_s2,
64492+ wolfTLSv1_3_client_method, wolfTLSv1_3_server_method), 0);
64493+ ExpectIntEQ(test_memio_setup(&test_ctx3, &ctx_c, &ctx_s, &ssl_c3, &ssl_s3,
64494+ wolfTLSv1_3_client_method, wolfTLSv1_3_server_method), 0);
64495+
64496+ ExpectNotNull(sess = wolfSSL_get1_session(ssl_c));
64497+ ExpectIntEQ(wolfSSL_set_session(ssl_c2, sess), WOLFSSL_SUCCESS);
64498+ ExpectIntEQ(wolfSSL_set_session(ssl_c3, sess), WOLFSSL_SUCCESS);
64499+
64500+ wolfSSL_SetLoggingPrefix("client");
64501+ /* Exchange intial flights for the second connection */
64502+ ExpectIntEQ(wolfSSL_connect(ssl_c2), WOLFSSL_FATAL_ERROR);
64503+ ExpectIntEQ(wolfSSL_get_error(ssl_c2, WOLFSSL_FATAL_ERROR),
64504+ WOLFSSL_ERROR_WANT_READ);
64505+ wolfSSL_SetLoggingPrefix(NULL);
64506+ wolfSSL_SetLoggingPrefix("server");
64507+ ExpectIntEQ(wolfSSL_accept(ssl_s2), WOLFSSL_FATAL_ERROR);
64508+ ExpectIntEQ(wolfSSL_get_error(ssl_s2, WOLFSSL_FATAL_ERROR),
64509+ WOLFSSL_ERROR_WANT_READ);
64510+ wolfSSL_SetLoggingPrefix(NULL);
64511+
64512+ /* Complete third connection so that new tickets are exchanged */
64513+ ExpectIntEQ(test_memio_do_handshake(ssl_c3, ssl_s3, 10, NULL), 0);
64514+ /* Read the ticket msg */
64515+ wolfSSL_SetLoggingPrefix("client");
64516+ ExpectIntEQ(wolfSSL_read(ssl_c3, read_data, sizeof(read_data)),
64517+ WOLFSSL_FATAL_ERROR);
64518+ ExpectIntEQ(wolfSSL_get_error(ssl_c3, WOLFSSL_FATAL_ERROR),
64519+ WOLFSSL_ERROR_WANT_READ);
64520+ wolfSSL_SetLoggingPrefix(NULL);
64521+
64522+ /* Complete second connection */
64523+ ExpectIntEQ(test_memio_do_handshake(ssl_c2, ssl_s2, 10, NULL), 0);
64524+
64525+ ExpectIntEQ(wolfSSL_session_reused(ssl_c2), 1);
64526+ ExpectIntEQ(wolfSSL_session_reused(ssl_c3), 1);
64527+
64528+ wolfSSL_free(ssl_c);
64529+ wolfSSL_free(ssl_c2);
64530+ wolfSSL_free(ssl_c3);
64531+ wolfSSL_free(ssl_s);
64532+ wolfSSL_free(ssl_s2);
64533+ wolfSSL_free(ssl_s3);
64534+ wolfSSL_CTX_free(ctx_c);
64535+ wolfSSL_CTX_free(ctx_s);
64536+ wolfSSL_SESSION_free(sess);
64537+ #endif
64538+ return EXPECT_RESULT();
64539+ }
64540+
6444864541#if defined(WOLFSSL_DTLS) && !defined(WOLFSSL_NO_TLS12) && \
6444964542 defined(HAVE_IO_TESTS_DEPENDENCIES) && defined(HAVE_SECURE_RENEGOTIATION)
6445064543static void test_dtls_downgrade_scr_server_ctx_ready_server(WOLFSSL_CTX* ctx)
@@ -65826,6 +65919,7 @@ TEST_CASE testCases[] = {
6582665919 TEST_DECL(test_TLSX_CA_NAMES_bad_extension),
6582765920 TEST_DECL(test_dtls_1_0_hvr_downgrade),
6582865921 TEST_DECL(test_session_ticket_no_id),
65922+ TEST_DECL(test_session_ticket_hs_update),
6582965923 TEST_DECL(test_dtls_downgrade_scr_server),
6583065924 TEST_DECL(test_dtls_downgrade_scr),
6583165925 /* This test needs to stay at the end to clean up any caches allocated. */
0 commit comments