void ossl_quic_channel_set_msg_callback_arg(QUIC_CHANNEL *ch,
void *msg_callback_arg);
+/* Testing use only - sets a TXKU threshold packet count override value. */
+void ossl_quic_channel_set_txku_threshold_override(QUIC_CHANNEL *ch,
+ uint64_t tx_pkt_threshold);
+
+/* Testing use only - gets current 1-RTT key epochs for QTX and QRX. */
+uint64_t ossl_quic_channel_get_tx_key_epoch(QUIC_CHANNEL *ch);
+uint64_t ossl_quic_channel_get_rx_key_epoch(QUIC_CHANNEL *ch);
+
# endif
#endif
*/
uint64_t ossl_qtx_get_max_epoch_pkt_count(OSSL_QTX *qtx, uint32_t enc_level);
+/*
+ * Get the 1-RTT EL key epoch number for the QTX. This is intended for
+ * diagnostic purposes. Returns 0 if 1-RTT EL is not provisioned yet.
+ */
+uint64_t ossl_qtx_get_key_epoch(OSSL_QTX *qtx);
+
# endif
#endif
# include <openssl/bio.h>
# include "internal/quic_record_rx.h" /* OSSL_QRX */
# include "internal/quic_ackm.h" /* OSSL_ACKM */
+# include "internal/quic_channel.h" /* QUIC_CHANNEL */
# ifndef OPENSSL_NO_QUIC
*/
void ossl_quic_conn_force_assist_thread_wake(SSL *s);
+/* For use by tests only. */
+QUIC_CHANNEL *ossl_quic_conn_get_channel(SSL *s);
+
# endif
#endif
ch->max_idle_timeout = QUIC_DEFAULT_IDLE_TIMEOUT;
ch->tx_enc_level = QUIC_ENC_LEVEL_INITIAL;
ch->rx_enc_level = QUIC_ENC_LEVEL_INITIAL;
+ ch->txku_threshold_override = UINT64_MAX;
/*
* Determine the QUIC Transport Parameters and serialize the transport
QUIC_NEEDS_LOCK
static int txku_desirable(QUIC_CHANNEL *ch)
{
- uint64_t cur_pkt_count, max_pkt_count;
+ uint64_t cur_pkt_count, max_pkt_count, thresh_pkt_count;
const uint32_t enc_level = QUIC_ENC_LEVEL_1RTT;
/* Check AEAD limit to determine if we should perform a spontaneous TXKU. */
cur_pkt_count = ossl_qtx_get_cur_epoch_pkt_count(ch->qtx, enc_level);
max_pkt_count = ossl_qtx_get_max_epoch_pkt_count(ch->qtx, enc_level);
- return cur_pkt_count >= max_pkt_count / 2;
+ thresh_pkt_count = max_pkt_count / 2;
+ if (ch->txku_threshold_override != UINT64_MAX)
+ thresh_pkt_count = ch->txku_threshold_override;
+
+ return cur_pkt_count >= thresh_pkt_count;
}
QUIC_NEEDS_LOCK
ossl_quic_tx_packetiser_set_msg_callback_arg(ch->txp, msg_callback_arg);
ossl_qrx_set_msg_callback_arg(ch->qrx, msg_callback_arg);
}
+
+void ossl_quic_channel_set_txku_threshold_override(QUIC_CHANNEL *ch,
+ uint64_t tx_pkt_threshold)
+{
+ ch->txku_threshold_override = tx_pkt_threshold;
+}
+
+uint64_t ossl_quic_channel_get_tx_key_epoch(QUIC_CHANNEL *ch)
+{
+ return ossl_qtx_get_key_epoch(ch->qtx);
+}
+
+uint64_t ossl_quic_channel_get_rx_key_epoch(QUIC_CHANNEL *ch)
+{
+ return ossl_qrx_get_key_epoch(ch->qrx);
+}
*/
uint64_t incoming_stream_auto_reject_aec;
+ /*
+ * Override packet count threshold at which we do a spontaneous TXKU.
+ * Usually UINT64_MAX in which case a suitable value is chosen based on AEAD
+ * limit advice from the QRL utility functions. This is intended for testing
+ * use only. Usually set to UINT64_MAX.
+ */
+ uint64_t txku_threshold_override;
+
/* Valid if we are in the TERMINATING or TERMINATED states. */
QUIC_TERMINATE_CAUSE terminate_cause;
{
return NULL;
}
+
+/*
+ * Internal Testing APIs
+ * =====================
+ */
+
+QUIC_CHANNEL *ossl_quic_conn_get_channel(SSL *s)
+{
+ QCTX ctx;
+
+ if (!expect_quic_conn_only(s, &ctx))
+ return NULL;
+
+ return ctx.qc->ch;
+}
{
qtx->msg_callback_arg = msg_callback_arg;
}
+
+uint64_t ossl_qtx_get_key_epoch(OSSL_QTX *qtx)
+{
+ OSSL_QRL_ENC_LEVEL *el;
+
+ el = ossl_qrl_enc_level_set_get(&qtx->el_set, QUIC_ENC_LEVEL_1RTT, 1);
+ if (el == NULL)
+ return 0;
+
+ return el->key_epoch;
+}