summaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/tls.h
diff options
context:
space:
mode:
authorDave Watson2018-03-22 18:10:35 +0100
committerDavid S. Miller2018-03-23 17:25:54 +0100
commitc46234ebb4d1eee5e09819f49169e51cfc6eb909 (patch)
tree6f1fbbe3cd74ec939633db5a9e2d6b80ffffaf16 /include/uapi/linux/tls.h
parenttls: Refactor variable names (diff)
downloadkernel-qcow2-linux-c46234ebb4d1eee5e09819f49169e51cfc6eb909.tar.gz
kernel-qcow2-linux-c46234ebb4d1eee5e09819f49169e51cfc6eb909.tar.xz
kernel-qcow2-linux-c46234ebb4d1eee5e09819f49169e51cfc6eb909.zip
tls: RX path for ktls
Add rx path for tls software implementation. recvmsg, splice_read, and poll implemented. An additional sockopt TLS_RX is added, with the same interface as TLS_TX. Either TLX_RX or TLX_TX may be provided separately, or together (with two different setsockopt calls with appropriate keys). Control messages are passed via CMSG in a similar way to transmit. If no cmsg buffer is passed, then only application data records will be passed to userspace, and EIO is returned for other types of alerts. EBADMSG is passed for decryption errors, and EMSGSIZE is passed for framing too big, and EBADMSG for framing too small (matching openssl semantics). EINVAL is returned for TLS versions that do not match the original setsockopt call. All are unrecoverable. strparser is used to parse TLS framing. Decryption is done directly in to userspace buffers if they are large enough to support it, otherwise sk_cow_data is called (similar to ipsec), and buffers are decrypted in place and copied. splice_read always decrypts in place, since no buffers are provided to decrypt in to. sk_poll is overridden, and only returns POLLIN if a full TLS message is received. Otherwise we wait for strparser to finish reading a full frame. Actual decryption is only done during recvmsg or splice_read calls. Signed-off-by: Dave Watson <davejwatson@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux/tls.h')
-rw-r--r--include/uapi/linux/tls.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
index 293b2cdad88d..c6633e97eca4 100644
--- a/include/uapi/linux/tls.h
+++ b/include/uapi/linux/tls.h
@@ -38,6 +38,7 @@
/* TLS socket options */
#define TLS_TX 1 /* Set transmit parameters */
+#define TLS_RX 2 /* Set receive parameters */
/* Supported versions */
#define TLS_VERSION_MINOR(ver) ((ver) & 0xFF)
@@ -59,6 +60,7 @@
#define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE 8
#define TLS_SET_RECORD_TYPE 1
+#define TLS_GET_RECORD_TYPE 2
struct tls_crypto_info {
__u16 version;