summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2022-10-31 15:44:08 +0000
committerHugo Landau <hlandau@openssl.org>2023-01-13 13:20:11 +0000
commitcdd3f7323613aaaf316b0b2d3a7700fbc602c8ef (patch)
tree2e2e8bcfabf52d3cba22ae072cee86a00e1d131f
parentc4abf9ebb023248046604588692f50a9eee5d6b8 (diff)
QUIC TX: Do not have QTX handle refcount of BIOs
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19703)
-rw-r--r--include/internal/quic_record_tx.h5
-rw-r--r--ssl/quic/quic_record_tx.c13
2 files changed, 4 insertions, 14 deletions
diff --git a/include/internal/quic_record_tx.h b/include/internal/quic_record_tx.h
index 6641d83ddd..b0e5e148c1 100644
--- a/include/internal/quic_record_tx.h
+++ b/include/internal/quic_record_tx.h
@@ -240,9 +240,10 @@ size_t ossl_qtx_get_unflushed_pkt_count(OSSL_QTX *qtx);
/*
* Change the BIO being used by the QTX. May be NULL if actual transmission is
- * not currently required.
+ * not currently required. Does not ref the BIO; the caller is responsible for
+ * ensuring the lifetime of the BIO exceeds the lifetime of the QTX.
*/
-int ossl_qtx_set1_bio(OSSL_QTX *qtx, BIO *bio);
+void ossl_qtx_set_bio(OSSL_QTX *qtx, BIO *bio);
/* Changes the MDPL. */
int ossl_qtx_set_mdpl(OSSL_QTX *qtx, size_t mdpl);
diff --git a/ssl/quic/quic_record_tx.c b/ssl/quic/quic_record_tx.c
index 14c8b0bd68..0cea8c13f5 100644
--- a/ssl/quic/quic_record_tx.c
+++ b/ssl/quic/quic_record_tx.c
@@ -104,11 +104,6 @@ OSSL_QTX *ossl_qtx_new(const OSSL_QTX_ARGS *args)
if (qtx == NULL)
return 0;
- if (args->bio != NULL && !BIO_up_ref(args->bio)) {
- OPENSSL_free(qtx);
- return 0;
- }
-
qtx->libctx = args->libctx;
qtx->propq = args->propq;
qtx->bio = args->bio;
@@ -143,7 +138,6 @@ void ossl_qtx_free(OSSL_QTX *qtx)
for (i = 0; i < QUIC_ENC_LEVEL_NUM; ++i)
ossl_qrl_enc_level_set_discard(&qtx->el_set, i);
- BIO_free(qtx->bio);
OPENSSL_free(qtx);
}
@@ -864,14 +858,9 @@ int ossl_qtx_pop_net(OSSL_QTX *qtx, BIO_MSG *msg)
return 1;
}
-int ossl_qtx_set1_bio(OSSL_QTX *qtx, BIO *bio)
+void ossl_qtx_set_bio(OSSL_QTX *qtx, BIO *bio)
{
- if (bio != NULL && !BIO_up_ref(bio))
- return 0;
-
- BIO_free(qtx->bio);
qtx->bio = bio;
- return 1;
}
int ossl_qtx_set_mdpl(OSSL_QTX *qtx, size_t mdpl)