import libtls (LibreSSL 2.5.4)
[unleashed.git] / lib / libtls / man / tls_client.3
blob47114e4ac2a92515155ec27f027793964a8f909c
1 .\" $OpenBSD: tls_client.3,v 1.2 2017/01/28 00:59:36 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 28 2017 $
18 .Dt TLS_CLIENT 3
19 .Os
20 .Sh NAME
21 .Nm tls_client ,
22 .Nm tls_server ,
23 .Nm tls_configure ,
24 .Nm tls_free
25 .Nd configure a TLS connection
26 .Sh SYNOPSIS
27 .In tls.h
28 .Ft struct tls *
29 .Fn tls_client void
30 .Ft struct tls *
31 .Fn tls_server void
32 .Ft int
33 .Fo tls_configure
34 .Fa "struct tls *ctx"
35 .Fa "struct tls_config *config"
36 .Fc
37 .Ft void
38 .Fn tls_free "struct tls *ctx"
39 .Sh DESCRIPTION
40 A TLS connection is represented as a
41 .Vt struct tls
42 object called a
43 .Dq context .
44 A new context is created by either the
45 .Fn tls_client
47 .Fn tls_server
48 functions.
49 .Fn tls_client
50 is used in TLS client programs,
51 .Fn tls_server
52 in TLS server programs.
53 .Pp
54 The context can then be configured with the function
55 .Fn tls_configure .
56 The same
57 .Vt tls_config
58 object can be used to configure multiple contexts.
59 .Pp
60 After configuration,
61 .Xr tls_connect 3
62 can be called on objects created with
63 .Fn tls_client ,
64 and
65 .Xr tls_accept_socket 3
66 on objects created with
67 .Fn tls_server .
68 .Pp
69 After use, a TLS context should be closed with
70 .Xr tls_close 3 ,
71 and then freed by calling
72 .Fn tls_free .
73 .Sh RETURN VALUES
74 .Fn tls_client
75 and
76 .Fn tls_server
77 return
78 .Dv NULL
79 on error or an out of memory condition.
80 .Pp
81 .Fn tls_configure
82 returns 0 on success or -1 on error.
83 .Sh SEE ALSO
84 .Xr tls_accept_socket 3 ,
85 .Xr tls_config_new 3 ,
86 .Xr tls_connect 3 ,
87 .Xr tls_init 3
88 .Sh HISTORY
89 These functions appeared in
90 .Ox 5.6
91 and got their final names in
92 .Ox 5.7 .
93 .Sh AUTHORS
94 .An Joel Sing Aq Mt jsing@openbsd.org