Commit a5f2ea2238 for openssl.org
commit a5f2ea22381b59dec43390fb4a6e57775acb5092
Author: Andrew Dinh <andrewd@openssl.org>
Date: Sat Jul 18 19:32:08 2026 +0700
Port script_28
Assisted-by: Claude:claude-sonnet-5
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
MergeDate: Sat Aug 1 12:44:55 2026
(Merged from https://github.com/openssl/openssl/pull/32023)
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index 539d155a45..c4a965ac43 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -2276,28 +2276,7 @@ err:
}
static const struct script_op script_28[] = {
- OP_S_SET_INJECT_PLAIN(script_28_inject_plain),
- OP_C_SET_ALPN("ossltest"),
- OP_C_CONNECT_WAIT(),
- OP_C_SET_DEFAULT_STREAM_MODE(SSL_DEFAULT_STREAM_MODE_NONE),
-
- OP_C_NEW_STREAM_BIDI(a, C_BIDI_ID(0)),
- OP_C_WRITE(a, "orange", 6),
-
- OP_S_BIND_STREAM_ID(a, C_BIDI_ID(0)),
- OP_S_READ_EXPECT(a, "orange", 6),
-
- OP_C_NEW_STREAM_UNI(b, C_UNI_ID(0)),
- OP_C_WRITE(b, "apple", 5),
-
- OP_S_BIND_STREAM_ID(b, C_UNI_ID(0)),
- OP_S_READ_EXPECT(b, "apple", 5),
-
- OP_SET_INJECT_WORD(C_UNI_ID(0) + 1, OSSL_QUIC_FRAME_TYPE_RESET_STREAM),
- OP_S_WRITE(a, "fruit", 5),
-
- OP_C_EXPECT_CONN_CLOSE_INFO(OSSL_QUIC_ERR_STREAM_STATE_ERROR, 0, 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 538fa38187..488cbf830f 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -2029,8 +2029,64 @@ DEF_SCRIPT(script_27, "Fault injection - excess value of STREAMS_BLOCKED_UNI")
OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_STREAM_LIMIT_ERROR, 0, 0);
}
-DEF_SCRIPT(script_28, "place holder for multistrem script_28")
+/* 28. Fault injection - received RESET_STREAM for send-only stream */
+static int inject_stream_frame_plain(RADIX_FAULT *fault, QUIC_PKT_HDR *hdr,
+ unsigned char *buf, size_t len)
+{
+ int ok = 0;
+ WPACKET wpkt;
+ unsigned char frame_buf[32];
+ 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_quic_write_vlint(&wpkt, /* stream ID */
+ fault->word0 - 1))
+ || !TEST_true(WPACKET_quic_write_vlint(&wpkt, 123))
+ || (fault->word1 == OSSL_QUIC_FRAME_TYPE_RESET_STREAM
+ && !TEST_true(WPACKET_quic_write_vlint(&wpkt, 5))) /* final size */
+ || !TEST_true(WPACKET_get_total_written(&wpkt, &written))
+ || !radix_fault_prepend_frame(fault, frame_buf, written))
+ goto err;
+
+ ok = 1;
+err:
+ if (ok)
+ WPACKET_finish(&wpkt);
+ else
+ WPACKET_cleanup(&wpkt);
+ return ok;
+}
+
+DEF_SCRIPT(script_28, "Fault injection - received RESET_STREAM for send-only stream")
{
+ OP_SIMPLE_PAIR_CONN_ND();
+ OP_ACCEPT_CONN_WAIT_ND(L, S, 0);
+
+ OP_SET_INJECT_PLAIN(S, inject_stream_frame_plain);
+
+ OP_NEW_STREAM(C, Ca, 0 /* bidirectional */);
+ OP_WRITE(Ca, "orange", 6);
+
+ OP_ACCEPT_STREAM_WAIT(S, Sa, 0);
+ OP_READ_EXPECT(Sa, "orange", 6);
+
+ OP_NEW_STREAM(C, Cb, SSL_STREAM_FLAG_UNI);
+ OP_WRITE(Cb, "apple", 5);
+
+ OP_ACCEPT_STREAM_WAIT(S, Sb, 0);
+ OP_READ_EXPECT(Sb, "apple", 5);
+
+ OP_SET_INJECT_WORD(C_UNI_ID(0) + 1, OSSL_QUIC_FRAME_TYPE_RESET_STREAM);
+ OP_WRITE(Sa, "fruit", 5);
+
+ OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_STREAM_STATE_ERROR, 0, 0);
}
DEF_SCRIPT(script_29, "place holder for multistrem script_29")