Commit 0307daf73e for openssl.org
commit 0307daf73e94f3374e307148bb44ed1cc3779d6b
Author: Andrew Dinh <andrewd@openssl.org>
Date: Sat Aug 1 20:54:02 2026 +0700
Port script_41
Assisted-by: Claude:claude-sonnet-5
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sat Aug 15 16:49:45 2026
(Merged from https://github.com/openssl/openssl/pull/32236)
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index 728c45e2be..cd9136c16f 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -2543,80 +2543,8 @@ err:
return ok;
}
-static void script_41_trace(int write_p, int version, int content_type,
- const void *buf, size_t len, SSL *ssl, void *arg)
-{
- uint64_t frame_type, frame_data;
- int was_minimal;
- struct helper *h = arg;
- PACKET pkt;
-
- if (version != OSSL_QUIC1_VERSION
- || content_type != SSL3_RT_QUIC_FRAME_FULL
- || len < 1)
- return;
-
- if (!TEST_true(PACKET_buf_init(&pkt, buf, len))) {
- ++h->scratch1;
- return;
- }
-
- if (!TEST_true(ossl_quic_wire_peek_frame_header(&pkt, &frame_type,
- &was_minimal))) {
- ++h->scratch1;
- return;
- }
-
- if (frame_type != OSSL_QUIC_FRAME_TYPE_PATH_RESPONSE)
- return;
-
- if (!TEST_true(ossl_quic_wire_decode_frame_path_response(&pkt, &frame_data))
- || !TEST_uint64_t_eq(frame_data, path_challenge)) {
- ++h->scratch1;
- return;
- }
-
- ++h->scratch0;
-}
-
-static int script_41_setup(struct helper *h, struct helper_local *hl)
-{
- ossl_quic_tserver_set_msg_callback(ACQUIRE_S(), script_41_trace, h);
- return 1;
-}
-
-static int script_41_check(struct helper *h, struct helper_local *hl)
-{
- /* At least one valid challenge/response echo? */
- if (!TEST_uint64_t_gt(h->scratch0, 0))
- return 0;
-
- /* No failed tests? */
- if (!TEST_uint64_t_eq(h->scratch1, 0))
- return 0;
-
- return 1;
-}
-
static const struct script_op script_41[] = {
- OP_S_SET_INJECT_PLAIN(script_41_inject_plain),
- OP_C_SET_ALPN("ossltest"),
- OP_C_CONNECT_WAIT(),
- OP_CHECK(script_41_setup, 0),
-
- OP_C_WRITE(DEFAULT, "apple", 5),
- OP_S_BIND_STREAM_ID(a, C_BIDI_ID(0)),
- OP_S_READ_EXPECT(a, "apple", 5),
-
- OP_SET_INJECT_WORD(1, OSSL_QUIC_FRAME_TYPE_PATH_CHALLENGE),
-
- OP_S_WRITE(a, "orange", 6),
- OP_C_READ_EXPECT(DEFAULT, "orange", 6),
-
- OP_C_WRITE(DEFAULT, "strawberry", 10),
- OP_S_READ_EXPECT(a, "strawberry", 10),
-
- OP_CHECK(script_41_check, 0),
+ /* test moved to test/radix/quic_tests.c */
OP_END
};
diff --git a/test/radix/quic_tests.c b/test/radix/quic_tests.c
index 627ca3b4d5..05e5ac2d0c 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -2562,8 +2562,126 @@ DEF_SCRIPT(script_40, "Shutdown flush test")
OP_EXPECT_CONN_CLOSE_INFO(S, 0, 1, 1);
}
-DEF_SCRIPT(script_41, "place holder for multistrem script_41")
+/* 41. Fault injection - PATH_CHALLENGE yields PATH_RESPONSE */
+static const uint64_t script_41_path_challenge = UINT64_C(0xbdeb9451169c83aa);
+static uint64_t script_41_valid_responses;
+static uint64_t script_41_bad_responses;
+
+static int script_41_inject_plain(RADIX_FAULT *fault, QUIC_PKT_HDR *hdr,
+ unsigned char *buf, size_t len)
+{
+ int ok = 0;
+ WPACKET wpkt;
+ unsigned char frame_buf[16];
+ size_t written;
+
+ if (fault->word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT)
+ return 1;
+
+ if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf,
+ sizeof(frame_buf), 0)))
+ return 0;
+
+ if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, fault->word1))
+ || !TEST_true(WPACKET_put_bytes_u64(&wpkt, script_41_path_challenge))
+ || !TEST_true(WPACKET_get_total_written(&wpkt, &written))
+ || !TEST_size_t_eq(written, 9)
+ || !radix_fault_prepend_frame(fault, frame_buf, written))
+ goto err;
+
+ --fault->word0;
+ ok = 1;
+err:
+ if (ok)
+ WPACKET_finish(&wpkt);
+ else
+ WPACKET_cleanup(&wpkt);
+ return ok;
+}
+
+static void script_41_trace(int write_p, int version, int content_type,
+ const void *buf, size_t len, SSL *ssl, void *arg)
+{
+ uint64_t frame_type, frame_data;
+ int was_minimal;
+ PACKET pkt;
+
+ if (version != OSSL_QUIC1_VERSION
+ || content_type != SSL3_RT_QUIC_FRAME_FULL
+ || len < 1)
+ return;
+
+ if (!TEST_true(PACKET_buf_init(&pkt, buf, len))
+ || !TEST_true(ossl_quic_wire_peek_frame_header(&pkt, &frame_type,
+ &was_minimal))) {
+ ++script_41_bad_responses;
+ return;
+ }
+
+ if (frame_type != OSSL_QUIC_FRAME_TYPE_PATH_RESPONSE)
+ return;
+
+ if (!TEST_true(ossl_quic_wire_decode_frame_path_response(&pkt, &frame_data))
+ || !TEST_uint64_t_eq(frame_data, script_41_path_challenge)) {
+ ++script_41_bad_responses;
+ return;
+ }
+
+ ++script_41_valid_responses;
+}
+
+DEF_FUNC(install_trace_41)
+{
+ int ok = 0;
+ SSL *ssl;
+
+ REQUIRE_SSL(ssl);
+ SSL_set_msg_callback(ssl, script_41_trace);
+
+ ok = 1;
+err:
+ return ok;
+}
+
+DEF_FUNC(check_path_response_41)
{
+ int ok = 0;
+
+ /* At least one valid challenge/response echo? */
+ if (script_41_valid_responses == 0)
+ F_SPIN_AGAIN();
+
+ /* No failed tests? */
+ if (!TEST_uint64_t_eq(script_41_bad_responses, 0))
+ goto err;
+
+ ok = 1;
+err:
+ return ok;
+}
+
+DEF_SCRIPT(script_41, "Fault injection - PATH_CHALLENGE yields PATH_RESPONSE")
+{
+ OP_SIMPLE_PAIR_CONN();
+
+ OP_WRITE(C, "apple", 5);
+
+ OP_ACCEPT_CONN_WAIT(L, S, 0);
+ OP_SET_INJECT_PLAIN(S, script_41_inject_plain);
+ OP_SELECT_SSL(0, S);
+ OP_FUNC(install_trace_41);
+
+ OP_READ_EXPECT(S, "apple", 5);
+
+ OP_SET_INJECT_WORD(1, OSSL_QUIC_FRAME_TYPE_PATH_CHALLENGE);
+
+ OP_WRITE(S, "orange", 6);
+ OP_READ_EXPECT(C, "orange", 6);
+
+ OP_WRITE(C, "strawberry", 10);
+ OP_READ_EXPECT(S, "strawberry", 10);
+
+ OP_FUNC(check_path_response_41);
}
DEF_SCRIPT(script_42, "place holder for multistrem script_42")