From 5bc226ab3217525584a553ff1729567219d00e78 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Tue, 4 Oct 2022 16:16:56 +0100 Subject: [PATCH] Remove ktls specific code from tls_setup_write_buffers The KTLS code no longer calls this function so this is not necessary. Reviewed-by: Hugo Landau Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/19343) --- ssl/record/methods/tls_common.c | 35 +++++++++++++++------------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c index 9e157898b52..66dcbe2ab42 100644 --- a/ssl/record/methods/tls_common.c +++ b/ssl/record/methods/tls_common.c @@ -158,27 +158,24 @@ int tls_setup_write_buffer(OSSL_RECORD_LAYER *rl, size_t numwpipes, thiswb->buf = NULL; /* force reallocation */ } - if (thiswb->buf == NULL) { - if (rl->bio == NULL || !BIO_get_ktls_send(rl->bio)) { - p = OPENSSL_malloc(len); - if (p == NULL) { - if (rl->numwpipes < currpipe) - rl->numwpipes = currpipe; - /* - * We've got a malloc failure, and we're still initialising - * buffers. We assume we're so doomed that we won't even be able - * to send an alert. - */ - RLAYERfatal(rl, SSL_AD_NO_ALERT, ERR_R_CRYPTO_LIB); - return 0; - } - } else { - p = NULL; + p = thiswb->buf; + if (p == NULL) { + p = OPENSSL_malloc(len); + if (p == NULL) { + if (rl->numwpipes < currpipe) + rl->numwpipes = currpipe; + /* + * We've got a malloc failure, and we're still initialising + * buffers. We assume we're so doomed that we won't even be able + * to send an alert. + */ + RLAYERfatal(rl, SSL_AD_NO_ALERT, ERR_R_CRYPTO_LIB); + return 0; } - memset(thiswb, 0, sizeof(SSL3_BUFFER)); - thiswb->buf = p; - thiswb->len = len; } + memset(thiswb, 0, sizeof(SSL3_BUFFER)); + thiswb->buf = p; + thiswb->len = len; } /* Free any previously allocated buffers that we are no longer using */ -- 2.47.2