From: Neil Horman Date: Wed, 29 Jan 2025 18:17:32 +0000 (-0500) Subject: Add api to fetch short conn id len from a given channel/tserver X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=34b12357e0e59e0a32dc75a4c73772ece71c3edb;p=thirdparty%2Fopenssl.git Add api to fetch short conn id len from a given channel/tserver Need an api to fetch the configured conn id len for short headers, add that in here Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26592) --- diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index 852551e5624..543a5900b90 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -313,6 +313,9 @@ OSSL_STATM *ossl_quic_channel_get_statm(QUIC_CHANNEL *ch); /* Gets the TLS handshake layer used with the channel. */ SSL *ossl_quic_channel_get0_tls(QUIC_CHANNEL *ch); +/* Gets the channels short header connection id length */ +size_t ossl_quic_channel_get_short_header_conn_id_len(QUIC_CHANNEL *ch); + /* * Gets/sets the current peer address. Generally this should be used before * starting a channel in client mode. diff --git a/include/internal/quic_record_rx.h b/include/internal/quic_record_rx.h index 001509bd583..10b2e0def4e 100644 --- a/include/internal/quic_record_rx.h +++ b/include/internal/quic_record_rx.h @@ -67,6 +67,11 @@ void ossl_qrx_set_msg_callback(OSSL_QRX *qrx, ossl_msg_cb msg_callback, void ossl_qrx_set_msg_callback_arg(OSSL_QRX *qrx, void *msg_callback_arg); +/* + * Get the short header connection id len from this qrx + */ +size_t ossl_qrx_get_short_hdr_conn_id_len(OSSL_QRX *qrx); + /* * Secret Management * ================= diff --git a/include/internal/quic_tserver.h b/include/internal/quic_tserver.h index 4f358dd4e87..227ad1d2194 100644 --- a/include/internal/quic_tserver.h +++ b/include/internal/quic_tserver.h @@ -81,6 +81,9 @@ ossl_quic_tserver_get_terminate_cause(const QUIC_TSERVER *srv); /* Returns 1 if the server is in a terminated state */ int ossl_quic_tserver_is_terminated(const QUIC_TSERVER *srv); +/* Get out short header conn id length */ +size_t ossl_quic_tserver_get_short_header_conn_id_len(const QUIC_TSERVER *srv); + /* * Attempts to read from stream 0. Writes the number of bytes read to * *bytes_read and returns 1 on success. If no bytes are available, 0 is written diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index ce166fe9625..7776b895d74 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -567,6 +567,11 @@ err: return rc; } +size_t ossl_quic_channel_get_short_header_conn_id_len(QUIC_CHANNEL *ch) +{ + return ossl_qrx_get_short_hdr_conn_id_len(ch->qrx); +} + QUIC_STREAM *ossl_quic_channel_get_stream_by_id(QUIC_CHANNEL *ch, uint64_t stream_id) { diff --git a/ssl/quic/quic_record_rx.c b/ssl/quic/quic_record_rx.c index cc201a6c2fe..666b37f38bd 100644 --- a/ssl/quic/quic_record_rx.c +++ b/ssl/quic/quic_record_rx.c @@ -1356,3 +1356,8 @@ void ossl_qrx_set_msg_callback_arg(OSSL_QRX *qrx, void *msg_callback_arg) { qrx->msg_callback_arg = msg_callback_arg; } + +size_t ossl_qrx_get_short_hdr_conn_id_len(OSSL_QRX *qrx) +{ + return qrx->short_conn_id_len; +} diff --git a/ssl/quic/quic_tserver.c b/ssl/quic/quic_tserver.c index 5075661acfa..58d53b3bd49 100644 --- a/ssl/quic/quic_tserver.c +++ b/ssl/quic/quic_tserver.c @@ -239,6 +239,11 @@ int ossl_quic_tserver_is_terminated(const QUIC_TSERVER *srv) return ossl_quic_channel_is_terminated(srv->ch); } +size_t ossl_quic_tserver_get_short_header_conn_id_len(const QUIC_TSERVER *srv) +{ + return ossl_quic_channel_get_short_header_conn_id_len(srv->ch); +} + int ossl_quic_tserver_is_handshake_confirmed(const QUIC_TSERVER *srv) { return ossl_quic_channel_is_handshake_confirmed(srv->ch);