From b5cf81f7c9775d2502730ba126893ce8af4db90e Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 22 Aug 2022 16:09:23 +0100 Subject: Replace references to s->wbio with rl->bio We use the record layer reference to the BIO rather than the SSL object reference. This removes an unneeded SSL object usage. Reviewed-by: Hugo Landau Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/19198) --- ssl/ssl_lib.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ssl/ssl_lib.c') diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index b976324f92..f77bd7b279 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1358,8 +1358,6 @@ void ossl_ssl_connection_free(SSL *ssl) X509_VERIFY_PARAM_free(s->param); dane_final(&s->dane); - RECORD_LAYER_clear(&s->rlayer); - /* Ignore return value */ ssl_free_wbio_buffer(s); @@ -1368,6 +1366,8 @@ void ossl_ssl_connection_free(SSL *ssl) BIO_free_all(s->rbio); s->rbio = NULL; + RECORD_LAYER_clear(&s->rlayer); + BUF_MEM_free(s->init_buf); /* add extra stuff */ @@ -1463,6 +1463,8 @@ void SSL_set0_wbio(SSL *s, BIO *wbio) /* Re-attach |bbio| to the new |wbio|. */ if (sc->bbio != NULL) sc->wbio = BIO_push(sc->bbio, sc->wbio); + + sc->rlayer.wrlmethod->set1_bio(sc->rlayer.wrl, sc->wbio); } void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio) @@ -4809,6 +4811,8 @@ int ssl_init_wbio_buffer(SSL_CONNECTION *s) s->bbio = bbio; s->wbio = BIO_push(bbio, s->wbio); + s->rlayer.wrlmethod->set1_bio(s->rlayer.wrl, s->wbio); + return 1; } @@ -4819,6 +4823,8 @@ int ssl_free_wbio_buffer(SSL_CONNECTION *s) return 1; s->wbio = BIO_pop(s->wbio); + s->rlayer.wrlmethod->set1_bio(s->rlayer.wrl, s->wbio); + BIO_free(s->bbio); s->bbio = NULL; -- cgit v1.2.3