summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-11-09 11:27:13 +0100
committerHugo Landau <hlandau@openssl.org>2023-12-21 09:11:59 +0100
commit167e5f34c8f4e7c414c6e48376987160bc23c7df (patch)
tree63d73677ffd7e9b1ef6e51920b65c76a728655c7
parentQUIC APL: Provide the QUIC_CHANNEL with a currently unused QUIC_PORT (diff)
downloadopenssl-167e5f34c8f4e7c414c6e48376987160bc23c7df.tar.xz
openssl-167e5f34c8f4e7c414c6e48376987160bc23c7df.zip
QUIC TSERVER: Provide a TSERVER's QUIC_CHANNEL with a currently unused QUIC_PORT
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22674)
-rw-r--r--include/internal/quic_channel.h4
-rw-r--r--ssl/quic/quic_tserver.c18
2 files changed, 21 insertions, 1 deletions
diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h
index d4f3018cc4..f4bee6bf46 100644
--- a/include/internal/quic_channel.h
+++ b/include/internal/quic_channel.h
@@ -106,6 +106,10 @@
# define QUIC_CHANNEL_STATE_TERMINATED 4
typedef struct quic_channel_args_st {
+ /*
+ * The QUIC_PORT which the channel is to belong to. The lifetime of the
+ * QUIC_PORT must exceed that of the created channel.
+ */
QUIC_PORT *port;
OSSL_LIB_CTX *libctx;
diff --git a/ssl/quic/quic_tserver.c b/ssl/quic/quic_tserver.c
index 130733821c..e5cc31ba82 100644
--- a/ssl/quic/quic_tserver.c
+++ b/ssl/quic/quic_tserver.c
@@ -10,6 +10,7 @@
#include "internal/quic_tserver.h"
#include "internal/quic_channel.h"
#include "internal/quic_statm.h"
+#include "internal/quic_port.h"
#include "internal/common.h"
#include "internal/time.h"
#include "quic_local.h"
@@ -25,8 +26,10 @@ struct quic_tserver_st {
SSL *ssl;
/*
- * The QUIC channel providing the core QUIC connection implementation.
+ * The QUIC port and channel providing the core QUIC connection
+ * implementation.
*/
+ QUIC_PORT *port;
QUIC_CHANNEL *ch;
/* The mutex we give to the QUIC channel. */
@@ -75,6 +78,7 @@ QUIC_TSERVER *ossl_quic_tserver_new(const QUIC_TSERVER_ARGS *args,
const char *certfile, const char *keyfile)
{
QUIC_TSERVER *srv = NULL;
+ QUIC_PORT_ARGS port_args = {0};
QUIC_CHANNEL_ARGS ch_args = {0};
QUIC_CONNECTION *qc = NULL;
@@ -113,6 +117,16 @@ QUIC_TSERVER *ossl_quic_tserver_new(const QUIC_TSERVER_ARGS *args,
if (srv->tls == NULL)
goto err;
+ port_args.libctx = srv->args.libctx;
+ port_args.propq = srv->args.propq;
+ port_args.mutex = srv->mutex;
+ port_args.now_cb = srv->args.now_cb;
+ port_args.now_cb_arg = srv->args.now_cb_arg;
+
+ if ((srv->port = ossl_quic_port_new(&port_args)) == NULL)
+ goto err;
+
+ ch_args.port = srv->port;
ch_args.libctx = srv->args.libctx;
ch_args.propq = srv->args.propq;
ch_args.tls = srv->tls;
@@ -143,6 +157,7 @@ err:
SSL_CTX_free(srv->ctx);
SSL_free(srv->tls);
ossl_quic_channel_free(srv->ch);
+ ossl_quic_port_free(srv->port);
#if defined(OPENSSL_THREADS)
ossl_crypto_mutex_free(&srv->mutex);
#endif
@@ -159,6 +174,7 @@ void ossl_quic_tserver_free(QUIC_TSERVER *srv)
return;
ossl_quic_channel_free(srv->ch);
+ ossl_quic_port_free(srv->port);
BIO_free_all(srv->args.net_rbio);
BIO_free_all(srv->args.net_wbio);
OPENSSL_free(srv->ssl);