Remove ktls specific code from tls_setup_write_buffers
authorMatt Caswell <matt@openssl.org>
Tue, 4 Oct 2022 15:16:56 +0000 (16:16 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 12 Oct 2022 14:53:31 +0000 (15:53 +0100)
The KTLS code no longer calls this function so this is not necessary.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19343)

ssl/record/methods/tls_common.c

index 9e157898b52d656f3bb6d6b6718b073f4b74af2a..66dcbe2ab4265d642fccf875d6e38e3220140676 100644 (file)
@@ -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 */