return t;
}
-static int skip_time_ms(struct helper *h, struct helper_local *hl)
-{
- if (!TEST_true(CRYPTO_THREAD_write_lock(h->time_lock)))
- return 0;
-
- h->time_slip = ossl_time_add(h->time_slip, ossl_ms2time(hl->check_op->arg2));
-
- CRYPTO_THREAD_unlock(h->time_lock);
- return 1;
-}
-
static QUIC_TSERVER *s_lock(struct helper *h, struct helper_local *hl);
static void s_unlock(struct helper *h, struct helper_local *hl);
#define ACQUIRE_S() s_lock(h, hl)
#define ACQUIRE_S_NOHL() s_lock(h, NULL)
-static int override_key_update(struct helper *h, struct helper_local *hl)
-{
- QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn);
-
- ossl_quic_channel_set_txku_threshold_override(ch, hl->check_op->arg2);
- return 1;
-}
-
-static int trigger_key_update(struct helper *h, struct helper_local *hl)
-{
- if (!TEST_true(SSL_key_update(h->c_conn, SSL_KEY_UPDATE_REQUESTED)))
- return 0;
-
- return 1;
-}
-
-static int check_key_update_ge(struct helper *h, struct helper_local *hl)
-{
- QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn);
- int64_t txke = (int64_t)ossl_quic_channel_get_tx_key_epoch(ch);
- int64_t rxke = (int64_t)ossl_quic_channel_get_rx_key_epoch(ch);
- int64_t diff = txke - 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))
- return 0;
-
- /* Caller specifies a minimum number of RXKEs which must have happened. */
- if (!TEST_uint64_t_ge((uint64_t)rxke, hl->check_op->arg2))
- return 0;
-
- return 1;
-}
-
-static int check_key_update_lt(struct helper *h, struct helper_local *hl)
-{
- QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn);
- uint64_t txke = ossl_quic_channel_get_tx_key_epoch(ch);
-
- /* Caller specifies a maximum number of TXKEs which must have happened. */
- if (!TEST_uint64_t_lt(txke, hl->check_op->arg2))
- return 0;
-
- return 1;
-}
-
static unsigned long stream_info_hash(const STREAM_INFO *info)
{
return OPENSSL_LH_strhash(info->name);
/* 18. Key update test - RTT-bounded */
static const struct script_op script_18[] = {
- 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),
- OP_CHECK(skip_time_ms, 8),
-
- OP_END_REPEAT(),
-
- /*
- * This time we simulate far less time passing between writes, so there are
- * fewer opportunities to initiate TXKUs. Note that we ask for a TXKU every
- * 1 packet above, which is absurd; thus this ensures we only actually
- * generate TXKUs when we are allowed to.
- */
- OP_CHECK(check_key_update_lt, 240),
-
- /*
- * 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
};
OP_READ_EXPECT(C, "plugh", 5);
}
-DEF_SCRIPT(script_18, "place holder for multistrem script_18")
+/* 18. Key update test - RTT-bounded */
+DEF_SCRIPT(script_18, "Key update test - RTT-bounded")
{
+ 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);
+ OP_SKIP_TIME(8);
+ }
+
+ /*
+ * This time we simulate far less time passing between writes, so there are
+ * fewer opportunities to initiate TXKUs. Note that we ask for a TXKU every
+ * 1 packet above, which is absurd; thus this ensures we only actually
+ * generate TXKUs when we are allowed to.
+ */
+ OP_CHECK_KEY_UPDATE_LT(C, 240);
+
+ /*
+ * 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_19, "place holder for multistrem script_19")