From 16f3b542f89dbdd6029400c740a55d49d4af8e53 Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Tue, 23 May 2023 12:23:06 +0100 Subject: QUIC: Add internal APIs for white-box testing of key update Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21029) --- include/internal/quic_channel.h | 8 ++++++++ include/internal/quic_record_tx.h | 6 ++++++ include/internal/quic_ssl.h | 4 ++++ 3 files changed, 18 insertions(+) (limited to 'include') diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index 25b6758d8d..99e3dd6c76 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -330,6 +330,14 @@ void ossl_quic_channel_set_msg_callback(QUIC_CHANNEL *ch, 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 diff --git a/include/internal/quic_record_tx.h b/include/internal/quic_record_tx.h index 8b4e1705cb..b4c9bb8d26 100644 --- a/include/internal/quic_record_tx.h +++ b/include/internal/quic_record_tx.h @@ -362,6 +362,12 @@ uint64_t ossl_qtx_get_cur_epoch_pkt_count(OSSL_QTX *qtx, uint32_t enc_level); */ 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 diff --git a/include/internal/quic_ssl.h b/include/internal/quic_ssl.h index 7ea5ce8063..ed69a80057 100644 --- a/include/internal/quic_ssl.h +++ b/include/internal/quic_ssl.h @@ -14,6 +14,7 @@ # include # 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 @@ -108,6 +109,9 @@ int ossl_quic_conn_set_override_now_cb(SSL *s, */ 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 -- cgit v1.2.3