From: Matt Caswell Date: Tue, 27 Sep 2022 14:06:20 +0000 (+0100) Subject: Don't check whether we are using KTLS before calling the cipher function X-Git-Tag: openssl-3.2.0-alpha1~1928 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b6f7519bc4b645809b3dcf97478fabbb3037f3e2;p=thirdparty%2Fopenssl.git Don't check whether we are using KTLS before calling the cipher function 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 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/19343) --- diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c index 27a97d287ca..7618caa2a6f 100644 --- a/ssl/record/methods/tls_common.c +++ b/ssl/record/methods/tls_common.c @@ -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;