tls: Fix mixing between async capable and async
authorEran Ben Elisha <eranbe@mellanox.com>
Wed, 27 Feb 2019 15:38:05 +0000 (17:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Mar 2019 06:10:16 +0000 (22:10 -0800)
commit7754bd63ed081fa7c0aedd79ae0e8003465b641b
tree2915698ec3e6c25f67e7ed13c14ad6061f64188b
parent7463d3a2db0efea3701aab5eeb310e0d8157aff7
tls: Fix mixing between async capable and async

Today, tls_sw_recvmsg is capable of using asynchronous mode to handle
application data TLS records. Moreover, it assumes that if the cipher
can be handled asynchronously, then all packets will be processed
asynchronously.

However, this assumption is not always true. Specifically, for AES-GCM
in TLS1.2, it causes data corruption, and breaks user applications.

This patch fixes this problem by separating the async capability from
the decryption operation result.

Fixes: c0ab4732d4c6 ("net/tls: Do not use async crypto for non-data records")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_sw.c