aboutsummaryrefslogtreecommitdiffstats
path: root/net/tls/tls.h
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2023-05-17 01:50:41 +0000
committerDavid S. Miller <[email protected]>2023-05-19 07:37:37 +0000
commiteca9bfafee3a0487e59c59201ae14c7594ba940a (patch)
tree1ce0d490fae0ff412efd3bce9e0d350ca8fd3e6c /net/tls/tls.h
parenttls: rx: strp: factor out copying skb data (diff)
downloadkernel-eca9bfafee3a0487e59c59201ae14c7594ba940a.tar.gz
kernel-eca9bfafee3a0487e59c59201ae14c7594ba940a.zip
tls: rx: strp: preserve decryption status of skbs when needed
When receive buffer is small we try to copy out the data from TCP into a skb maintained by TLS to prevent connection from stalling. Unfortunately if a single record is made up of a mix of decrypted and non-decrypted skbs combining them into a single skb leads to loss of decryption status, resulting in decryption errors or data corruption. Similarly when trying to use TCP receive queue directly we need to make sure that all the skbs within the record have the same status. If we don't the mixed status will be detected correctly but we'll CoW the anchor, again collapsing it into a single paged skb without decrypted status preserved. So the "fixup" code will not know which parts of skb to re-encrypt. Fixes: 84c61fe1a75b ("tls: rx: do not use the standard strparser") Tested-by: Shai Amiram <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/tls/tls.h')
-rw-r--r--net/tls/tls.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/tls/tls.h b/net/tls/tls.h
index 804c3880d028..0672acab2773 100644
--- a/net/tls/tls.h
+++ b/net/tls/tls.h
@@ -167,6 +167,11 @@ static inline bool tls_strp_msg_ready(struct tls_sw_context_rx *ctx)
return ctx->strp.msg_ready;
}
+static inline bool tls_strp_msg_mixed_decrypted(struct tls_sw_context_rx *ctx)
+{
+ return ctx->strp.mixed_decrypted;
+}
+
#ifdef CONFIG_TLS_DEVICE
int tls_device_init(void);
void tls_device_cleanup(void);