summaryrefslogtreecommitdiff
path: root/src/lib/libtls/man/tls_init.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libtls/man/tls_init.3')
-rw-r--r--src/lib/libtls/man/tls_init.3126
1 files changed, 126 insertions, 0 deletions
diff --git a/src/lib/libtls/man/tls_init.3 b/src/lib/libtls/man/tls_init.3
new file mode 100644
index 0000000000..af0eec3802
--- /dev/null
+++ b/src/lib/libtls/man/tls_init.3
@@ -0,0 +1,126 @@
1.\" $OpenBSD: tls_init.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_INIT 3
19.Os
20.Sh NAME
21.Nm tls_init ,
22.Nm tls_config_new ,
23.Nm tls_config_free ,
24.Nm tls_config_error
25.Nd initialize TLS client and server API
26.Sh SYNOPSIS
27.In tls.h
28.Ft int
29.Fn tls_init void
30.Ft struct tls_config *
31.Fn tls_config_new void
32.Ft void
33.Fn tls_config_free "struct tls_config *config"
34.Ft const char *
35.Fn tls_config_error "struct tls_config *config"
36.Sh DESCRIPTION
37The
38.Nm tls
39family of functions establishes a secure communications channel
40using the TLS socket protocol.
41Both clients and servers are supported.
42.Pp
43The
44.Fn tls_init
45function initializes global data structures.
46It should be called once before any other functions.
47It may be called more than once, but not concurrently.
48.Pp
49Before a connection is created, a configuration must be created.
50The
51.Fn tls_config_new
52function allocates, initializes, and returns a new default configuration
53object that can be used for future connections.
54Several functions exist to change the options of the configuration; see
55.Xr tls_config_set_protocols 3 ,
56.Xr tls_load_file 3 ,
57.Xr tls_config_ocsp_require_stapling 3 ,
58and
59.Xr tls_config_verify 3 .
60.Pp
61The
62.Fn tls_config_error
63function may be used to retrieve a string containing more information
64about the most recent error relating to a configuration.
65.Pp
66A TLS connection object is created by
67.Xr tls_client 3
68or
69.Xr tls_server 3
70and configured with
71.Xr tls_configure 3 .
72.Pp
73A client connection is initiated after configuration by calling
74.Xr tls_connect 3 .
75A server can accept a new client connection by calling
76.Xr tls_accept_socket 3
77on an already established socket connection.
78.Pp
79Two functions are provided for input and output,
80.Xr tls_read 3
81and
82.Xr tls_write 3 .
83Both automatically perform the
84.Xr tls_handshake 3
85when needed.
86.Pp
87The properties of established TLS connections
88can be inspected with the functions described in
89.Xr tls_conn_version 3
90and
91.Xr tls_ocsp_process_response 3 .
92.Pp
93After use, a TLS connection should be closed with
94.Xr tls_close 3
95and then freed by calling
96.Xr tls_free 3 .
97.Pp
98When no more contexts are to be created,
99the configuration object should be freed by calling
100.Fn tls_config_free .
101.Sh RETURN VALUES
102.Fn tls_init
103returns 0 on success or -1 on error.
104.Pp
105.Fn tls_config_new
106returns
107.Dv NULL
108on error or an out of memory condition.
109.Sh SEE ALSO
110.Xr tls_accept_socket 3 ,
111.Xr tls_client 3 ,
112.Xr tls_config_ocsp_require_stapling 3 ,
113.Xr tls_config_set_protocols 3 ,
114.Xr tls_config_verify 3 ,
115.Xr tls_conn_version 3 ,
116.Xr tls_connect 3 ,
117.Xr tls_load_file 3 ,
118.Xr tls_ocsp_process_response 3 ,
119.Xr tls_read 3
120.Sh HISTORY
121The
122.Nm tls
123API first appeared in
124.Ox 5.6
125as a response to the unnecessary challenges other APIs present in
126order to use them safely.