lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 17 May 2020 16:26:36 +0000
From:   Pooja Trivedi <poojatrivedi@...il.com>
To:     borisp@...lanox.com, aviadye@...lanox.com,
        john.fastabend@...il.com, daniel@...earbox.net, kuba@...nel.org,
        davem@...emloft.net, vakul.garg@....com, netdev@...r.kernel.org,
        linux-crypto@...r.kernel.org,
        mallesham.jatharkonda@...convergence.com, josh.tway@...ckpath.com,
        pooja.trivedi@...ckpath.com
Subject: [PATCH net] net/tls(TLS_SW): Fix integrity issue with non-blocking sw KTLS request

In pure sw ktls(AES-NI), -EAGAIN from tcp layer (do_tcp_sendpages for
encrypted record) gets treated as error, subtracts the offset, and
returns to application. Because of this, application sends data from
subtracted offset, which leads to data integrity issue. Since record is
already encrypted, ktls module marks it as partially sent and pushes the
packet to tcp layer in the following iterations (either from bottom half
or when pushing next chunk). So returning success in case of EAGAIN
will fix the issue.

Fixes: a42055e8d2c3 ("net/tls: Add support for async encryption")
Signed-off-by: Pooja Trivedi <pooja.trivedi@...ckpath.com>
Reviewed-by: Mallesham Jatharkonda <mallesham.jatharkonda@...convergence.com>
Reviewed-by: Josh Tway <josh.tway@...ckpath.com>
---
 net/tls/tls_sw.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index e23f94a..d8ebdfc 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -415,10 +415,12 @@ int tls_tx_records(struct sock *sk, int flags)
 	}
 
 tx_err:
-	if (rc < 0 && rc != -EAGAIN)
+	if (rc < 0 && rc != -EAGAIN) {
 		tls_err_abort(sk, EBADMSG);
+		return rc;
+	}
 
-	return rc;
+	return 0;
 }
 
 static void tls_encrypt_done(struct crypto_async_request *req, int err)
-- 
1.8.3.1

Powered by blists - more mailing lists