diff options
author | bcook <> | 2016-09-04 12:26:43 +0000 |
---|---|---|
committer | bcook <> | 2016-09-04 12:26:43 +0000 |
commit | ad909e37b20a2c933e88e0e359b2fdb401d05092 (patch) | |
tree | 00adeae01265c1c035072ffd2eb37000b9640ece /src/lib/libtls/tls_init.3 | |
parent | 50df0f10141bc06d1ff2d6bd98be2f5ab87857e6 (diff) | |
download | openbsd-ad909e37b20a2c933e88e0e359b2fdb401d05092.tar.gz openbsd-ad909e37b20a2c933e88e0e359b2fdb401d05092.tar.bz2 openbsd-ad909e37b20a2c933e88e0e359b2fdb401d05092.zip |
Add callback-based interface to libtls.
This allows working with buffers and callback functions instead of directly on
sockets or file descriptors.
Original patch from Tobias Pape <tobias_at_netshed.de>.
ok beck@
Diffstat (limited to 'src/lib/libtls/tls_init.3')
-rw-r--r-- | src/lib/libtls/tls_init.3 | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_init.3 b/src/lib/libtls/tls_init.3 index f9a8ac1f80..762a76633b 100644 --- a/src/lib/libtls/tls_init.3 +++ b/src/lib/libtls/tls_init.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: tls_init.3,v 1.68 2016/09/04 12:03:24 jsing Exp $ | 1 | .\" $OpenBSD: tls_init.3,v 1.69 2016/09/04 12:26:43 bcook Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
4 | .\" | 4 | .\" |
@@ -71,8 +71,10 @@ | |||
71 | .Nm tls_connect_fds , | 71 | .Nm tls_connect_fds , |
72 | .Nm tls_connect_servername , | 72 | .Nm tls_connect_servername , |
73 | .Nm tls_connect_socket , | 73 | .Nm tls_connect_socket , |
74 | .Nm tls_connect_cbs , | ||
74 | .Nm tls_accept_fds , | 75 | .Nm tls_accept_fds , |
75 | .Nm tls_accept_socket , | 76 | .Nm tls_accept_socket , |
77 | .Nm tls_accept_cbs , | ||
76 | .Nm tls_handshake , | 78 | .Nm tls_handshake , |
77 | .Nm tls_read , | 79 | .Nm tls_read , |
78 | .Nm tls_write , | 80 | .Nm tls_write , |
@@ -187,10 +189,14 @@ | |||
187 | .Ft "int" | 189 | .Ft "int" |
188 | .Fn tls_connect_socket "struct tls *ctx" "int s" "const char *servername" | 190 | .Fn tls_connect_socket "struct tls *ctx" "int s" "const char *servername" |
189 | .Ft "int" | 191 | .Ft "int" |
192 | .Fn tls_connect_cbs "struct tls *ctx" "ssize_t (*tls_read_cb)(void *ctx, void *buf, size_t buflen, void *cb_arg)" "ssize_t (*tls_write_cb)(void *ctx, const void *buf, size_t buflen, void *cb_arg)" "void *cb_arg" "const char *servername" | ||
193 | .Ft "int" | ||
190 | .Fn tls_accept_fds "struct tls *tls" "struct tls **cctx" "int fd_read" "int fd_write" | 194 | .Fn tls_accept_fds "struct tls *tls" "struct tls **cctx" "int fd_read" "int fd_write" |
191 | .Ft "int" | 195 | .Ft "int" |
192 | .Fn tls_accept_socket "struct tls *tls" "struct tls **cctx" "int socket" | 196 | .Fn tls_accept_socket "struct tls *tls" "struct tls **cctx" "int socket" |
193 | .Ft "int" | 197 | .Ft "int" |
198 | .Fn tls_accept_cbs "struct tls *ctx" "struct tls **cctx" "ssize_t (*tls_read_cb)(void *ctx, void *buf, size_t buflen, void *cb_arg)" "ssize_t (*tls_write_cb)(void *ctx, const void *buf, size_t buflen, void *cb_arg)" "void *cb_arg" | ||
199 | .Ft "int" | ||
194 | .Fn tls_handshake "struct tls *ctx" | 200 | .Fn tls_handshake "struct tls *ctx" |
195 | .Ft "ssize_t" | 201 | .Ft "ssize_t" |
196 | .Fn tls_read "struct tls *ctx" "void *buf" "size_t buflen" | 202 | .Fn tls_read "struct tls *ctx" "void *buf" "size_t buflen" |
@@ -247,6 +253,9 @@ An already existing socket can be upgraded to a secure connection by calling | |||
247 | Alternatively, a secure connection can be established over a pair of existing | 253 | Alternatively, a secure connection can be established over a pair of existing |
248 | file descriptors by calling | 254 | file descriptors by calling |
249 | .Fn tls_connect_fds . | 255 | .Fn tls_connect_fds . |
256 | Calling | ||
257 | .Fn tls_connect_cbs | ||
258 | allows specifying read and write callback functions to handle data transfer. The specified cb_arg parameter is passed back to the functions, and can contain a pointer to any caller-specified data. | ||
250 | .Pp | 259 | .Pp |
251 | A server can accept a new client connection by calling | 260 | A server can accept a new client connection by calling |
252 | .Fn tls_accept_socket | 261 | .Fn tls_accept_socket |
@@ -254,6 +263,9 @@ on an already established socket connection. | |||
254 | Alternatively, a new client connection can be accepted over a pair of existing | 263 | Alternatively, a new client connection can be accepted over a pair of existing |
255 | file descriptors by calling | 264 | file descriptors by calling |
256 | .Fn tls_accept_fds . | 265 | .Fn tls_accept_fds . |
266 | Calling | ||
267 | .Fn tls_accept_cbs | ||
268 | allows specifying read and write callback functions to handle data transfer. The specified cb_arg parameter is passed back to the functions, and can contain a pointer to any caller-specified data. | ||
257 | .Pp | 269 | .Pp |
258 | The TLS handshake can be completed by calling | 270 | The TLS handshake can be completed by calling |
259 | .Fn tls_handshake . | 271 | .Fn tls_handshake . |