1 .\" $OpenBSD: tls_connect.3,v 1.3 2017/01/28 00:59:36 schwarze Exp $
3 .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4 .\" Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org>
5 .\" Copyright (c) 2016 Brent Cook <bcook@openbsd.org>
7 .\" Permission to use, copy, modify, and distribute this software for any
8 .\" purpose with or without fee is hereby granted, provided that the above
9 .\" copyright notice and this permission notice appear in all copies.
11 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 .Dd $Mdocdate: January 28 2017 $
25 .Nm tls_connect_servername ,
26 .Nm tls_connect_socket ,
28 .Nd instruct a TLS client to establish a connection
34 .Fa "const char *host"
35 .Fa "const char *port"
42 .Fa "const char *servername"
45 .Fo tls_connect_servername
47 .Fa "const char *host"
48 .Fa "const char *port"
49 .Fa "const char *servername"
52 .Fo tls_connect_socket
55 .Fa "const char *servername"
60 .Fa "ssize_t (*tls_read_cb)(struct tls *ctx,\
61 void *buf, size_t buflen, void *cb_arg)"
62 .Fa "ssize_t (*tls_write_cb)(struct tls *ctx,\
63 const void *buf, size_t buflen, void *cb_arg)"
65 .Fa "const char *servername"
68 After creating a TLS client context with
70 and configuring it with
72 a client connection is initiated by calling
74 This function will create a new socket, connect to the specified
78 and then establish a secure connection.
81 may be numeric or a service name.
86 of the format "hostname:port" is permitted.
89 .Fn tls_connect_servername
90 function has the same behaviour, however the name to use for verification is
91 explicitly provided, rather than being inferred from the
95 An already existing socket can be upgraded to a secure connection by calling
96 .Fn tls_connect_socket .
98 Alternatively, a secure connection can be established over a pair of existing
99 file descriptors by calling
100 .Fn tls_connect_fds .
104 allows read and write callback functions to handle data transfers.
105 The specified cb_arg parameter is passed back to the functions,
106 and can contain a pointer to any caller-specified data.
108 These functions return 0 on success or -1 on error.
110 .Xr tls_accept_socket 3 ,
113 .Xr tls_config_ocsp_require_stapling 3 ,
114 .Xr tls_configure 3 ,
115 .Xr tls_handshake 3 ,
120 .Fn tls_connect_socket
123 and got their final names in
128 .Fn tls_connect_servername
136 .An Joel Sing Aq Mt jsing@openbsd.org
137 .An Reyk Floeter Aq Mt reyk@openbsd.org
142 .An Tobias Pape Aq Mt tobias@netshed.de .