Super User's BSD Cross Reference: /OpenBSD/lib/libtls/man/tls_client.3

1 .\" $OpenBSD: tls_client.3,v 1.5 2025年07月07日 10:54:00 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: July 7 2025 $
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_reset ,
25 .Nm tls_free
26 .Nd configure a TLS connection
27 .Sh SYNOPSIS
28 .Lb libtls libssl libcrypto
29 .In tls.h
30 .Ft struct tls *
31 .Fn tls_client void
32 .Ft struct tls *
33 .Fn tls_server void
34 .Ft int
35 .Fo tls_configure
36 .Fa "struct tls *ctx"
37 .Fa "struct tls_config *config"
38 .Fc
39 .Ft void
40 .Fn tls_free "struct tls *ctx"
41 .Ft void
42 .Fn tls_reset "struct tls *ctx"
43 .Sh DESCRIPTION
44A TLS connection is represented as a
45 .Vt struct tls
46object called a
47 .Dq context .
48A new context is created by either the
49 .Fn tls_client
50or
51 .Fn tls_server
52functions.
53 .Fn tls_client
54is used in TLS client programs,
55 .Fn tls_server
56in TLS server programs.
57 .Pp
58The context can then be configured with the function
59 .Fn tls_configure .
60The same
61 .Vt tls_config
62object can be used to configure multiple contexts.
63 .Pp
64After configuration,
65 .Xr tls_connect 3
66can be called on objects created with
67 .Fn tls_client ,
68and
69 .Xr tls_accept_socket 3
70on objects created with
71 .Fn tls_server .
72 .Pp
73After use, a TLS context should be closed with
74 .Xr tls_close 3 ,
75and then freed by calling
76 .Fn tls_free .
77If
78 .Fn tls_free
79is called with an argument of
80 .Dv NULL ,
81no action occurs.
82 .Pp
83A TLS context can be reset by calling
84 .Fn tls_reset ,
85allowing for it to be reused.
86This is essentially equivalent to calling
87 .Fn tls_free ,
88followed by a call to the same function that was used to originally allocate
89the TLS context.
90 .Sh RETURN VALUES
91 .Fn tls_client
92and
93 .Fn tls_server
94return
95 .Dv NULL
96on error or an out of memory condition.
97 .Pp
98 .Fn tls_configure
99returns 0 on success or -1 on error.
100 .Sh SEE ALSO
101 .Xr tls_accept_socket 3 ,
102 .Xr tls_config_new 3 ,
103 .Xr tls_connect 3 ,
104 .Xr tls_init 3
105 .Sh HISTORY
106These functions appeared in
107 .Ox 5.6 
108and got their final names in
109 .Ox 5.7  .
110 .Sh AUTHORS
111 .An Joel Sing Aq Mt jsing@openbsd.org
112 

AltStyle によって変換されたページ (->オリジナル) /