diff options
Diffstat (limited to 'src/lib/libtls/man/tls_init.3')
-rw-r--r-- | src/lib/libtls/man/tls_init.3 | 126 |
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 | ||
37 | The | ||
38 | .Nm tls | ||
39 | family of functions establishes a secure communications channel | ||
40 | using the TLS socket protocol. | ||
41 | Both clients and servers are supported. | ||
42 | .Pp | ||
43 | The | ||
44 | .Fn tls_init | ||
45 | function initializes global data structures. | ||
46 | It should be called once before any other functions. | ||
47 | It may be called more than once, but not concurrently. | ||
48 | .Pp | ||
49 | Before a connection is created, a configuration must be created. | ||
50 | The | ||
51 | .Fn tls_config_new | ||
52 | function allocates, initializes, and returns a new default configuration | ||
53 | object that can be used for future connections. | ||
54 | Several 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 , | ||
58 | and | ||
59 | .Xr tls_config_verify 3 . | ||
60 | .Pp | ||
61 | The | ||
62 | .Fn tls_config_error | ||
63 | function may be used to retrieve a string containing more information | ||
64 | about the most recent error relating to a configuration. | ||
65 | .Pp | ||
66 | A TLS connection object is created by | ||
67 | .Xr tls_client 3 | ||
68 | or | ||
69 | .Xr tls_server 3 | ||
70 | and configured with | ||
71 | .Xr tls_configure 3 . | ||
72 | .Pp | ||
73 | A client connection is initiated after configuration by calling | ||
74 | .Xr tls_connect 3 . | ||
75 | A server can accept a new client connection by calling | ||
76 | .Xr tls_accept_socket 3 | ||
77 | on an already established socket connection. | ||
78 | .Pp | ||
79 | Two functions are provided for input and output, | ||
80 | .Xr tls_read 3 | ||
81 | and | ||
82 | .Xr tls_write 3 . | ||
83 | Both automatically perform the | ||
84 | .Xr tls_handshake 3 | ||
85 | when needed. | ||
86 | .Pp | ||
87 | The properties of established TLS connections | ||
88 | can be inspected with the functions described in | ||
89 | .Xr tls_conn_version 3 | ||
90 | and | ||
91 | .Xr tls_ocsp_process_response 3 . | ||
92 | .Pp | ||
93 | After use, a TLS connection should be closed with | ||
94 | .Xr tls_close 3 | ||
95 | and then freed by calling | ||
96 | .Xr tls_free 3 . | ||
97 | .Pp | ||
98 | When no more contexts are to be created, | ||
99 | the configuration object should be freed by calling | ||
100 | .Fn tls_config_free . | ||
101 | .Sh RETURN VALUES | ||
102 | .Fn tls_init | ||
103 | returns 0 on success or -1 on error. | ||
104 | .Pp | ||
105 | .Fn tls_config_new | ||
106 | returns | ||
107 | .Dv NULL | ||
108 | on 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 | ||
121 | The | ||
122 | .Nm tls | ||
123 | API first appeared in | ||
124 | .Ox 5.6 | ||
125 | as a response to the unnecessary challenges other APIs present in | ||
126 | order to use them safely. | ||