summaryrefslogtreecommitdiff
path: root/src/lib/libtls/man/tls_connect.3
diff options
context:
space:
mode:
authorschwarze <>2017-01-25 23:53:18 +0000
committerschwarze <>2017-01-25 23:53:18 +0000
commit35fdef4d614c3469f40e63e53b292de178a9e20c (patch)
treefef38b6a567bfd2a81ea86890fca7a8ed7a42cff /src/lib/libtls/man/tls_connect.3
parent276285ad64cc31b4a733563d702dd870939e4e53 (diff)
downloadopenbsd-35fdef4d614c3469f40e63e53b292de178a9e20c.tar.gz
openbsd-35fdef4d614c3469f40e63e53b292de178a9e20c.tar.bz2
openbsd-35fdef4d614c3469f40e63e53b292de178a9e20c.zip
split the tls_init(3) that had grown fat to allow healthy future growth;
suggested by jsing@; "i would just chuck it in" jmc@
Diffstat (limited to 'src/lib/libtls/man/tls_connect.3')
-rw-r--r--src/lib/libtls/man/tls_connect.3114
1 files changed, 114 insertions, 0 deletions
diff --git a/src/lib/libtls/man/tls_connect.3 b/src/lib/libtls/man/tls_connect.3
new file mode 100644
index 0000000000..8137fba53b
--- /dev/null
+++ b/src/lib/libtls/man/tls_connect.3
@@ -0,0 +1,114 @@
1.\" $OpenBSD: tls_connect.3,v 1.1 2017/01/25 23:53:18 schwarze Exp $
2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: January 25 2017 $
18.Dt TLS_CONNECT 3
19.Os
20.Sh NAME
21.Nm tls_connect ,
22.Nm tls_connect_fds ,
23.Nm tls_connect_servername ,
24.Nm tls_connect_socket ,
25.Nm tls_connect_cbs
26.Nd instruct a TLS client to establish a connection
27.Sh SYNOPSIS
28.In tls.h
29.Ft int
30.Fo tls_connect
31.Fa "struct tls *ctx"
32.Fa "const char *host"
33.Fa "const char *port"
34.Fc
35.Ft int
36.Fo tls_connect_fds
37.Fa "struct tls *ctx"
38.Fa "int fd_read"
39.Fa "int fd_write"
40.Fa "const char *servername"
41.Fc
42.Ft int
43.Fo tls_connect_servername
44.Fa "struct tls *ctx"
45.Fa "const char *host"
46.Fa "const char *port"
47.Fa "const char *servername"
48.Fc
49.Ft int
50.Fo tls_connect_socket
51.Fa "struct tls *ctx"
52.Fa "int s"
53.Fa "const char *servername"
54.Fc
55.Ft int
56.Fo tls_connect_cbs
57.Fa "struct tls *ctx"
58.Fa "ssize_t (*tls_read_cb)(struct tls *ctx,\
59 void *buf, size_t buflen, void *cb_arg)"
60.Fa "ssize_t (*tls_write_cb)(struct tls *ctx,\
61 const void *buf, size_t buflen, void *cb_arg)"
62.Fa "void *cb_arg"
63.Fa "const char *servername"
64.Fc
65.Sh DESCRIPTION
66After creating a TLS client context with
67.Xr tls_client 3
68and configuring it with
69.Xr tls_configure 3 ,
70a client connection is initiated by calling
71.Fn tls_connect .
72This function will create a new socket, connect to the specified
73.Fa host
74and
75.Fa port ,
76and then establish a secure connection.
77The
78.Fa port
79may be numeric or a service name.
80If it is
81.Dv NULL ,
82then a
83.Fa host
84of the format "hostname:port" is permitted.
85.Pp
86The
87.Fn tls_connect_servername
88function has the same behaviour, however the name to use for verification is
89explicitly provided, rather than being inferred from the
90.Ar host
91value.
92.Pp
93An already existing socket can be upgraded to a secure connection by calling
94.Fn tls_connect_socket .
95.Pp
96Alternatively, a secure connection can be established over a pair of existing
97file descriptors by calling
98.Fn tls_connect_fds .
99.Pp
100Calling
101.Fn tls_connect_cbs
102allows read and write callback functions to handle data transfers.
103The specified cb_arg parameter is passed back to the functions,
104and can contain a pointer to any caller-specified data.
105.Sh RETURN VALUES
106These functions return 0 on success or -1 on error.
107.Sh SEE ALSO
108.Xr tls_accept_socket 3 ,
109.Xr tls_client 3 ,
110.Xr tls_close 3 ,
111.Xr tls_config_ocsp_require_stapling 3 ,
112.Xr tls_configure 3 ,
113.Xr tls_handshake 3 ,
114.Xr tls_init 3