summaryrefslogtreecommitdiff
path: root/include/linux/sockptr.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-07-05 16:59:24 -0700
committerDavid S. Miller <davem@davemloft.net>2022-07-06 12:56:35 +0100
commit88527790c079fb1ea41cbcfa4450ee37906a2fb0 (patch)
treeabf64848744f5edeed09b97460562add63d79ad8 /include/linux/sockptr.h
parentce61327ce989b63c0bd1cc7afee00e218ee696ac (diff)
downloadlwn-88527790c079fb1ea41cbcfa4450ee37906a2fb0.tar.gz
lwn-88527790c079fb1ea41cbcfa4450ee37906a2fb0.zip
tls: rx: add sockopt for enabling optimistic decrypt with TLS 1.3
Since optimisitic decrypt may add extra load in case of retries require socket owner to explicitly opt-in. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/sockptr.h')
-rw-r--r--include/linux/sockptr.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/sockptr.h b/include/linux/sockptr.h
index ea193414298b..d45902fb4cad 100644
--- a/include/linux/sockptr.h
+++ b/include/linux/sockptr.h
@@ -102,4 +102,12 @@ static inline long strncpy_from_sockptr(char *dst, sockptr_t src, size_t count)
return strncpy_from_user(dst, src.user, count);
}
+static inline int check_zeroed_sockptr(sockptr_t src, size_t offset,
+ size_t size)
+{
+ if (!sockptr_is_kernel(src))
+ return check_zeroed_user(src.user + offset, size);
+ return memchr_inv(src.kernel + offset, 0, size) == NULL;
+}
+
#endif /* _LINUX_SOCKPTR_H */