@@ -69187,6 +69187,54 @@ static int test_self_signed_stapling(void)
6918769187 return EXPECT_RESULT();
6918869188}
6918969189
69190+ static int test_tls_multi_handshakes_one_record(void)
69191+ {
69192+ EXPECT_DECLS;
69193+ #if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && !defined(WOLFSSL_NO_TLS12)
69194+ struct test_memio_ctx test_ctx;
69195+ WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
69196+ WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
69197+ int newRecIdx = RECORD_HEADER_SZ;
69198+ int idx = 0;
69199+
69200+ XMEMSET(&test_ctx, 0, sizeof(test_ctx));
69201+
69202+ ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
69203+ wolfTLS_client_method, wolfTLSv1_2_server_method), 0);
69204+
69205+ ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
69206+ ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
69207+ ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
69208+ ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
69209+
69210+ /* Combine server handshake msgs into one record */
69211+ while (idx < test_ctx.c_len) {
69212+ word16 recLen;
69213+
69214+ ato16(((RecordLayerHeader*)(test_ctx.c_buff + idx))->length, &recLen);
69215+ idx += RECORD_HEADER_SZ;
69216+
69217+ XMEMMOVE(test_ctx.c_buff + newRecIdx, test_ctx.c_buff + idx,
69218+ (size_t)recLen);
69219+
69220+ newRecIdx += recLen;
69221+ idx += recLen;
69222+ }
69223+ c16toa(newRecIdx - RECORD_HEADER_SZ,
69224+ ((RecordLayerHeader*)test_ctx.c_buff)->length);
69225+ test_ctx.c_len = newRecIdx;
69226+
69227+ ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
69228+ ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
69229+
69230+ wolfSSL_free(ssl_c);
69231+ wolfSSL_free(ssl_s);
69232+ wolfSSL_CTX_free(ctx_c);
69233+ wolfSSL_CTX_free(ctx_s);
69234+ #endif
69235+ return EXPECT_RESULT();
69236+ }
69237+
6919069238/*----------------------------------------------------------------------------*
6919169239 | Main
6919269240 *----------------------------------------------------------------------------*/
@@ -70489,6 +70537,7 @@ TEST_CASE testCases[] = {
7048970537 TEST_DECL(test_dtls_empty_keyshare_with_cookie),
7049070538 TEST_DECL(test_tls13_pq_groups),
7049170539 TEST_DECL(test_tls13_early_data),
70540+ TEST_DECL(test_tls_multi_handshakes_one_record),
7049270541 /* This test needs to stay at the end to clean up any caches allocated. */
7049370542 TEST_DECL(test_wolfSSL_Cleanup)
7049470543};
0 commit comments