]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Don't check whether we are using KTLS before calling the cipher function
authorMatt Caswell <matt@openssl.org>
Tue, 27 Sep 2022 14:06:20 +0000 (15:06 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 12 Oct 2022 14:53:31 +0000 (15:53 +0100)
The KTLS cipher function is a no-op so it doesn't matter if we call it.
We shouldn't special case KTLS in tls_common.c

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 27a97d287cae55ea18da1796880e25db878af55f..7618caa2a6faccb8f0992c3f871f7fa664e4fe53 100644 (file)
@@ -1750,18 +1750,8 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl,
         }
     }
 
-    if (!using_ktls) {
-        if (prefix) {
-            if (rl->funcs->cipher(rl, wr, 1, 1, NULL, mac_size) < 1) {
-                if (rl->alert == SSL_AD_NO_ALERT) {
-                    RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
-                }
-                goto err;
-            }
-        }
-
-        if (rl->funcs->cipher(rl, wr + prefix, numtempl, 1, NULL,
-                                mac_size) < 1) {
+    if (prefix) {
+        if (rl->funcs->cipher(rl, wr, 1, 1, NULL, mac_size) < 1) {
             if (rl->alert == SSL_AD_NO_ALERT) {
                 RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
             }
@@ -1769,6 +1759,13 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl,
         }
     }
 
+    if (rl->funcs->cipher(rl, wr + prefix, numtempl, 1, NULL, mac_size) < 1) {
+        if (rl->alert == SSL_AD_NO_ALERT) {
+            RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
+        }
+        goto err;
+    }
+
     for (j = 0; j < numtempl + prefix; j++) {
         size_t origlen;