summaryrefslogtreecommitdiffstats
path: root/include/internal/bio.h
diff options
context:
space:
mode:
authorBoris Pismenny <borisp@mellanox.com>2017-06-01 08:46:33 +0300
committerMatt Caswell <matt@openssl.org>2018-12-07 11:25:45 +0000
commit6ba76c4f23e4b4ddc27b9e7234c8b9c3bcff5eff (patch)
treeef8035d59fbeaad066ff3c6e82fd951f5691bed4 /include/internal/bio.h
parent69495e3df57335ad43bc66fa2477636f66afed85 (diff)
bio: Linux TLS Offload
Add support for Linux TLS offload in the BIO layer and specifically in bss_sock.c. Signed-off-by: Boris Pismenny <borisp@mellanox.com> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Yang <yang.yang@baishancloud.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5253)
Diffstat (limited to 'include/internal/bio.h')
-rw-r--r--include/internal/bio.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/internal/bio.h b/include/internal/bio.h
index e1251f6aaf..1e80d5ac68 100644
--- a/include/internal/bio.h
+++ b/include/internal/bio.h
@@ -7,6 +7,9 @@
* https://www.openssl.org/source/license.html
*/
+#ifndef HEADER_INTERNAL_BIO_H
+# define HEADER_INTERNAL_BIO_H
+
#include <openssl/bio.h>
struct bio_method_st {
@@ -31,3 +34,36 @@ void bio_cleanup(void);
/* Old style to new style BIO_METHOD conversion functions */
int bwrite_conv(BIO *bio, const char *data, size_t datal, size_t *written);
int bread_conv(BIO *bio, char *data, size_t datal, size_t *read);
+
+# define BIO_CTRL_SET_KTLS_SEND 72
+# define BIO_CTRL_SET_KTLS_SEND_CTRL_MSG 74
+# define BIO_CTRL_CLEAR_KTLS_CTRL_MSG 75
+
+/*
+ * This is used with socket BIOs:
+ * BIO_FLAGS_KTLS means we are using ktls with this BIO.
+ * BIO_FLAGS_KTLS_CTRL_MSG means we are about to send a ctrl message next.
+ */
+# define BIO_FLAGS_KTLS 0x800
+# define BIO_FLAGS_KTLS_CTRL_MSG 0x1000
+
+/* KTLS related controls and flags */
+# define BIO_set_ktls_flag(b) \
+ BIO_set_flags(b, BIO_FLAGS_KTLS)
+# define BIO_should_ktls_flag(b) \
+ BIO_test_flags(b, BIO_FLAGS_KTLS)
+# define BIO_set_ktls_ctrl_msg_flag(b) \
+ BIO_set_flags(b, BIO_FLAGS_KTLS_CTRL_MSG)
+# define BIO_should_ktls_ctrl_msg_flag(b) \
+ BIO_test_flags(b, (BIO_FLAGS_KTLS_CTRL_MSG))
+# define BIO_clear_ktls_ctrl_msg_flag(b) \
+ BIO_clear_flags(b, (BIO_FLAGS_KTLS_CTRL_MSG))
+
+# define BIO_set_ktls(b, keyblob, is_tx) \
+ BIO_ctrl(b, BIO_CTRL_SET_KTLS_SEND, is_tx, keyblob)
+# define BIO_set_ktls_ctrl_msg(b, record_type) \
+ BIO_ctrl(b, BIO_CTRL_SET_KTLS_SEND_CTRL_MSG, record_type, NULL)
+# define BIO_clear_ktls_ctrl_msg(b) \
+ BIO_ctrl(b, BIO_CTRL_CLEAR_KTLS_CTRL_MSG, 0, NULL)
+
+#endif