From: Andrew Dinh Date: Wed, 8 Jul 2026 15:11:40 +0000 (+0700) Subject: Port script_23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bab8a994867de8b01ed2ee4869ac4f2e28dbf9fa;p=thirdparty%2Fopenssl.git Port script_23 Assisted-by: Codex:gpt-5.5 Reviewed-by: Saša Nedvědický Reviewed-by: Bob Beck MergeDate: Thu Jul 30 06:12:43 2026 (Merged from https://github.com/openssl/openssl/pull/32003) --- diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index 87107803b99..92b90983750 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -2207,55 +2207,8 @@ static const struct script_op script_22[] = { }; /* 23. Fault injection - empty NEW_TOKEN */ -static int script_23_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, - unsigned char *buf, size_t len) -{ - int ok = 0; - WPACKET wpkt; - unsigned char frame_buf[16]; - size_t written; - - if (h->inject_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, OSSL_QUIC_FRAME_TYPE_NEW_TOKEN)) - || !TEST_true(WPACKET_quic_write_vlint(&wpkt, 0))) - goto err; - - if (!TEST_true(WPACKET_get_total_written(&wpkt, &written))) - goto err; - - if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) - goto err; - - ok = 1; -err: - if (ok) - WPACKET_finish(&wpkt); - else - WPACKET_cleanup(&wpkt); - return ok; -} - static const struct script_op script_23[] = { - OP_S_SET_INJECT_PLAIN(script_23_inject_plain), - OP_C_SET_ALPN("ossltest"), - OP_C_CONNECT_WAIT(), - - 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, 0), - - OP_S_WRITE(a, "orange", 6), - - OP_C_EXPECT_CONN_CLOSE_INFO(OSSL_QUIC_ERR_FRAME_ENCODING_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 95d6f1b5e39..efb83f2b777 100644 --- a/test/radix/quic_tests.c +++ b/test/radix/quic_tests.c @@ -1876,8 +1876,52 @@ DEF_SCRIPT(script_22, "Fault injection - non-zero packet header reserved bits") OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_PROTOCOL_VIOLATION, 0, 0); } -DEF_SCRIPT(script_23, "place holder for multistrem script_23") +/* 23. Fault injection - empty NEW_TOKEN */ +static int script_23_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, OSSL_QUIC_FRAME_TYPE_NEW_TOKEN)) + || !TEST_true(WPACKET_quic_write_vlint(&wpkt, 0)) + || !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_23, "Fault injection - empty NEW_TOKEN") +{ + OP_SIMPLE_PAIR_CONN(); + OP_ACCEPT_CONN_WAIT(L, S, 0); + + OP_SET_INJECT_PLAIN(S, script_23_inject_plain); + + OP_WRITE(C, "apple", 5); + OP_ACCEPT_STREAM_WAIT(S, Sa, 0); + OP_READ_EXPECT(Sa, "apple", 5); + + OP_SET_INJECT_WORD(1, 0); + + OP_WRITE(Sa, "orange", 6); + + OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_FRAME_ENCODING_ERROR, 0, 0); } DEF_SCRIPT(script_24, "place holder for multistrem script_24")