diff options
| author | Andrew Dinh <[email protected]> | 2026-06-30 15:52:51 +0200 |
|---|---|---|
| committer | Norbert Pocs <[email protected]> | 2026-07-21 11:22:31 +0200 |
| commit | 08d3dd81b2e4ca23afbd3dc0520ae3b499107dc5 (patch) | |
| tree | e93b3b7f3d73878be82918983f2fd709f68d0a74 | |
| parent | Port script_18 to radix test framework (diff) | |
| download | openssl-08d3dd81b2e4ca23afbd3dc0520ae3b499107dc5.tar.gz openssl-08d3dd81b2e4ca23afbd3dc0520ae3b499107dc5.zip | |
Port script_19 to radix test framework
Assisted-by: Claude:claude-sonnet-4-6
Reviewed-by: Saša Nedvědický <[email protected]>
Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Bob Beck <[email protected]>
MergeDate: Tue Jul 21 09:22:51 2026
(Merged from https://github.com/openssl/openssl/pull/31889)
| -rw-r--r-- | test/quic_multistream_test.c | 25 | ||||
| -rw-r--r-- | test/radix/quic_ops.c | 48 | ||||
| -rw-r--r-- | test/radix/quic_tests.c | 25 |
3 files changed, 73 insertions, 25 deletions
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index 3f3fd828856..a921f136100 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -2063,30 +2063,7 @@ static const struct script_op script_18[] = { /* 19. Key update test - artificially triggered */ static const struct script_op script_19[] = { - 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_C_WRITE(DEFAULT, "orange", 6), - OP_S_READ_EXPECT(a, "orange", 6), - - OP_S_WRITE(a, "strawberry", 10), - OP_C_READ_EXPECT(DEFAULT, "strawberry", 10), - - OP_CHECK(check_key_update_lt, 1), - OP_CHECK(trigger_key_update, 0), - - OP_C_WRITE(DEFAULT, "orange", 6), - OP_S_READ_EXPECT(a, "orange", 6), - OP_S_WRITE(a, "ok", 2), - - OP_C_READ_EXPECT(DEFAULT, "ok", 2), - OP_CHECK(check_key_update_ge, 1), - + /* 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 7095a2a34ee..f0229075963 100644 --- a/test/radix/quic_ops.c +++ b/test/radix/quic_ops.c @@ -1005,6 +1005,44 @@ err: return ok; } +DEF_FUNC(hf_check_key_update_lt) +{ + int ok = 0; + SSL *ssl; + uint64_t max_txke, txke; + QUIC_CHANNEL *ch; + + F_POP(max_txke); + REQUIRE_SSL(ssl); + ch = ossl_quic_conn_get_channel(ssl); + txke = ossl_quic_channel_get_tx_key_epoch(ch); + + /* Caller specifies a maximum number of TXKEs which must not be exceeded. */ + if (!TEST_uint64_t_lt(txke, max_txke)) + goto err; + + ok = 1; +err: + return ok; +} + +DEF_FUNC(hf_trigger_key_update) +{ + int ok = 0; + SSL *ssl; + uint64_t update_type; + + F_POP(update_type); + REQUIRE_SSL(ssl); + + if (!TEST_true(SSL_key_update(ssl, (int)update_type))) + goto err; + + ok = 1; +err: + return ok; +} + #define OP_UNBIND(name) \ (OP_PUSH_PZ(#name), \ OP_FUNC(hf_unbind)) @@ -1241,3 +1279,13 @@ err: (OP_SELECT_SSL(0, name), \ OP_PUSH_U64(min_rxke), \ OP_FUNC(hf_check_key_update_ge)) + +#define OP_CHECK_KEY_UPDATE_LT(name, max_txke) \ + (OP_SELECT_SSL(0, name), \ + OP_PUSH_U64(max_txke), \ + OP_FUNC(hf_check_key_update_lt)) + +#define OP_TRIGGER_KEY_UPDATE(name, update_type) \ + (OP_SELECT_SSL(0, name), \ + OP_PUSH_U64(update_type), \ + OP_FUNC(hf_trigger_key_update)) diff --git a/test/radix/quic_tests.c b/test/radix/quic_tests.c index 5b223cd00a0..154926a16ff 100644 --- a/test/radix/quic_tests.c +++ b/test/radix/quic_tests.c @@ -1422,8 +1422,31 @@ DEF_SCRIPT(script_18, "Key update test - RTT-bounded") OP_READ_EXPECT(C, "plugh", 5); } -DEF_SCRIPT(script_19, "place holder for multistrem script_19") +/* 19. Key update test - artificially triggered */ +DEF_SCRIPT(script_19, "Key update test - artificially triggered") { + OP_SIMPLE_PAIR_CONN(); + OP_ACCEPT_CONN_WAIT(L, S, 0); + + OP_WRITE(C, "apple", 5); + OP_READ_EXPECT(S, "apple", 5); + + OP_WRITE(C, "orange", 6); + OP_READ_EXPECT(S, "orange", 6); + + OP_WRITE(S, "strawberry", 10); + OP_READ_EXPECT(C, "strawberry", 10); + + OP_CHECK_KEY_UPDATE_LT(C, 1); + + OP_TRIGGER_KEY_UPDATE(C, SSL_KEY_UPDATE_REQUESTED); + + OP_WRITE(C, "orange", 6); + OP_READ_EXPECT(S, "orange", 6); + OP_WRITE(S, "ok", 2); + + OP_READ_EXPECT(C, "ok", 2); + OP_CHECK_KEY_UPDATE_GE(C, 1); } DEF_SCRIPT(script_20, "place holder for multistrem script_20") |
