diff options
author | schwarze <> | 2017-02-20 13:09:15 +0000 |
---|---|---|
committer | schwarze <> | 2017-02-20 13:09:15 +0000 |
commit | 4565e979c4bc23c9029219f98144e218958f0de5 (patch) | |
tree | 04d13d955e559423c5b686fdcf26ac7cc33c112e | |
parent | f5687e58de136104a8aedcd260a57135fbb9572c (diff) | |
download | openbsd-4565e979c4bc23c9029219f98144e218958f0de5.tar.gz openbsd-4565e979c4bc23c9029219f98144e218958f0de5.tar.bz2 openbsd-4565e979c4bc23c9029219f98144e218958f0de5.zip |
document tls_config_error(3) RETURN VALUES, improve what is said
about tls_error(3), and warn about some traps;
OK jmc@
-rw-r--r-- | src/lib/libtls/man/tls_init.3 | 29 | ||||
-rw-r--r-- | src/lib/libtls/man/tls_read.3 | 36 |
2 files changed, 59 insertions, 6 deletions
diff --git a/src/lib/libtls/man/tls_init.3 b/src/lib/libtls/man/tls_init.3 index 36d2e29084..b17bb814fe 100644 --- a/src/lib/libtls/man/tls_init.3 +++ b/src/lib/libtls/man/tls_init.3 | |||
@@ -1,7 +1,8 @@ | |||
1 | .\" $OpenBSD: tls_init.3,v 1.3 2017/01/28 00:59:36 schwarze Exp $ | 1 | .\" $OpenBSD: tls_init.3,v 1.4 2017/02/20 13:09:15 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
4 | .\" Copyright (c) 2016 Joel Sing <jsing@openbsd.org> | 4 | .\" Copyright (c) 2016 Joel Sing <jsing@openbsd.org> |
5 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | ||
5 | .\" | 6 | .\" |
6 | .\" Permission to use, copy, modify, and distribute this software for any | 7 | .\" Permission to use, copy, modify, and distribute this software for any |
7 | .\" purpose with or without fee is hereby granted, provided that the above | 8 | .\" purpose with or without fee is hereby granted, provided that the above |
@@ -15,7 +16,7 @@ | |||
15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | .\" | 18 | .\" |
18 | .Dd $Mdocdate: January 28 2017 $ | 19 | .Dd $Mdocdate: February 20 2017 $ |
19 | .Dt TLS_INIT 3 | 20 | .Dt TLS_INIT 3 |
20 | .Os | 21 | .Os |
21 | .Sh NAME | 22 | .Sh NAME |
@@ -107,6 +108,15 @@ returns 0 on success or -1 on error. | |||
107 | returns | 108 | returns |
108 | .Dv NULL | 109 | .Dv NULL |
109 | on error or an out of memory condition. | 110 | on error or an out of memory condition. |
111 | .Pp | ||
112 | .Fn tls_config_error | ||
113 | returns | ||
114 | .Dv NULL | ||
115 | if no error occured with | ||
116 | .Fa config | ||
117 | at all, or if memory allocation failed while trying to assemble the | ||
118 | string describing the most recent error related to | ||
119 | .Fa config . | ||
110 | .Sh SEE ALSO | 120 | .Sh SEE ALSO |
111 | .Xr tls_accept_socket 3 , | 121 | .Xr tls_accept_socket 3 , |
112 | .Xr tls_client 3 , | 122 | .Xr tls_client 3 , |
@@ -142,3 +152,18 @@ appeared in | |||
142 | .Pp | 152 | .Pp |
143 | Many others contributed to various parts of the library; see the | 153 | Many others contributed to various parts of the library; see the |
144 | individual manual pages for more information. | 154 | individual manual pages for more information. |
155 | .Sh CAVEATS | ||
156 | The function | ||
157 | .Fn tls_config_error | ||
158 | returns an internal pointer. | ||
159 | It must not be freed by the application, or a double free error | ||
160 | will occur. | ||
161 | The pointer will become invalid when the next error occurs with | ||
162 | .Fa config . | ||
163 | Consequently, if the application may need the message at a later | ||
164 | time, it has to copy the string before calling the next | ||
165 | .Sy libtls | ||
166 | function involving | ||
167 | .Fa config , | ||
168 | or a segmentation fault or read access to unintended data is the | ||
169 | likely result. | ||
diff --git a/src/lib/libtls/man/tls_read.3 b/src/lib/libtls/man/tls_read.3 index e990361017..a7faebaea7 100644 --- a/src/lib/libtls/man/tls_read.3 +++ b/src/lib/libtls/man/tls_read.3 | |||
@@ -1,9 +1,10 @@ | |||
1 | .\" $OpenBSD: tls_read.3,v 1.3 2017/01/28 00:59:36 schwarze Exp $ | 1 | .\" $OpenBSD: tls_read.3,v 1.4 2017/02/20 13:09:15 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2014, 2015 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014, 2015 Ted Unangst <tedu@openbsd.org> |
4 | .\" Copyright (c) 2015 Doug Hogan <doug@openbsd.org> | 4 | .\" Copyright (c) 2015 Doug Hogan <doug@openbsd.org> |
5 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 5 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
6 | .\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> | 6 | .\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> |
7 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | ||
7 | .\" | 8 | .\" |
8 | .\" Permission to use, copy, modify, and distribute this software for any | 9 | .\" Permission to use, copy, modify, and distribute this software for any |
9 | .\" purpose with or without fee is hereby granted, provided that the above | 10 | .\" purpose with or without fee is hereby granted, provided that the above |
@@ -17,7 +18,7 @@ | |||
17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | .\" | 20 | .\" |
20 | .Dd $Mdocdate: January 28 2017 $ | 21 | .Dd $Mdocdate: February 20 2017 $ |
21 | .Dt TLS_READ 3 | 22 | .Dt TLS_READ 3 |
22 | .Os | 23 | .Os |
23 | .Sh NAME | 24 | .Sh NAME |
@@ -106,8 +107,20 @@ return 0 on success or -1 on error. | |||
106 | .Fn tls_error | 107 | .Fn tls_error |
107 | returns | 108 | returns |
108 | .Dv NULL | 109 | .Dv NULL |
109 | if no error occurred or the first place, or if memory allocation | 110 | if no error occurred with |
110 | failed while trying to assemble the string describing the error. | 111 | .Fa ctx |
112 | during or since the last call to | ||
113 | .Fn tls_handshake , | ||
114 | .Fn tls_read , | ||
115 | .Fn tls_write , | ||
116 | .Fn tls_close , | ||
117 | or | ||
118 | .Fn tls_reset | ||
119 | involving | ||
120 | .Fa ctx , | ||
121 | or if memory allocation failed while trying to assemble the string | ||
122 | describing the most recent error related to | ||
123 | .Fa ctx . | ||
111 | .Pp | 124 | .Pp |
112 | The | 125 | The |
113 | .Fn tls_read , | 126 | .Fn tls_read , |
@@ -215,3 +228,18 @@ appeared in | |||
215 | .An Joel Sing Aq Mt jsing@openbsd.org | 228 | .An Joel Sing Aq Mt jsing@openbsd.org |
216 | with contributions from | 229 | with contributions from |
217 | .An Bob Beck Aq Mt beck@openbsd.org | 230 | .An Bob Beck Aq Mt beck@openbsd.org |
231 | .Sh CAVEATS | ||
232 | The function | ||
233 | .Fn tls_error | ||
234 | returns an internal pointer. | ||
235 | It must not be freed by the application, or a double free error | ||
236 | will occur. | ||
237 | The pointer will become invalid when the next error occurs with | ||
238 | .Fa ctx . | ||
239 | Consequently, if the application may need the message at a later | ||
240 | time, it has to copy the string before calling the next | ||
241 | .Sy libtls | ||
242 | function involving | ||
243 | .Fa ctx , | ||
244 | or a segmentation fault or read access to unintended data is the | ||
245 | likely result. | ||