summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-02-21 10:18:58 +0000
committerHugo Landau <hlandau@openssl.org>2023-03-30 11:14:08 +0100
commite053505f0ce1a6d15cbcd42e49dabc844610b65a (patch)
tree23f2c7fb5ce2386945cde42c94c88c14c3b66b86
parenta8489257e69fab643d22932dfa27afb945e78c5a (diff)
Add mutex to tserver
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20348)
-rw-r--r--ssl/quic/quic_tserver.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ssl/quic/quic_tserver.c b/ssl/quic/quic_tserver.c
index 8d11379d95..158abf705b 100644
--- a/ssl/quic/quic_tserver.c
+++ b/ssl/quic/quic_tserver.c
@@ -24,6 +24,9 @@ struct quic_tserver_st {
*/
QUIC_CHANNEL *ch;
+ /* The mutex we give to the QUIC channel. */
+ CRYPTO_RWLOCK *mutex;
+
/* SSL_CTX for creating the underlying TLS connection */
SSL_CTX *ctx;
@@ -67,6 +70,9 @@ QUIC_TSERVER *ossl_quic_tserver_new(const QUIC_TSERVER_ARGS *args,
srv->args = *args;
+ if ((srv->mutex = CRYPTO_THREAD_lock_new()) == NULL)
+ goto err;
+
srv->ctx = SSL_CTX_new_ex(srv->args.libctx, srv->args.propq, TLS_method());
if (srv->ctx == NULL)
goto err;
@@ -86,6 +92,7 @@ QUIC_TSERVER *ossl_quic_tserver_new(const QUIC_TSERVER_ARGS *args,
ch_args.libctx = srv->args.libctx;
ch_args.propq = srv->args.propq;
ch_args.tls = srv->tls;
+ ch_args.mutex = srv->mutex;
ch_args.is_server = 1;
if ((srv->ch = ossl_quic_channel_new(&ch_args)) == NULL)
@@ -119,6 +126,7 @@ void ossl_quic_tserver_free(QUIC_TSERVER *srv)
BIO_free(srv->args.net_wbio);
SSL_free(srv->tls);
SSL_CTX_free(srv->ctx);
+ CRYPTO_THREAD_lock_free(srv->mutex);
OPENSSL_free(srv);
}