Commit 9b94348003 for openssl.org
commit 9b94348003b2412187b22e3ee2201d16816e44fb
Author: Andrew Dinh <andrewd@openssl.org>
Date: Tue Jun 30 17:07:37 2026 +0700
Port script_17 to radix test framework
Assisted-by: Claude:claude-sonnet-4-6
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul 21 09:22:48 2026
(Merged from https://github.com/openssl/openssl/pull/31889)
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index b7472c4c37..eda2647034 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -2111,44 +2111,7 @@ static const struct script_op script_16[] = {
/* 17. Key update test - unlimited */
static const struct script_op script_17[] = {
- 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_CHECK(override_key_update, 1),
-
- OP_BEGIN_REPEAT(200),
-
- OP_C_WRITE(DEFAULT, "apple", 5),
- OP_S_READ_EXPECT(a, "apple", 5),
-
- /*
- * TXKU frequency is bounded by RTT because a previous TXKU needs to be
- * acknowledged by the peer first before another one can be begin. By
- * waiting this long, we eliminate any such concern and ensure as many key
- * updates as possible can occur for the purposes of this test.
- */
- OP_CHECK(skip_time_ms, 100),
-
- OP_END_REPEAT(),
-
- /* At least 5 RXKUs detected */
- OP_CHECK(check_key_update_ge, 5),
-
- /*
- * Prove the connection is still healthy by sending something in both
- * directions.
- */
- OP_C_WRITE(DEFAULT, "xyzzy", 5),
- OP_S_READ_EXPECT(a, "xyzzy", 5),
-
- OP_S_WRITE(a, "plugh", 5),
- OP_C_READ_EXPECT(DEFAULT, "plugh", 5),
-
+ /* test moved to test/radix/quic_tests.c */
OP_END
};
diff --git a/test/radix/quic_ops.c b/test/radix/quic_ops.c
index 902dab4aed..7095a2a34e 100644
--- a/test/radix/quic_ops.c
+++ b/test/radix/quic_ops.c
@@ -958,6 +958,53 @@ err:
return ok;
}
+DEF_FUNC(hf_override_key_update)
+{
+ int ok = 0;
+ SSL *ssl;
+ uint64_t threshold;
+ QUIC_CHANNEL *ch;
+
+ F_POP(threshold);
+ REQUIRE_SSL(ssl);
+ ch = ossl_quic_conn_get_channel(ssl);
+ ossl_quic_channel_set_txku_threshold_override(ch, threshold);
+ ok = 1;
+err:
+ return ok;
+}
+
+DEF_FUNC(hf_check_key_update_ge)
+{
+ int ok = 0;
+ SSL *ssl;
+ uint64_t min_rxke, txke, rxke;
+ int64_t diff;
+ QUIC_CHANNEL *ch;
+
+ F_POP(min_rxke);
+ REQUIRE_SSL(ssl);
+ ch = ossl_quic_conn_get_channel(ssl);
+ txke = ossl_quic_channel_get_tx_key_epoch(ch);
+ rxke = ossl_quic_channel_get_rx_key_epoch(ch);
+ diff = (int64_t)txke - (int64_t)rxke;
+
+ /*
+ * TXKE must always be equal to or ahead of RXKE.
+ * It can be ahead of RXKE by at most 1.
+ */
+ if (!TEST_int64_t_ge(diff, 0) || !TEST_int64_t_le(diff, 1))
+ goto err;
+
+ /* Caller specifies a minimum number of RXKEs which must have happened. */
+ if (!TEST_uint64_t_ge(rxke, min_rxke))
+ goto err;
+
+ ok = 1;
+err:
+ return ok;
+}
+
#define OP_UNBIND(name) \
(OP_PUSH_PZ(#name), \
OP_FUNC(hf_unbind))
@@ -1184,3 +1231,13 @@ err:
#define OP_SLEEP(ms) \
(OP_PUSH_U64(ms), \
OP_FUNC(hf_sleep))
+
+#define OP_OVERRIDE_KEY_UPDATE(name, threshold) \
+ (OP_SELECT_SSL(0, name), \
+ OP_PUSH_U64(threshold), \
+ OP_FUNC(hf_override_key_update))
+
+#define OP_CHECK_KEY_UPDATE_GE(name, min_rxke) \
+ (OP_SELECT_SSL(0, name), \
+ OP_PUSH_U64(min_rxke), \
+ OP_FUNC(hf_check_key_update_ge))
diff --git a/test/radix/quic_tests.c b/test/radix/quic_tests.c
index 350d763524..f1bb1527e1 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -1345,8 +1345,43 @@ DEF_SCRIPT(script_16, "Server sending large number of streams, MAX_STREAMS test"
}
}
-DEF_SCRIPT(script_17, "place holder for multistrem script_17")
+/* 17. Key update test - unlimited */
+DEF_SCRIPT(script_17, "Key update test - unlimited")
{
+ size_t i;
+
+ OP_SIMPLE_PAIR_CONN();
+ OP_ACCEPT_CONN_WAIT(L, S, 0);
+
+ OP_WRITE(C, "apple", 5);
+ OP_READ_EXPECT(S, "apple", 5);
+
+ OP_OVERRIDE_KEY_UPDATE(C, 1);
+
+ for (i = 0; i < 200; ++i) {
+ OP_WRITE(C, "apple", 5);
+ OP_READ_EXPECT(S, "apple", 5);
+ /*
+ * TXKU frequency is bounded by RTT because a previous TXKU needs to be
+ * acknowledged by the peer first before another one can begin. By
+ * waiting this long, we eliminate any such concern and ensure as many key
+ * updates as possible can occur for the purposes of this test.
+ */
+ OP_SKIP_TIME(100);
+ }
+
+ /* At least 5 RXKUs detected */
+ OP_CHECK_KEY_UPDATE_GE(C, 5);
+
+ /*
+ * Prove the connection is still healthy by sending something in both
+ * directions.
+ */
+ OP_WRITE(C, "xyzzy", 5);
+ OP_READ_EXPECT(S, "xyzzy", 5);
+
+ OP_WRITE(S, "plugh", 5);
+ OP_READ_EXPECT(C, "plugh", 5);
}
DEF_SCRIPT(script_18, "place holder for multistrem script_18")