diff options
Diffstat (limited to 'src/lib/libtls/man')
| -rw-r--r-- | src/lib/libtls/man/Makefile | 23 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_accept_socket.3 | 107 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_client.3 | 110 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_config_ocsp_require_stapling.3 | 40 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_config_set_protocols.3 | 229 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_config_set_session_id.3 | 105 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_config_verify.3 | 79 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_conn_version.3 | 225 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_connect.3 | 144 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_init.3 | 180 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_load_file.3 | 369 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_ocsp_process_response.3 | 167 | ||||
| -rw-r--r-- | src/lib/libtls/man/tls_read.3 | 240 |
13 files changed, 0 insertions, 2018 deletions
diff --git a/src/lib/libtls/man/Makefile b/src/lib/libtls/man/Makefile deleted file mode 100644 index 4883377669..0000000000 --- a/src/lib/libtls/man/Makefile +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2017/01/25 23:53:18 schwarze Exp $ | ||
| 2 | |||
| 3 | .include <bsd.own.mk> | ||
| 4 | |||
| 5 | MAN = \ | ||
| 6 | tls_accept_socket.3 \ | ||
| 7 | tls_client.3 \ | ||
| 8 | tls_config_ocsp_require_stapling.3 \ | ||
| 9 | tls_config_set_protocols.3 \ | ||
| 10 | tls_config_set_session_id.3 \ | ||
| 11 | tls_config_verify.3 \ | ||
| 12 | tls_conn_version.3 \ | ||
| 13 | tls_connect.3 \ | ||
| 14 | tls_init.3 \ | ||
| 15 | tls_load_file.3 \ | ||
| 16 | tls_ocsp_process_response.3 \ | ||
| 17 | tls_read.3 \ | ||
| 18 | |||
| 19 | all clean cleandir depend includes obj tags: | ||
| 20 | |||
| 21 | install: maninstall | ||
| 22 | |||
| 23 | .include <bsd.man.mk> | ||
diff --git a/src/lib/libtls/man/tls_accept_socket.3 b/src/lib/libtls/man/tls_accept_socket.3 deleted file mode 100644 index 931b9346ec..0000000000 --- a/src/lib/libtls/man/tls_accept_socket.3 +++ /dev/null | |||
| @@ -1,107 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_accept_socket.3,v 1.4 2018/05/26 12:35:26 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> | ||
| 4 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | ||
| 5 | .\" Copyright (c) 2016 Brent Cook <bcook@openbsd.org> | ||
| 6 | .\" | ||
| 7 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 8 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 9 | .\" copyright notice and this permission notice appear in all copies. | ||
| 10 | .\" | ||
| 11 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 12 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 13 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 14 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 15 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 18 | .\" | ||
| 19 | .Dd $Mdocdate: May 26 2018 $ | ||
| 20 | .Dt TLS_ACCEPT_SOCKET 3 | ||
| 21 | .Os | ||
| 22 | .Sh NAME | ||
| 23 | .Nm tls_accept_socket , | ||
| 24 | .Nm tls_accept_fds , | ||
| 25 | .Nm tls_accept_cbs | ||
| 26 | .Nd accept an incoming client connection in a TLS server | ||
| 27 | .Sh SYNOPSIS | ||
| 28 | .In tls.h | ||
| 29 | .Ft int | ||
| 30 | .Fo tls_accept_socket | ||
| 31 | .Fa "struct tls *tls" | ||
| 32 | .Fa "struct tls **cctx" | ||
| 33 | .Fa "int socket" | ||
| 34 | .Fc | ||
| 35 | .Ft int | ||
| 36 | .Fo tls_accept_fds | ||
| 37 | .Fa "struct tls *tls" | ||
| 38 | .Fa "struct tls **cctx" | ||
| 39 | .Fa "int fd_read" | ||
| 40 | .Fa "int fd_write" | ||
| 41 | .Fc | ||
| 42 | .Ft int | ||
| 43 | .Fo tls_accept_cbs | ||
| 44 | .Fa "struct tls *tls" | ||
| 45 | .Fa "struct tls **cctx" | ||
| 46 | .Fa "ssize_t (*tls_read_cb)(struct tls *ctx,\ | ||
| 47 | void *buf, size_t buflen, void *cb_arg)" | ||
| 48 | .Fa "ssize_t (*tls_write_cb)(struct tls *ctx,\ | ||
| 49 | const void *buf, size_t buflen, void *cb_arg)" | ||
| 50 | .Fa "void *cb_arg" | ||
| 51 | .Fc | ||
| 52 | .Sh DESCRIPTION | ||
| 53 | After creating a TLS server context | ||
| 54 | .Fa tls | ||
| 55 | with | ||
| 56 | .Xr tls_server 3 | ||
| 57 | and configuring it with | ||
| 58 | .Xr tls_configure 3 , | ||
| 59 | a server can accept a new client connection by calling | ||
| 60 | .Fn tls_accept_socket | ||
| 61 | on an already established socket connection. | ||
| 62 | .Pp | ||
| 63 | Alternatively, a new client connection can be accepted over a pair of existing | ||
| 64 | file descriptors by calling | ||
| 65 | .Fn tls_accept_fds . | ||
| 66 | .Pp | ||
| 67 | Calling | ||
| 68 | .Fn tls_accept_cbs | ||
| 69 | allows read and write callback functions to handle data transfers. | ||
| 70 | The specified | ||
| 71 | .Fa cb_arg | ||
| 72 | parameter is passed back to the functions, | ||
| 73 | and can contain a pointer to any caller-specified data. | ||
| 74 | .Pp | ||
| 75 | All these functions create a new context suitable for reading and writing | ||
| 76 | and return it in | ||
| 77 | .Pf * Fa cctx . | ||
| 78 | .Sh RETURN VALUES | ||
| 79 | These functions return 0 on success or -1 on error. | ||
| 80 | .Sh SEE ALSO | ||
| 81 | .Xr tls_close 3 , | ||
| 82 | .Xr tls_config_set_session_id 3 , | ||
| 83 | .Xr tls_configure 3 , | ||
| 84 | .Xr tls_connect 3 , | ||
| 85 | .Xr tls_init 3 , | ||
| 86 | .Xr tls_server 3 | ||
| 87 | .Sh HISTORY | ||
| 88 | .Fn tls_accept_socket | ||
| 89 | appeared in | ||
| 90 | .Ox 5.6 | ||
| 91 | and got its final name in | ||
| 92 | .Ox 5.7 . | ||
| 93 | .Pp | ||
| 94 | .Fn tls_accept_fds | ||
| 95 | appeared in | ||
| 96 | .Ox 5.8 | ||
| 97 | and | ||
| 98 | .Fn tls_accept_cbs | ||
| 99 | in | ||
| 100 | .Ox 6.1 . | ||
| 101 | .Sh AUTHORS | ||
| 102 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
| 103 | .Pp | ||
| 104 | .An -nosplit | ||
| 105 | .Fn tls_accept_cbs | ||
| 106 | was written by | ||
| 107 | .An Tobias Pape Aq Mt tobias@netshed.de . | ||
diff --git a/src/lib/libtls/man/tls_client.3 b/src/lib/libtls/man/tls_client.3 deleted file mode 100644 index 98f58d4c20..0000000000 --- a/src/lib/libtls/man/tls_client.3 +++ /dev/null | |||
| @@ -1,110 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_client.3,v 1.4 2017/08/12 03:41:48 jsing 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: August 12 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_reset , | ||
| 25 | .Nm tls_free | ||
| 26 | .Nd configure a TLS connection | ||
| 27 | .Sh SYNOPSIS | ||
| 28 | .In tls.h | ||
| 29 | .Ft struct tls * | ||
| 30 | .Fn tls_client void | ||
| 31 | .Ft struct tls * | ||
| 32 | .Fn tls_server void | ||
| 33 | .Ft int | ||
| 34 | .Fo tls_configure | ||
| 35 | .Fa "struct tls *ctx" | ||
| 36 | .Fa "struct tls_config *config" | ||
| 37 | .Fc | ||
| 38 | .Ft void | ||
| 39 | .Fn tls_free "struct tls *ctx" | ||
| 40 | .Ft void | ||
| 41 | .Fn tls_reset "struct tls *ctx" | ||
| 42 | .Sh DESCRIPTION | ||
| 43 | A TLS connection is represented as a | ||
| 44 | .Vt struct tls | ||
| 45 | object called a | ||
| 46 | .Dq context . | ||
| 47 | A new context is created by either the | ||
| 48 | .Fn tls_client | ||
| 49 | or | ||
| 50 | .Fn tls_server | ||
| 51 | functions. | ||
| 52 | .Fn tls_client | ||
| 53 | is used in TLS client programs, | ||
| 54 | .Fn tls_server | ||
| 55 | in TLS server programs. | ||
| 56 | .Pp | ||
| 57 | The context can then be configured with the function | ||
| 58 | .Fn tls_configure . | ||
| 59 | The same | ||
| 60 | .Vt tls_config | ||
| 61 | object can be used to configure multiple contexts. | ||
| 62 | .Pp | ||
| 63 | After configuration, | ||
| 64 | .Xr tls_connect 3 | ||
| 65 | can be called on objects created with | ||
| 66 | .Fn tls_client , | ||
| 67 | and | ||
| 68 | .Xr tls_accept_socket 3 | ||
| 69 | on objects created with | ||
| 70 | .Fn tls_server . | ||
| 71 | .Pp | ||
| 72 | After use, a TLS context should be closed with | ||
| 73 | .Xr tls_close 3 , | ||
| 74 | and then freed by calling | ||
| 75 | .Fn tls_free . | ||
| 76 | If | ||
| 77 | .Fn tls_free | ||
| 78 | is called with an argument of | ||
| 79 | .Dv NULL , | ||
| 80 | no action occurs. | ||
| 81 | .Pp | ||
| 82 | A TLS context can be reset by calling | ||
| 83 | .Fn tls_reset , | ||
| 84 | allowing for it to be reused. | ||
| 85 | This is essentially equivalent to calling | ||
| 86 | .Fn tls_free , | ||
| 87 | followed by a call to the same function that was used to originally allocate | ||
| 88 | the TLS context. | ||
| 89 | .Sh RETURN VALUES | ||
| 90 | .Fn tls_client | ||
| 91 | and | ||
| 92 | .Fn tls_server | ||
| 93 | return | ||
| 94 | .Dv NULL | ||
| 95 | on error or an out of memory condition. | ||
| 96 | .Pp | ||
| 97 | .Fn tls_configure | ||
| 98 | returns 0 on success or -1 on error. | ||
| 99 | .Sh SEE ALSO | ||
| 100 | .Xr tls_accept_socket 3 , | ||
| 101 | .Xr tls_config_new 3 , | ||
| 102 | .Xr tls_connect 3 , | ||
| 103 | .Xr tls_init 3 | ||
| 104 | .Sh HISTORY | ||
| 105 | These functions appeared in | ||
| 106 | .Ox 5.6 | ||
| 107 | and got their final names in | ||
| 108 | .Ox 5.7 . | ||
| 109 | .Sh AUTHORS | ||
| 110 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
diff --git a/src/lib/libtls/man/tls_config_ocsp_require_stapling.3 b/src/lib/libtls/man/tls_config_ocsp_require_stapling.3 deleted file mode 100644 index a0694d304f..0000000000 --- a/src/lib/libtls/man/tls_config_ocsp_require_stapling.3 +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_config_ocsp_require_stapling.3,v 1.5 2017/01/31 20:53:50 jmc Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2016 Bob Beck <beck@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 31 2017 $ | ||
| 18 | .Dt TLS_CONFIG_OCSP_REQUIRE_STAPLING 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm tls_config_ocsp_require_stapling | ||
| 22 | .Nd OCSP configuration for libtls | ||
| 23 | .Sh SYNOPSIS | ||
| 24 | .In tls.h | ||
| 25 | .Ft void | ||
| 26 | .Fn tls_config_ocsp_require_stapling "struct tls_config *config" | ||
| 27 | .Sh DESCRIPTION | ||
| 28 | .Fn tls_config_ocsp_require_stapling | ||
| 29 | requires that a valid stapled OCSP response be provided | ||
| 30 | during the TLS handshake. | ||
| 31 | .Sh SEE ALSO | ||
| 32 | .Xr tls_config_add_keypair_file 3 , | ||
| 33 | .Xr tls_handshake 3 , | ||
| 34 | .Xr tls_init 3 , | ||
| 35 | .Xr tls_ocsp_process_response 3 | ||
| 36 | .Sh HISTORY | ||
| 37 | These functions appeared in | ||
| 38 | .Ox 6.1 . | ||
| 39 | .Sh AUTHORS | ||
| 40 | .An Bob Beck Aq Mt beck@openbsd.org | ||
diff --git a/src/lib/libtls/man/tls_config_set_protocols.3 b/src/lib/libtls/man/tls_config_set_protocols.3 deleted file mode 100644 index 32b8cce757..0000000000 --- a/src/lib/libtls/man/tls_config_set_protocols.3 +++ /dev/null | |||
| @@ -1,229 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_config_set_protocols.3,v 1.12 2023/07/02 06:37:27 beck Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | ||
| 4 | .\" Copyright (c) 2015, 2016 Joel Sing <jsing@openbsd.org> | ||
| 5 | .\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> | ||
| 6 | .\" | ||
| 7 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 8 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 9 | .\" copyright notice and this permission notice appear in all copies. | ||
| 10 | .\" | ||
| 11 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 12 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 13 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 14 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 15 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 18 | .\" | ||
| 19 | .Dd $Mdocdate: July 2 2023 $ | ||
| 20 | .Dt TLS_CONFIG_SET_PROTOCOLS 3 | ||
| 21 | .Os | ||
| 22 | .Sh NAME | ||
| 23 | .Nm tls_config_set_protocols , | ||
| 24 | .Nm tls_config_parse_protocols , | ||
| 25 | .Nm tls_config_set_alpn , | ||
| 26 | .Nm tls_config_set_ciphers , | ||
| 27 | .Nm tls_config_set_dheparams , | ||
| 28 | .Nm tls_config_set_ecdhecurves , | ||
| 29 | .Nm tls_config_prefer_ciphers_client , | ||
| 30 | .Nm tls_config_prefer_ciphers_server | ||
| 31 | .Nd TLS protocol and cipher selection | ||
| 32 | .Sh SYNOPSIS | ||
| 33 | .In tls.h | ||
| 34 | .Ft int | ||
| 35 | .Fo tls_config_set_protocols | ||
| 36 | .Fa "struct tls_config *config" | ||
| 37 | .Fa "uint32_t protocols" | ||
| 38 | .Fc | ||
| 39 | .Ft int | ||
| 40 | .Fo tls_config_parse_protocols | ||
| 41 | .Fa "uint32_t *protocols" | ||
| 42 | .Fa "const char *protostr" | ||
| 43 | .Fc | ||
| 44 | .Ft int | ||
| 45 | .Fo tls_config_set_alpn | ||
| 46 | .Fa "struct tls_config *config" | ||
| 47 | .Fa "const char *alpn" | ||
| 48 | .Fc | ||
| 49 | .Ft int | ||
| 50 | .Fo tls_config_set_ciphers | ||
| 51 | .Fa "struct tls_config *config" | ||
| 52 | .Fa "const char *ciphers" | ||
| 53 | .Fc | ||
| 54 | .Ft int | ||
| 55 | .Fo tls_config_set_dheparams | ||
| 56 | .Fa "struct tls_config *config" | ||
| 57 | .Fa "const char *params" | ||
| 58 | .Fc | ||
| 59 | .Ft int | ||
| 60 | .Fo tls_config_set_ecdhecurves | ||
| 61 | .Fa "struct tls_config *config" | ||
| 62 | .Fa "const char *curves" | ||
| 63 | .Fc | ||
| 64 | .Ft void | ||
| 65 | .Fn tls_config_prefer_ciphers_client "struct tls_config *config" | ||
| 66 | .Ft void | ||
| 67 | .Fn tls_config_prefer_ciphers_server "struct tls_config *config" | ||
| 68 | .Sh DESCRIPTION | ||
| 69 | These functions modify a configuration by setting parameters. | ||
| 70 | The configuration options apply to both clients and servers, unless noted | ||
| 71 | otherwise. | ||
| 72 | .Pp | ||
| 73 | .Fn tls_config_set_protocols | ||
| 74 | specifies which versions of the TLS protocol may be used. | ||
| 75 | Possible values are the bitwise OR of: | ||
| 76 | .Pp | ||
| 77 | .Bl -item -offset indent -compact | ||
| 78 | .It | ||
| 79 | .Dv TLS_PROTOCOL_TLSv1_2 | ||
| 80 | .It | ||
| 81 | .Dv TLS_PROTOCOL_TLSv1_3 | ||
| 82 | .El | ||
| 83 | .Pp | ||
| 84 | Additionally, the values | ||
| 85 | .Dv TLS_PROTOCOL_TLSv1 | ||
| 86 | (TLSv1.2, TLSv1.3), | ||
| 87 | .Dv TLS_PROTOCOLS_ALL | ||
| 88 | (all supported protocols) and | ||
| 89 | .Dv TLS_PROTOCOLS_DEFAULT | ||
| 90 | (TLSv1.2 and TLSv1.3) may be used. | ||
| 91 | .Pp | ||
| 92 | The | ||
| 93 | .Fn tls_config_parse_protocols | ||
| 94 | utility function parses a protocol string and returns the corresponding | ||
| 95 | value via the | ||
| 96 | .Ar protocols | ||
| 97 | argument. | ||
| 98 | This value can then be passed to the | ||
| 99 | .Fn tls_config_set_protocols | ||
| 100 | function. | ||
| 101 | The protocol string is a comma or colon separated list of keywords. | ||
| 102 | Valid keywords are: | ||
| 103 | .Pp | ||
| 104 | .Bl -tag -width "tlsv1.3" -offset indent -compact | ||
| 105 | .It Dv tlsv1.2 | ||
| 106 | .It Dv tlsv1.3 | ||
| 107 | .It Dv all | ||
| 108 | .Pq all supported protocols | ||
| 109 | .It Dv default | ||
| 110 | .Pq an alias for Dv secure | ||
| 111 | .It Dv legacy | ||
| 112 | .Pq an alias for Dv all | ||
| 113 | .It Dv secure | ||
| 114 | .Pq currently TLSv1.2 and TLSv1.3 | ||
| 115 | .El | ||
| 116 | .Pp | ||
| 117 | If a value has a negative prefix (in the form of a leading exclamation mark) | ||
| 118 | then it is removed from the list of available protocols, rather than being | ||
| 119 | added to it. | ||
| 120 | .Pp | ||
| 121 | .Fn tls_config_set_alpn | ||
| 122 | sets the ALPN protocols that are supported. | ||
| 123 | The alpn string is a comma separated list of protocols, in order of preference. | ||
| 124 | .Pp | ||
| 125 | .Fn tls_config_set_ciphers | ||
| 126 | sets the list of ciphers that may be used. | ||
| 127 | Lists of ciphers are specified by name, and the | ||
| 128 | permitted names are: | ||
| 129 | .Pp | ||
| 130 | .Bl -item -offset indent -compact | ||
| 131 | .It | ||
| 132 | .Dv secure Pq or alias Dv default | ||
| 133 | .It | ||
| 134 | .Dv compat | ||
| 135 | .It | ||
| 136 | .Dv legacy | ||
| 137 | .It | ||
| 138 | .Dv insecure Pq or alias Dv all | ||
| 139 | .El | ||
| 140 | .Pp | ||
| 141 | Alternatively, libssl cipher strings can be specified. | ||
| 142 | See the CIPHERS section of | ||
| 143 | .Xr openssl 1 | ||
| 144 | for further information. | ||
| 145 | .Pp | ||
| 146 | .Fn tls_config_set_dheparams | ||
| 147 | specifies the parameters that will be used during Diffie-Hellman Ephemeral | ||
| 148 | (DHE) key exchange. | ||
| 149 | Possible values are: | ||
| 150 | .Pp | ||
| 151 | .Bl -item -offset indent -compact | ||
| 152 | .It | ||
| 153 | .Dv none | ||
| 154 | .It | ||
| 155 | .Dv auto | ||
| 156 | .It | ||
| 157 | .Dv legacy | ||
| 158 | .El | ||
| 159 | .Pp | ||
| 160 | In | ||
| 161 | .Dv auto | ||
| 162 | mode, the key size for the ephemeral key is automatically selected | ||
| 163 | based on the size of the private key being used for signing. | ||
| 164 | In | ||
| 165 | .Dv legacy | ||
| 166 | mode, 1024 bit ephemeral keys are used. | ||
| 167 | The default value is | ||
| 168 | .Dv none , | ||
| 169 | which disables DHE key exchange. | ||
| 170 | .Pp | ||
| 171 | .Fn tls_config_set_ecdhecurves | ||
| 172 | specifies the names of the elliptic curves that may be used during Elliptic | ||
| 173 | Curve Diffie-Hellman Ephemeral (ECDHE) key exchange. | ||
| 174 | This is a comma separated list, given in order of preference. | ||
| 175 | The special value of "default" will use the default curves (currently X25519, | ||
| 176 | P-256 and P-384). | ||
| 177 | This function replaces | ||
| 178 | .Fn tls_config_set_ecdhecurve , | ||
| 179 | which is deprecated. | ||
| 180 | .Pp | ||
| 181 | .Fn tls_config_prefer_ciphers_client | ||
| 182 | prefers ciphers in the client's cipher list when selecting a cipher suite | ||
| 183 | (server only). | ||
| 184 | This is considered to be less secure than preferring the server's list. | ||
| 185 | .Pp | ||
| 186 | .Fn tls_config_prefer_ciphers_server | ||
| 187 | prefers ciphers in the server's cipher list when selecting a cipher suite | ||
| 188 | (server only). | ||
| 189 | This is considered to be more secure than preferring the client's list and is | ||
| 190 | the default. | ||
| 191 | .Sh RETURN VALUES | ||
| 192 | These functions return 0 on success or -1 on error. | ||
| 193 | .Sh SEE ALSO | ||
| 194 | .Xr tls_config_ocsp_require_stapling 3 , | ||
| 195 | .Xr tls_config_set_session_id 3 , | ||
| 196 | .Xr tls_config_verify 3 , | ||
| 197 | .Xr tls_init 3 , | ||
| 198 | .Xr tls_load_file 3 | ||
| 199 | .Sh HISTORY | ||
| 200 | .Fn tls_config_set_ciphers | ||
| 201 | appeared in | ||
| 202 | .Ox 5.6 | ||
| 203 | and got its final name in | ||
| 204 | .Ox 5.7 . | ||
| 205 | .Pp | ||
| 206 | .Fn tls_config_set_protocols , | ||
| 207 | .Fn tls_config_parse_protocols , | ||
| 208 | .Fn tls_config_set_dheparams , | ||
| 209 | and | ||
| 210 | .Fn tls_config_set_ecdhecurve | ||
| 211 | appeared in | ||
| 212 | .Ox 5.7 , | ||
| 213 | .Fn tls_config_prefer_ciphers_client | ||
| 214 | and | ||
| 215 | .Fn tls_config_prefer_ciphers_server | ||
| 216 | in | ||
| 217 | .Ox 5.9 , | ||
| 218 | and | ||
| 219 | .Fn tls_config_set_alpn | ||
| 220 | in | ||
| 221 | .Ox 6.1 . | ||
| 222 | .Sh AUTHORS | ||
| 223 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
| 224 | with contributions from | ||
| 225 | .An Ted Unangst Aq Mt tedu@openbsd.org | ||
| 226 | .Pq Fn tls_config_set_ciphers | ||
| 227 | and | ||
| 228 | .An Reyk Floeter Aq Mt reyk@openbsd.org | ||
| 229 | .Pq Fn tls_config_set_ecdhecurve | ||
diff --git a/src/lib/libtls/man/tls_config_set_session_id.3 b/src/lib/libtls/man/tls_config_set_session_id.3 deleted file mode 100644 index d969e01e33..0000000000 --- a/src/lib/libtls/man/tls_config_set_session_id.3 +++ /dev/null | |||
| @@ -1,105 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_config_set_session_id.3,v 1.5 2018/02/10 06:07:43 jsing Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2017 Claudio Jeker <claudio@openbsd.org> | ||
| 4 | .\" Copyright (c) 2018 Joel Sing <jsing@openbsd.org> | ||
| 5 | .\" | ||
| 6 | .\" 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 | .\" copyright notice and this permission notice appear in all copies. | ||
| 9 | .\" | ||
| 10 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | .\" | ||
| 18 | .Dd $Mdocdate: February 10 2018 $ | ||
| 19 | .Dt TLS_CONFIG_SET_SESSION_ID 3 | ||
| 20 | .Os | ||
| 21 | .Sh NAME | ||
| 22 | .Nm tls_config_set_session_fd , | ||
| 23 | .Nm tls_config_set_session_id , | ||
| 24 | .Nm tls_config_set_session_lifetime , | ||
| 25 | .Nm tls_config_add_ticket_key | ||
| 26 | .Nd configure resuming of TLS handshakes | ||
| 27 | .Sh SYNOPSIS | ||
| 28 | .In tls.h | ||
| 29 | .Ft int | ||
| 30 | .Fo tls_config_set_session_fd | ||
| 31 | .Fa "struct tls_config *config" | ||
| 32 | .Fa "int session_fd" | ||
| 33 | .Fc | ||
| 34 | .Ft int | ||
| 35 | .Fo tls_config_set_session_id | ||
| 36 | .Fa "struct tls_config *config" | ||
| 37 | .Fa "const unsigned char *session_id" | ||
| 38 | .Fa "size_t len" | ||
| 39 | .Fc | ||
| 40 | .Ft int | ||
| 41 | .Fo tls_config_set_session_lifetime | ||
| 42 | .Fa "struct tls_config *config" | ||
| 43 | .Fa "int lifetime" | ||
| 44 | .Fc | ||
| 45 | .Ft int | ||
| 46 | .Fo tls_config_add_ticket_key | ||
| 47 | .Fa "struct tls_config *config" | ||
| 48 | .Fa "uint32_t keyrev" | ||
| 49 | .Fa "unsigned char *key" | ||
| 50 | .Fa "size_t keylen" | ||
| 51 | .Fc | ||
| 52 | .Sh DESCRIPTION | ||
| 53 | .Fn tls_config_set_session_fd | ||
| 54 | sets a file descriptor to be used to manage data for TLS sessions (client only). | ||
| 55 | The given file descriptor must be a regular file and be owned by the current | ||
| 56 | user, with permissions being restricted to only allow the owner to read and | ||
| 57 | write the file (0600). | ||
| 58 | If the file has a non-zero length, the client will attempt to read session | ||
| 59 | data from this file and resume the previous TLS session with the server. | ||
| 60 | Upon a successful handshake the file will be updated with current session | ||
| 61 | data, if available. | ||
| 62 | The caller is responsible for closing this file descriptor, after all TLS | ||
| 63 | contexts that have been configured to use it have been freed via | ||
| 64 | .Fn tls_free . | ||
| 65 | .Pp | ||
| 66 | .Fn tls_config_set_session_id | ||
| 67 | sets the session identifier that will be used by the TLS server when | ||
| 68 | sessions are enabled (server only). | ||
| 69 | By default a random value is used. | ||
| 70 | .Pp | ||
| 71 | .Fn tls_config_set_session_lifetime | ||
| 72 | sets the lifetime to be used for TLS sessions (server only). | ||
| 73 | Session support is disabled if a lifetime of zero is specified, which is the | ||
| 74 | default. | ||
| 75 | .Pp | ||
| 76 | .Fn tls_config_add_ticket_key | ||
| 77 | adds a key used for the encryption and authentication of TLS tickets | ||
| 78 | (server only). | ||
| 79 | By default keys are generated and rotated automatically based on their lifetime. | ||
| 80 | This function should only be used to synchronise ticket encryption key across | ||
| 81 | multiple processes. | ||
| 82 | Re-adding a known key will result in an error, unless it is the most recently | ||
| 83 | added key. | ||
| 84 | .Sh RETURN VALUES | ||
| 85 | These functions return 0 on success or -1 on error. | ||
| 86 | .Sh SEE ALSO | ||
| 87 | .Xr tls_accept_socket 3 , | ||
| 88 | .Xr tls_config_set_protocols 3 , | ||
| 89 | .Xr tls_init 3 , | ||
| 90 | .Xr tls_load_file 3 , | ||
| 91 | .Xr tls_server 3 | ||
| 92 | .Sh HISTORY | ||
| 93 | .Fn tls_config_set_session_id , | ||
| 94 | .Fn tls_config_set_session_lifetime | ||
| 95 | and | ||
| 96 | .Fn tls_config_add_ticket_key | ||
| 97 | appeared in | ||
| 98 | .Ox 6.1 . | ||
| 99 | .Pp | ||
| 100 | .Fn tls_config_set_session_fd | ||
| 101 | appeared in | ||
| 102 | .Ox 6.3 . | ||
| 103 | .Sh AUTHORS | ||
| 104 | .An Claudio Jeker Aq Mt claudio@openbsd.org | ||
| 105 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
diff --git a/src/lib/libtls/man/tls_config_verify.3 b/src/lib/libtls/man/tls_config_verify.3 deleted file mode 100644 index 4a43c834d7..0000000000 --- a/src/lib/libtls/man/tls_config_verify.3 +++ /dev/null | |||
| @@ -1,79 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_config_verify.3,v 1.4 2017/03/02 11:05:50 jmc Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | ||
| 4 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | ||
| 5 | .\" | ||
| 6 | .\" 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 | .\" copyright notice and this permission notice appear in all copies. | ||
| 9 | .\" | ||
| 10 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | .\" | ||
| 18 | .Dd $Mdocdate: March 2 2017 $ | ||
| 19 | .Dt TLS_CONFIG_VERIFY 3 | ||
| 20 | .Os | ||
| 21 | .Sh NAME | ||
| 22 | .Nm tls_config_verify , | ||
| 23 | .Nm tls_config_insecure_noverifycert , | ||
| 24 | .Nm tls_config_insecure_noverifyname , | ||
| 25 | .Nm tls_config_insecure_noverifytime | ||
| 26 | .Nd insecure TLS configuration | ||
| 27 | .Sh SYNOPSIS | ||
| 28 | .In tls.h | ||
| 29 | .Ft void | ||
| 30 | .Fn tls_config_verify "struct tls_config *config" | ||
| 31 | .Ft void | ||
| 32 | .Fn tls_config_insecure_noverifycert "struct tls_config *config" | ||
| 33 | .Ft void | ||
| 34 | .Fn tls_config_insecure_noverifyname "struct tls_config *config" | ||
| 35 | .Ft void | ||
| 36 | .Fn tls_config_insecure_noverifytime "struct tls_config *config" | ||
| 37 | .Sh DESCRIPTION | ||
| 38 | These functions disable parts of the normal certificate verification | ||
| 39 | process, resulting in insecure configurations. | ||
| 40 | Be very careful when using them. | ||
| 41 | .Pp | ||
| 42 | .Fn tls_config_insecure_noverifycert | ||
| 43 | disables certificate verification and OCSP validation. | ||
| 44 | .Pp | ||
| 45 | .Fn tls_config_insecure_noverifyname | ||
| 46 | disables server name verification (client only). | ||
| 47 | .Pp | ||
| 48 | .Fn tls_config_insecure_noverifytime | ||
| 49 | disables validity checking of certificates and OCSP validation. | ||
| 50 | .Pp | ||
| 51 | .Fn tls_config_verify | ||
| 52 | reenables server name and certificate verification. | ||
| 53 | .Sh SEE ALSO | ||
| 54 | .Xr tls_client 3 , | ||
| 55 | .Xr tls_config_ocsp_require_stapling 3 , | ||
| 56 | .Xr tls_config_set_protocols 3 , | ||
| 57 | .Xr tls_conn_version 3 , | ||
| 58 | .Xr tls_connect 3 , | ||
| 59 | .Xr tls_handshake 3 , | ||
| 60 | .Xr tls_init 3 | ||
| 61 | .Sh HISTORY | ||
| 62 | .Fn tls_config_verify | ||
| 63 | appeared in | ||
| 64 | .Ox 5.6 | ||
| 65 | and got its final name in | ||
| 66 | .Ox 5.7 . | ||
| 67 | .Pp | ||
| 68 | .Fn tls_config_insecure_noverifycert | ||
| 69 | and | ||
| 70 | .Fn tls_config_insecure_noverifyname | ||
| 71 | appeared in | ||
| 72 | .Ox 5.7 | ||
| 73 | and | ||
| 74 | .Nm tls_config_insecure_noverifytime | ||
| 75 | in | ||
| 76 | .Ox 5.9 . | ||
| 77 | .Sh AUTHORS | ||
| 78 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
| 79 | .An Ted Unangst Aq Mt tedu@openbsd.org | ||
diff --git a/src/lib/libtls/man/tls_conn_version.3 b/src/lib/libtls/man/tls_conn_version.3 deleted file mode 100644 index 8fb30624d7..0000000000 --- a/src/lib/libtls/man/tls_conn_version.3 +++ /dev/null | |||
| @@ -1,225 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_conn_version.3,v 1.11 2024/12/10 08:42:12 tb Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> | ||
| 4 | .\" Copyright (c) 2016, 2018 Joel Sing <jsing@openbsd.org> | ||
| 5 | .\" | ||
| 6 | .\" 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 | .\" copyright notice and this permission notice appear in all copies. | ||
| 9 | .\" | ||
| 10 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | .\" | ||
| 18 | .Dd $Mdocdate: December 10 2024 $ | ||
| 19 | .Dt TLS_CONN_VERSION 3 | ||
| 20 | .Os | ||
| 21 | .Sh NAME | ||
| 22 | .Nm tls_conn_version , | ||
| 23 | .Nm tls_conn_cipher , | ||
| 24 | .Nm tls_conn_cipher_strength , | ||
| 25 | .Nm tls_conn_alpn_selected , | ||
| 26 | .Nm tls_conn_servername , | ||
| 27 | .Nm tls_conn_session_resumed , | ||
| 28 | .Nm tls_peer_cert_provided , | ||
| 29 | .Nm tls_peer_cert_contains_name , | ||
| 30 | .Nm tls_peer_cert_chain_pem , | ||
| 31 | .Nm tls_peer_cert_issuer , | ||
| 32 | .Nm tls_peer_cert_subject , | ||
| 33 | .Nm tls_peer_cert_common_name , | ||
| 34 | .Nm tls_peer_cert_hash , | ||
| 35 | .Nm tls_peer_cert_notbefore , | ||
| 36 | .Nm tls_peer_cert_notafter | ||
| 37 | .Nd inspect an established TLS connection | ||
| 38 | .Sh SYNOPSIS | ||
| 39 | .In tls.h | ||
| 40 | .Ft const char * | ||
| 41 | .Fn tls_conn_version "struct tls *ctx" | ||
| 42 | .Ft const char * | ||
| 43 | .Fn tls_conn_cipher "struct tls *ctx" | ||
| 44 | .Ft int | ||
| 45 | .Fn tls_conn_cipher_strength "struct tls *ctx" | ||
| 46 | .Ft const char * | ||
| 47 | .Fn tls_conn_alpn_selected "struct tls *ctx" | ||
| 48 | .Ft const char * | ||
| 49 | .Fn tls_conn_servername "struct tls *ctx" | ||
| 50 | .Ft int | ||
| 51 | .Fn tls_conn_session_resumed "struct tls *ctx" | ||
| 52 | .Ft int | ||
| 53 | .Fn tls_peer_cert_provided "struct tls *ctx" | ||
| 54 | .Ft int | ||
| 55 | .Fo tls_peer_cert_contains_name | ||
| 56 | .Fa "struct tls *ctx" | ||
| 57 | .Fa "const char *name" | ||
| 58 | .Fc | ||
| 59 | .Ft const uint8_t * | ||
| 60 | .Fo tls_peer_cert_chain_pem | ||
| 61 | .Fa "struct tls *ctx" | ||
| 62 | .Fa "size_t *size" | ||
| 63 | .Fc | ||
| 64 | .Ft const char * | ||
| 65 | .Fn tls_peer_cert_issuer "struct tls *ctx" | ||
| 66 | .Ft const char * | ||
| 67 | .Fn tls_peer_cert_subject "struct tls *ctx" | ||
| 68 | .Ft const char * | ||
| 69 | .Fn tls_peer_cert_common_name "struct tls *ctx" | ||
| 70 | .Ft const char * | ||
| 71 | .Fn tls_peer_cert_hash "struct tls *ctx" | ||
| 72 | .Ft time_t | ||
| 73 | .Fn tls_peer_cert_notbefore "struct tls *ctx" | ||
| 74 | .Ft time_t | ||
| 75 | .Fn tls_peer_cert_notafter "struct tls *ctx" | ||
| 76 | .Sh DESCRIPTION | ||
| 77 | These functions return information about a TLS connection and will only | ||
| 78 | succeed after the handshake is complete (the connection information applies | ||
| 79 | to both clients and servers, unless noted otherwise): | ||
| 80 | .Pp | ||
| 81 | .Fn tls_conn_version | ||
| 82 | returns a string corresponding to a TLS version negotiated with the peer | ||
| 83 | connected to | ||
| 84 | .Ar ctx . | ||
| 85 | .Pp | ||
| 86 | .Fn tls_conn_cipher | ||
| 87 | returns a string corresponding to the cipher suite negotiated with the peer | ||
| 88 | connected to | ||
| 89 | .Ar ctx . | ||
| 90 | .Pp | ||
| 91 | .Fn tls_conn_cipher_strength | ||
| 92 | returns the strength in bits for the symmetric cipher that is being | ||
| 93 | used with the peer connected to | ||
| 94 | .Ar ctx . | ||
| 95 | .Pp | ||
| 96 | .Fn tls_conn_alpn_selected | ||
| 97 | returns a string that specifies the ALPN protocol selected for use with the peer | ||
| 98 | connected to | ||
| 99 | .Ar ctx . | ||
| 100 | If no protocol was selected then NULL is returned. | ||
| 101 | .Pp | ||
| 102 | .Fn tls_conn_servername | ||
| 103 | returns a string corresponding to the servername that the client connected to | ||
| 104 | .Ar ctx | ||
| 105 | requested by sending a TLS Server Name Indication extension (server only). | ||
| 106 | .Pp | ||
| 107 | .Fn tls_conn_session_resumed | ||
| 108 | indicates whether a TLS session has been resumed during the handshake with | ||
| 109 | the server connected to | ||
| 110 | .Ar ctx | ||
| 111 | (client only). | ||
| 112 | .Pp | ||
| 113 | .Fn tls_peer_cert_provided | ||
| 114 | checks if the peer of | ||
| 115 | .Ar ctx | ||
| 116 | has provided a certificate. | ||
| 117 | .Pp | ||
| 118 | .Fn tls_peer_cert_contains_name | ||
| 119 | checks if the peer of a TLS | ||
| 120 | .Ar ctx | ||
| 121 | has provided a certificate that contains a | ||
| 122 | SAN or CN that matches | ||
| 123 | .Ar name . | ||
| 124 | .Pp | ||
| 125 | .Fn tls_peer_cert_chain_pem | ||
| 126 | returns a pointer to memory containing a PEM-encoded certificate chain for the | ||
| 127 | peer certificate from | ||
| 128 | .Ar ctx . | ||
| 129 | .Pp | ||
| 130 | .Fn tls_peer_cert_subject | ||
| 131 | returns a string | ||
| 132 | corresponding to the subject of the peer certificate from | ||
| 133 | .Ar ctx . | ||
| 134 | .Pp | ||
| 135 | .Fn tls_peer_cert_issuer | ||
| 136 | returns a string | ||
| 137 | corresponding to the issuer of the peer certificate from | ||
| 138 | .Ar ctx . | ||
| 139 | .Fn tls_peer_cert_common_name | ||
| 140 | returns a string | ||
| 141 | corresponding to the common name of the peer certificate from | ||
| 142 | .Ar ctx | ||
| 143 | or the empty string if no common name is present. | ||
| 144 | .Pp | ||
| 145 | .Fn tls_peer_cert_hash | ||
| 146 | returns a string | ||
| 147 | corresponding to a hash of the raw peer certificate from | ||
| 148 | .Ar ctx | ||
| 149 | prefixed by a hash name followed by a colon. | ||
| 150 | The hash currently used is SHA256, though this | ||
| 151 | could change in the future. | ||
| 152 | The hash string for a certificate in file | ||
| 153 | .Ar mycert.crt | ||
| 154 | can be generated using the commands: | ||
| 155 | .Bd -literal -offset indent | ||
| 156 | h=$(openssl x509 -outform der -in mycert.crt | sha256) | ||
| 157 | printf "SHA256:${h}\\n" | ||
| 158 | .Ed | ||
| 159 | .Pp | ||
| 160 | .Fn tls_peer_cert_notbefore | ||
| 161 | returns the time corresponding to the start of the validity period of | ||
| 162 | the peer certificate from | ||
| 163 | .Ar ctx . | ||
| 164 | .Pp | ||
| 165 | .Fn tls_peer_cert_notafter | ||
| 166 | returns the time corresponding to the end of the validity period of | ||
| 167 | the peer certificate from | ||
| 168 | .Ar ctx . | ||
| 169 | .Sh RETURN VALUES | ||
| 170 | The | ||
| 171 | .Fn tls_conn_session_resumed | ||
| 172 | function returns 1 if a TLS session was resumed or 0 if it was not. | ||
| 173 | .Pp | ||
| 174 | The | ||
| 175 | .Fn tls_peer_cert_provided | ||
| 176 | and | ||
| 177 | .Fn tls_peer_cert_contains_name | ||
| 178 | functions return 1 if the check succeeds or 0 if it does not. | ||
| 179 | .Pp | ||
| 180 | .Fn tls_peer_cert_notbefore | ||
| 181 | and | ||
| 182 | .Fn tls_peer_cert_notafter | ||
| 183 | return a time in epoch-seconds on success or -1 on error. | ||
| 184 | .Pp | ||
| 185 | The functions that return a pointer return | ||
| 186 | .Dv NULL | ||
| 187 | on error or an out of memory condition. | ||
| 188 | .Sh SEE ALSO | ||
| 189 | .Xr tls_configure 3 , | ||
| 190 | .Xr tls_handshake 3 , | ||
| 191 | .Xr tls_init 3 , | ||
| 192 | .Xr tls_ocsp_process_response 3 | ||
| 193 | .Sh HISTORY | ||
| 194 | .Fn tls_conn_version , | ||
| 195 | .Fn tls_conn_cipher , | ||
| 196 | .Fn tls_peer_cert_provided , | ||
| 197 | .Fn tls_peer_cert_contains_name , | ||
| 198 | .Fn tls_peer_cert_issuer , | ||
| 199 | .Fn tls_peer_cert_subject , | ||
| 200 | .Fn tls_peer_cert_hash , | ||
| 201 | .Fn tls_peer_cert_notbefore , | ||
| 202 | and | ||
| 203 | .Fn tls_peer_cert_notafter | ||
| 204 | appeared in | ||
| 205 | .Ox 5.9 . | ||
| 206 | .Pp | ||
| 207 | .Fn tls_conn_servername | ||
| 208 | and | ||
| 209 | .Fn tls_conn_alpn_selected | ||
| 210 | appeared in | ||
| 211 | .Ox 6.1 . | ||
| 212 | .Pp | ||
| 213 | .Fn tls_conn_session_resumed | ||
| 214 | appeared in | ||
| 215 | .Ox 6.3 . | ||
| 216 | .Pp | ||
| 217 | .Fn tls_conn_cipher_strength | ||
| 218 | appeared in | ||
| 219 | .Ox 6.7 . | ||
| 220 | .Fn tls_peer_cert_common_name | ||
| 221 | appeared in | ||
| 222 | .Ox 7.7 . | ||
| 223 | .Sh AUTHORS | ||
| 224 | .An Bob Beck Aq Mt beck@openbsd.org | ||
| 225 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
diff --git a/src/lib/libtls/man/tls_connect.3 b/src/lib/libtls/man/tls_connect.3 deleted file mode 100644 index 4c4f01c256..0000000000 --- a/src/lib/libtls/man/tls_connect.3 +++ /dev/null | |||
| @@ -1,144 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_connect.3,v 1.4 2018/07/09 19:51:18 tb Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | ||
| 4 | .\" Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> | ||
| 5 | .\" Copyright (c) 2016 Brent Cook <bcook@openbsd.org> | ||
| 6 | .\" | ||
| 7 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 8 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 9 | .\" copyright notice and this permission notice appear in all copies. | ||
| 10 | .\" | ||
| 11 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 12 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 13 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 14 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 15 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 18 | .\" | ||
| 19 | .Dd $Mdocdate: July 9 2018 $ | ||
| 20 | .Dt TLS_CONNECT 3 | ||
| 21 | .Os | ||
| 22 | .Sh NAME | ||
| 23 | .Nm tls_connect , | ||
| 24 | .Nm tls_connect_fds , | ||
| 25 | .Nm tls_connect_servername , | ||
| 26 | .Nm tls_connect_socket , | ||
| 27 | .Nm tls_connect_cbs | ||
| 28 | .Nd instruct a TLS client to establish a connection | ||
| 29 | .Sh SYNOPSIS | ||
| 30 | .In tls.h | ||
| 31 | .Ft int | ||
| 32 | .Fo tls_connect | ||
| 33 | .Fa "struct tls *ctx" | ||
| 34 | .Fa "const char *host" | ||
| 35 | .Fa "const char *port" | ||
| 36 | .Fc | ||
| 37 | .Ft int | ||
| 38 | .Fo tls_connect_fds | ||
| 39 | .Fa "struct tls *ctx" | ||
| 40 | .Fa "int fd_read" | ||
| 41 | .Fa "int fd_write" | ||
| 42 | .Fa "const char *servername" | ||
| 43 | .Fc | ||
| 44 | .Ft int | ||
| 45 | .Fo tls_connect_servername | ||
| 46 | .Fa "struct tls *ctx" | ||
| 47 | .Fa "const char *host" | ||
| 48 | .Fa "const char *port" | ||
| 49 | .Fa "const char *servername" | ||
| 50 | .Fc | ||
| 51 | .Ft int | ||
| 52 | .Fo tls_connect_socket | ||
| 53 | .Fa "struct tls *ctx" | ||
| 54 | .Fa "int s" | ||
| 55 | .Fa "const char *servername" | ||
| 56 | .Fc | ||
| 57 | .Ft int | ||
| 58 | .Fo tls_connect_cbs | ||
| 59 | .Fa "struct tls *ctx" | ||
| 60 | .Fa "ssize_t (*tls_read_cb)(struct tls *ctx,\ | ||
| 61 | void *buf, size_t buflen, void *cb_arg)" | ||
| 62 | .Fa "ssize_t (*tls_write_cb)(struct tls *ctx,\ | ||
| 63 | const void *buf, size_t buflen, void *cb_arg)" | ||
| 64 | .Fa "void *cb_arg" | ||
| 65 | .Fa "const char *servername" | ||
| 66 | .Fc | ||
| 67 | .Sh DESCRIPTION | ||
| 68 | After creating a TLS client context with | ||
| 69 | .Xr tls_client 3 | ||
| 70 | and configuring it with | ||
| 71 | .Xr tls_configure 3 , | ||
| 72 | a client connection is initiated by calling | ||
| 73 | .Fn tls_connect . | ||
| 74 | This function will create a new socket, connect to the specified | ||
| 75 | .Fa host | ||
| 76 | and | ||
| 77 | .Fa port , | ||
| 78 | and then establish a secure connection. | ||
| 79 | The | ||
| 80 | .Fa port | ||
| 81 | may be numeric or a service name. | ||
| 82 | If it is | ||
| 83 | .Dv NULL , | ||
| 84 | then a | ||
| 85 | .Fa host | ||
| 86 | of the format "hostname:port" is permitted. | ||
| 87 | The name to use for verification is inferred from the | ||
| 88 | .Ar host | ||
| 89 | value. | ||
| 90 | .Pp | ||
| 91 | The | ||
| 92 | .Fn tls_connect_servername | ||
| 93 | function has the same behaviour, however the name to use for verification is | ||
| 94 | explicitly provided, for the case where the TLS server name differs from the | ||
| 95 | DNS name. | ||
| 96 | .Pp | ||
| 97 | An already existing socket can be upgraded to a secure connection by calling | ||
| 98 | .Fn tls_connect_socket . | ||
| 99 | .Pp | ||
| 100 | Alternatively, a secure connection can be established over a pair of existing | ||
| 101 | file descriptors by calling | ||
| 102 | .Fn tls_connect_fds . | ||
| 103 | .Pp | ||
| 104 | Calling | ||
| 105 | .Fn tls_connect_cbs | ||
| 106 | allows read and write callback functions to handle data transfers. | ||
| 107 | The specified cb_arg parameter is passed back to the functions, | ||
| 108 | and can contain a pointer to any caller-specified data. | ||
| 109 | .Sh RETURN VALUES | ||
| 110 | These functions return 0 on success or -1 on error. | ||
| 111 | .Sh SEE ALSO | ||
| 112 | .Xr tls_accept_socket 3 , | ||
| 113 | .Xr tls_client 3 , | ||
| 114 | .Xr tls_close 3 , | ||
| 115 | .Xr tls_config_ocsp_require_stapling 3 , | ||
| 116 | .Xr tls_configure 3 , | ||
| 117 | .Xr tls_handshake 3 , | ||
| 118 | .Xr tls_init 3 | ||
| 119 | .Sh HISTORY | ||
| 120 | .Fn tls_connect | ||
| 121 | and | ||
| 122 | .Fn tls_connect_socket | ||
| 123 | appeared in | ||
| 124 | .Ox 5.6 | ||
| 125 | and got their final names in | ||
| 126 | .Ox 5.7 . | ||
| 127 | .Pp | ||
| 128 | .Fn tls_connect_fds | ||
| 129 | and | ||
| 130 | .Fn tls_connect_servername | ||
| 131 | appeared in | ||
| 132 | .Ox 5.7 | ||
| 133 | and | ||
| 134 | .Fn tls_connect_cbs | ||
| 135 | in | ||
| 136 | .Ox 6.1 . | ||
| 137 | .Sh AUTHORS | ||
| 138 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
| 139 | .An Reyk Floeter Aq Mt reyk@openbsd.org | ||
| 140 | .Pp | ||
| 141 | .An -nosplit | ||
| 142 | .Fn tls_connect_cbs | ||
| 143 | was written by | ||
| 144 | .An Tobias Pape Aq Mt tobias@netshed.de . | ||
diff --git a/src/lib/libtls/man/tls_init.3 b/src/lib/libtls/man/tls_init.3 deleted file mode 100644 index 557998107c..0000000000 --- a/src/lib/libtls/man/tls_init.3 +++ /dev/null | |||
| @@ -1,180 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_init.3,v 1.13 2018/07/09 19:47:20 tb Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | ||
| 4 | .\" Copyright (c) 2016 Joel Sing <jsing@openbsd.org> | ||
| 5 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | ||
| 6 | .\" | ||
| 7 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 8 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 9 | .\" copyright notice and this permission notice appear in all copies. | ||
| 10 | .\" | ||
| 11 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 12 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 13 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 14 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 15 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 18 | .\" | ||
| 19 | .Dd $Mdocdate: July 9 2018 $ | ||
| 20 | .Dt TLS_INIT 3 | ||
| 21 | .Os | ||
| 22 | .Sh NAME | ||
| 23 | .Nm tls_init , | ||
| 24 | .Nm tls_config_new , | ||
| 25 | .Nm tls_config_free , | ||
| 26 | .Nm tls_config_error | ||
| 27 | .Nd initialize TLS client and server API | ||
| 28 | .Sh SYNOPSIS | ||
| 29 | .In tls.h | ||
| 30 | .Ft int | ||
| 31 | .Fn tls_init void | ||
| 32 | .Ft struct tls_config * | ||
| 33 | .Fn tls_config_new void | ||
| 34 | .Ft void | ||
| 35 | .Fn tls_config_free "struct tls_config *config" | ||
| 36 | .Ft const char * | ||
| 37 | .Fn tls_config_error "struct tls_config *config" | ||
| 38 | .Sh DESCRIPTION | ||
| 39 | The | ||
| 40 | .Nm tls | ||
| 41 | family of functions establishes a secure communications channel | ||
| 42 | using the TLS socket protocol. | ||
| 43 | Both clients and servers are supported. | ||
| 44 | .Pp | ||
| 45 | The | ||
| 46 | .Fn tls_init | ||
| 47 | function initializes global data structures. | ||
| 48 | It is no longer necessary to call this function directly, | ||
| 49 | since it is invoked internally when needed. | ||
| 50 | It may be called more than once, and may be called concurrently. | ||
| 51 | .Pp | ||
| 52 | Before a connection is created, a configuration must be created. | ||
| 53 | The | ||
| 54 | .Fn tls_config_new | ||
| 55 | function allocates, initializes, and returns a new default configuration | ||
| 56 | object that can be used for future connections. | ||
| 57 | Several functions exist to change the options of the configuration; see | ||
| 58 | .Xr tls_config_set_protocols 3 , | ||
| 59 | .Xr tls_load_file 3 , | ||
| 60 | .Xr tls_config_ocsp_require_stapling 3 , | ||
| 61 | and | ||
| 62 | .Xr tls_config_verify 3 . | ||
| 63 | .Pp | ||
| 64 | The | ||
| 65 | .Fn tls_config_error | ||
| 66 | function may be used to retrieve a string containing more information | ||
| 67 | about the most recent error relating to a configuration. | ||
| 68 | .Pp | ||
| 69 | A TLS connection object is created by | ||
| 70 | .Xr tls_client 3 | ||
| 71 | or | ||
| 72 | .Xr tls_server 3 | ||
| 73 | and configured with | ||
| 74 | .Xr tls_configure 3 . | ||
| 75 | .Pp | ||
| 76 | A client connection is initiated after configuration by calling | ||
| 77 | .Xr tls_connect 3 . | ||
| 78 | A server can accept a new client connection by calling | ||
| 79 | .Xr tls_accept_socket 3 | ||
| 80 | on an already established socket connection. | ||
| 81 | .Pp | ||
| 82 | Two functions are provided for input and output, | ||
| 83 | .Xr tls_read 3 | ||
| 84 | and | ||
| 85 | .Xr tls_write 3 . | ||
| 86 | Both automatically perform the | ||
| 87 | .Xr tls_handshake 3 | ||
| 88 | when needed. | ||
| 89 | .Pp | ||
| 90 | The properties of established TLS connections | ||
| 91 | can be inspected with the functions described in | ||
| 92 | .Xr tls_conn_version 3 | ||
| 93 | and | ||
| 94 | .Xr tls_ocsp_process_response 3 . | ||
| 95 | .Pp | ||
| 96 | After use, a TLS connection should be closed with | ||
| 97 | .Xr tls_close 3 | ||
| 98 | and then freed by calling | ||
| 99 | .Xr tls_free 3 . | ||
| 100 | .Pp | ||
| 101 | When no more contexts are to be configured, | ||
| 102 | the configuration object should be freed by calling | ||
| 103 | .Fn tls_config_free . | ||
| 104 | It is safe to call | ||
| 105 | .Fn tls_config_free | ||
| 106 | as soon as the final call to | ||
| 107 | .Fn tls_configure | ||
| 108 | has been made. | ||
| 109 | If | ||
| 110 | .Fa config | ||
| 111 | is | ||
| 112 | .Dv NULL , | ||
| 113 | no action occurs. | ||
| 114 | .Sh RETURN VALUES | ||
| 115 | .Fn tls_init | ||
| 116 | returns 0 on success or -1 on error. | ||
| 117 | .Pp | ||
| 118 | .Fn tls_config_new | ||
| 119 | returns | ||
| 120 | .Dv NULL | ||
| 121 | on error or an out of memory condition. | ||
| 122 | .Pp | ||
| 123 | .Fn tls_config_error | ||
| 124 | returns | ||
| 125 | .Dv NULL | ||
| 126 | if no error occurred with | ||
| 127 | .Fa config | ||
| 128 | at all, or if memory allocation failed while trying to assemble the | ||
| 129 | string describing the most recent error related to | ||
| 130 | .Fa config . | ||
| 131 | .Sh SEE ALSO | ||
| 132 | .Xr tls_accept_socket 3 , | ||
| 133 | .Xr tls_client 3 , | ||
| 134 | .Xr tls_config_ocsp_require_stapling 3 , | ||
| 135 | .Xr tls_config_set_protocols 3 , | ||
| 136 | .Xr tls_config_verify 3 , | ||
| 137 | .Xr tls_conn_version 3 , | ||
| 138 | .Xr tls_connect 3 , | ||
| 139 | .Xr tls_load_file 3 , | ||
| 140 | .Xr tls_ocsp_process_response 3 , | ||
| 141 | .Xr tls_read 3 | ||
| 142 | .Sh HISTORY | ||
| 143 | The | ||
| 144 | .Nm tls | ||
| 145 | API first appeared in | ||
| 146 | .Ox 5.6 | ||
| 147 | as a response to the unnecessary challenges other APIs present in | ||
| 148 | order to use them safely. | ||
| 149 | .Pp | ||
| 150 | All functions were renamed from | ||
| 151 | .Fn ressl_* | ||
| 152 | to | ||
| 153 | .Fn tls_* | ||
| 154 | for | ||
| 155 | .Ox 5.7 . | ||
| 156 | .Pp | ||
| 157 | .Fn tls_config_error | ||
| 158 | appeared in | ||
| 159 | .Ox 6.0 . | ||
| 160 | .Sh AUTHORS | ||
| 161 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
| 162 | .An Ted Unangst Aq Mt tedu@openbsd.org | ||
| 163 | .Pp | ||
| 164 | Many others contributed to various parts of the library; see the | ||
| 165 | individual manual pages for more information. | ||
| 166 | .Sh CAVEATS | ||
| 167 | The function | ||
| 168 | .Fn tls_config_error | ||
| 169 | returns an internal pointer. | ||
| 170 | It must not be freed by the application, or a double free error | ||
| 171 | will occur. | ||
| 172 | The pointer will become invalid when the next error occurs with | ||
| 173 | .Fa config . | ||
| 174 | Consequently, if the application may need the message at a later | ||
| 175 | time, it has to copy the string before calling the next | ||
| 176 | .Sy libtls | ||
| 177 | function involving | ||
| 178 | .Fa config , | ||
| 179 | or a segmentation fault or read access to unintended data is the | ||
| 180 | likely result. | ||
diff --git a/src/lib/libtls/man/tls_load_file.3 b/src/lib/libtls/man/tls_load_file.3 deleted file mode 100644 index cf33b575ef..0000000000 --- a/src/lib/libtls/man/tls_load_file.3 +++ /dev/null | |||
| @@ -1,369 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_load_file.3,v 1.14 2022/01/01 02:18:28 jsg Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | ||
| 4 | .\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> | ||
| 5 | .\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> | ||
| 6 | .\" Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org> | ||
| 7 | .\" | ||
| 8 | .\" 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 | .\" copyright notice and this permission notice appear in all copies. | ||
| 11 | .\" | ||
| 12 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 13 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 14 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 15 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 16 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 19 | .\" | ||
| 20 | .Dd $Mdocdate: January 1 2022 $ | ||
| 21 | .Dt TLS_LOAD_FILE 3 | ||
| 22 | .Os | ||
| 23 | .Sh NAME | ||
| 24 | .Nm tls_load_file , | ||
| 25 | .Nm tls_unload_file , | ||
| 26 | .Nm tls_config_set_ca_file , | ||
| 27 | .Nm tls_config_set_ca_path , | ||
| 28 | .Nm tls_config_set_ca_mem , | ||
| 29 | .Nm tls_config_set_cert_file , | ||
| 30 | .Nm tls_config_set_cert_mem , | ||
| 31 | .Nm tls_config_set_crl_file , | ||
| 32 | .Nm tls_config_set_crl_mem , | ||
| 33 | .Nm tls_config_set_key_file , | ||
| 34 | .Nm tls_config_set_key_mem , | ||
| 35 | .Nm tls_config_set_ocsp_staple_mem , | ||
| 36 | .Nm tls_config_set_ocsp_staple_file , | ||
| 37 | .Nm tls_config_set_keypair_file , | ||
| 38 | .Nm tls_config_set_keypair_mem , | ||
| 39 | .Nm tls_config_set_keypair_ocsp_file , | ||
| 40 | .Nm tls_config_set_keypair_ocsp_mem , | ||
| 41 | .Nm tls_config_add_keypair_file , | ||
| 42 | .Nm tls_config_add_keypair_ocsp_mem , | ||
| 43 | .Nm tls_config_add_keypair_ocsp_file , | ||
| 44 | .Nm tls_config_add_keypair_mem , | ||
| 45 | .Nm tls_config_clear_keys , | ||
| 46 | .Nm tls_config_set_verify_depth , | ||
| 47 | .Nm tls_config_verify_client , | ||
| 48 | .Nm tls_config_verify_client_optional , | ||
| 49 | .Nm tls_default_ca_cert_file | ||
| 50 | .Nd TLS certificate and key configuration | ||
| 51 | .Sh SYNOPSIS | ||
| 52 | .In tls.h | ||
| 53 | .Ft uint8_t * | ||
| 54 | .Fo tls_load_file | ||
| 55 | .Fa "const char *file" | ||
| 56 | .Fa "size_t *len" | ||
| 57 | .Fa "char *password" | ||
| 58 | .Fc | ||
| 59 | .Ft void | ||
| 60 | .Fo tls_unload_file | ||
| 61 | .Fa "uint8_t *buf" | ||
| 62 | .Fa "size_t len" | ||
| 63 | .Fc | ||
| 64 | .Ft int | ||
| 65 | .Fo tls_config_set_ca_file | ||
| 66 | .Fa "struct tls_config *config" | ||
| 67 | .Fa "const char *ca_file" | ||
| 68 | .Fc | ||
| 69 | .Ft int | ||
| 70 | .Fo tls_config_set_ca_path | ||
| 71 | .Fa "struct tls_config *config" | ||
| 72 | .Fa "const char *ca_path" | ||
| 73 | .Fc | ||
| 74 | .Ft int | ||
| 75 | .Fo tls_config_set_ca_mem | ||
| 76 | .Fa "struct tls_config *config" | ||
| 77 | .Fa "const uint8_t *cert" | ||
| 78 | .Fa "size_t len" | ||
| 79 | .Fc | ||
| 80 | .Ft int | ||
| 81 | .Fo tls_config_set_cert_file | ||
| 82 | .Fa "struct tls_config *config" | ||
| 83 | .Fa "const char *cert_file" | ||
| 84 | .Fc | ||
| 85 | .Ft int | ||
| 86 | .Fo tls_config_set_cert_mem | ||
| 87 | .Fa "struct tls_config *config" | ||
| 88 | .Fa "const uint8_t *cert" | ||
| 89 | .Fa "size_t len" | ||
| 90 | .Fc | ||
| 91 | .Ft int | ||
| 92 | .Fo tls_config_set_crl_file | ||
| 93 | .Fa "struct tls_config *config" | ||
| 94 | .Fa "const char *crl_file" | ||
| 95 | .Fc | ||
| 96 | .Ft int | ||
| 97 | .Fo tls_config_set_crl_mem | ||
| 98 | .Fa "struct tls_config *config" | ||
| 99 | .Fa "const uint8_t *crl" | ||
| 100 | .Fa "size_t len" | ||
| 101 | .Fc | ||
| 102 | .Ft int | ||
| 103 | .Fo tls_config_set_key_file | ||
| 104 | .Fa "struct tls_config *config" | ||
| 105 | .Fa "const char *key_file" | ||
| 106 | .Fc | ||
| 107 | .Ft int | ||
| 108 | .Fo tls_config_set_key_mem | ||
| 109 | .Fa "struct tls_config *config" | ||
| 110 | .Fa "const uint8_t *key" | ||
| 111 | .Fa "size_t len" | ||
| 112 | .Fc | ||
| 113 | .Ft int | ||
| 114 | .Fo tls_config_set_ocsp_staple_mem | ||
| 115 | .Fa "struct tls_config *config" | ||
| 116 | .Fa "const uint8_t *staple" | ||
| 117 | .Fa "size_t len" | ||
| 118 | .Fc | ||
| 119 | .Ft int | ||
| 120 | .Fo tls_config_set_ocsp_staple_file | ||
| 121 | .Fa "struct tls_config *config" | ||
| 122 | .Fa "const char *staple_file" | ||
| 123 | .Fc | ||
| 124 | .Ft int | ||
| 125 | .Fo tls_config_set_keypair_file | ||
| 126 | .Fa "struct tls_config *config" | ||
| 127 | .Fa "const char *cert_file" | ||
| 128 | .Fa "const char *key_file" | ||
| 129 | .Fc | ||
| 130 | .Ft int | ||
| 131 | .Fo tls_config_set_keypair_mem | ||
| 132 | .Fa "struct tls_config *config" | ||
| 133 | .Fa "const uint8_t *cert" | ||
| 134 | .Fa "size_t cert_len" | ||
| 135 | .Fa "const uint8_t *key" | ||
| 136 | .Fa "size_t key_len" | ||
| 137 | .Fc | ||
| 138 | .Ft int | ||
| 139 | .Fo tls_config_set_keypair_ocsp_file | ||
| 140 | .Fa "struct tls_config *config" | ||
| 141 | .Fa "const char *cert_file" | ||
| 142 | .Fa "const char *key_file" | ||
| 143 | .Fa "const char *staple_file" | ||
| 144 | .Fc | ||
| 145 | .Ft int | ||
| 146 | .Fo tls_config_set_keypair_ocsp_mem | ||
| 147 | .Fa "struct tls_config *config" | ||
| 148 | .Fa "const uint8_t *cert" | ||
| 149 | .Fa "size_t cert_len" | ||
| 150 | .Fa "const uint8_t *key" | ||
| 151 | .Fa "size_t key_len" | ||
| 152 | .Fa "const uint8_t *staple" | ||
| 153 | .Fa "size_t staple_len" | ||
| 154 | .Fc | ||
| 155 | .Ft int | ||
| 156 | .Fo tls_config_add_keypair_file | ||
| 157 | .Fa "struct tls_config *config" | ||
| 158 | .Fa "const char *cert_file" | ||
| 159 | .Fa "const char *key_file" | ||
| 160 | .Fc | ||
| 161 | .Ft int | ||
| 162 | .Fo tls_config_add_keypair_mem | ||
| 163 | .Fa "struct tls_config *config" | ||
| 164 | .Fa "const uint8_t *cert" | ||
| 165 | .Fa "size_t cert_len" | ||
| 166 | .Fa "const uint8_t *key" | ||
| 167 | .Fa "size_t key_len" | ||
| 168 | .Fc | ||
| 169 | .Ft int | ||
| 170 | .Fo tls_config_add_keypair_ocsp_file | ||
| 171 | .Fa "struct tls_config *config" | ||
| 172 | .Fa "const char *cert_file" | ||
| 173 | .Fa "const char *key_file" | ||
| 174 | .Fa "const char *staple_file" | ||
| 175 | .Fc | ||
| 176 | .Ft int | ||
| 177 | .Fo tls_config_add_keypair_ocsp_mem | ||
| 178 | .Fa "struct tls_config *config" | ||
| 179 | .Fa "const uint8_t *cert" | ||
| 180 | .Fa "size_t cert_len" | ||
| 181 | .Fa "const uint8_t *key" | ||
| 182 | .Fa "size_t key_len" | ||
| 183 | .Fa "const uint8_t *staple" | ||
| 184 | .Fa "size_t staple_len" | ||
| 185 | .Fc | ||
| 186 | .Ft void | ||
| 187 | .Fn tls_config_clear_keys "struct tls_config *config" | ||
| 188 | .Ft int | ||
| 189 | .Fo tls_config_set_verify_depth | ||
| 190 | .Fa "struct tls_config *config" | ||
| 191 | .Fa "int verify_depth" | ||
| 192 | .Fc | ||
| 193 | .Ft void | ||
| 194 | .Fn tls_config_verify_client "struct tls_config *config" | ||
| 195 | .Ft void | ||
| 196 | .Fn tls_config_verify_client_optional "struct tls_config *config" | ||
| 197 | .Ft const char * | ||
| 198 | .Fn tls_default_ca_cert_file "void" | ||
| 199 | .Sh DESCRIPTION | ||
| 200 | .Fn tls_load_file | ||
| 201 | loads a certificate or key from disk into memory to be used with | ||
| 202 | .Fn tls_config_set_ca_mem , | ||
| 203 | .Fn tls_config_set_cert_mem , | ||
| 204 | .Fn tls_config_set_crl_mem | ||
| 205 | or | ||
| 206 | .Fn tls_config_set_key_mem . | ||
| 207 | A private key will be decrypted if the optional | ||
| 208 | .Ar password | ||
| 209 | argument is specified. | ||
| 210 | .Pp | ||
| 211 | .Fn tls_unload_file | ||
| 212 | unloads the memory that was returned from an earlier | ||
| 213 | .Fn tls_load_file | ||
| 214 | call, ensuring that the memory contents is discarded. | ||
| 215 | .Pp | ||
| 216 | .Fn tls_default_ca_cert_file | ||
| 217 | returns the path of the file that contains the default root certificates. | ||
| 218 | .Pp | ||
| 219 | .Fn tls_config_set_ca_file | ||
| 220 | loads a file containing the root certificates. | ||
| 221 | .Pp | ||
| 222 | .Fn tls_config_set_ca_path | ||
| 223 | sets the path (directory) which should be searched for root | ||
| 224 | certificates. | ||
| 225 | .Pp | ||
| 226 | .Fn tls_config_set_ca_mem | ||
| 227 | sets the root certificates directly from memory. | ||
| 228 | .Pp | ||
| 229 | .Fn tls_config_set_cert_file | ||
| 230 | loads a file containing the public certificate. | ||
| 231 | .Pp | ||
| 232 | .Fn tls_config_set_cert_mem | ||
| 233 | sets the public certificate directly from memory. | ||
| 234 | .Pp | ||
| 235 | .Fn tls_config_set_crl_file | ||
| 236 | loads a file containing the Certificate Revocation List (CRL). | ||
| 237 | .Pp | ||
| 238 | .Fn tls_config_set_crl_mem | ||
| 239 | sets the CRL directly from memory. | ||
| 240 | .Pp | ||
| 241 | .Fn tls_config_set_key_file | ||
| 242 | loads a file containing the private key. | ||
| 243 | .Pp | ||
| 244 | .Fn tls_config_set_key_mem | ||
| 245 | directly sets the private key from memory. | ||
| 246 | .Pp | ||
| 247 | .Fn tls_config_set_ocsp_staple_file | ||
| 248 | loads a file containing a DER-encoded OCSP response to be stapled | ||
| 249 | during the TLS handshake. | ||
| 250 | .Pp | ||
| 251 | .Fn tls_config_set_ocsp_staple_mem | ||
| 252 | sets a DER-encoded OCSP response to be stapled during the TLS handshake from | ||
| 253 | memory. | ||
| 254 | .Pp | ||
| 255 | .Fn tls_config_set_keypair_file | ||
| 256 | loads two files from which the public certificate and private key will be read. | ||
| 257 | .Pp | ||
| 258 | .Fn tls_config_set_keypair_mem | ||
| 259 | directly sets the public certificate and private key from memory. | ||
| 260 | .Pp | ||
| 261 | .Fn tls_config_set_keypair_ocsp_file | ||
| 262 | loads three files containing the public certificate, private key, | ||
| 263 | and DER-encoded OCSP staple. | ||
| 264 | .Pp | ||
| 265 | .Fn tls_config_set_keypair_ocsp_mem | ||
| 266 | directly sets the public certificate, private key, and DER-encoded OCSP staple | ||
| 267 | from memory. | ||
| 268 | .Pp | ||
| 269 | .Fn tls_config_add_keypair_file | ||
| 270 | adds an additional public certificate and private key from the specified files, | ||
| 271 | used as an alternative certificate for Server Name Indication (server only). | ||
| 272 | .Pp | ||
| 273 | .Fn tls_config_add_keypair_mem | ||
| 274 | adds an additional public certificate and private key from memory, used as an | ||
| 275 | alternative certificate for Server Name Indication (server only). | ||
| 276 | .Pp | ||
| 277 | .Fn tls_config_add_keypair_ocsp_file | ||
| 278 | adds an additional public certificate, private key, and DER-encoded OCSP staple | ||
| 279 | from the specified files, used as an alternative certificate for Server Name | ||
| 280 | Indication (server only). | ||
| 281 | .Pp | ||
| 282 | .Fn tls_config_add_keypair_ocsp_mem | ||
| 283 | adds an additional public certificate, private key, and DER-encoded OCSP staple | ||
| 284 | from memory, used as an alternative certificate for Server Name Indication | ||
| 285 | (server only). | ||
| 286 | .Pp | ||
| 287 | .Fn tls_config_clear_keys | ||
| 288 | clears any secret keys from memory. | ||
| 289 | .Pp | ||
| 290 | .Fn tls_config_set_verify_depth | ||
| 291 | limits the number of intermediate certificates that will be followed during | ||
| 292 | certificate validation. | ||
| 293 | .Pp | ||
| 294 | .Fn tls_config_verify_client | ||
| 295 | enables client certificate verification, requiring the client to send | ||
| 296 | a certificate (server only). | ||
| 297 | .Pp | ||
| 298 | .Fn tls_config_verify_client_optional | ||
| 299 | enables client certificate verification, without requiring the client | ||
| 300 | to send a certificate (server only). | ||
| 301 | .Sh RETURN VALUES | ||
| 302 | .Fn tls_load_file | ||
| 303 | returns | ||
| 304 | .Dv NULL | ||
| 305 | on error or an out of memory condition. | ||
| 306 | .Pp | ||
| 307 | The other functions return 0 on success or -1 on error. | ||
| 308 | .Sh SEE ALSO | ||
| 309 | .Xr tls_config_ocsp_require_stapling 3 , | ||
| 310 | .Xr tls_config_set_protocols 3 , | ||
| 311 | .Xr tls_config_set_session_id 3 , | ||
| 312 | .Xr tls_configure 3 , | ||
| 313 | .Xr tls_init 3 | ||
| 314 | .Sh HISTORY | ||
| 315 | .Fn tls_config_set_ca_file , | ||
| 316 | .Fn tls_config_set_ca_path , | ||
| 317 | .Fn tls_config_set_cert_file , | ||
| 318 | .Fn tls_config_set_cert_mem , | ||
| 319 | .Fn tls_config_set_key_file , | ||
| 320 | .Fn tls_config_set_key_mem , | ||
| 321 | and | ||
| 322 | .Fn tls_config_set_verify_depth | ||
| 323 | appeared in | ||
| 324 | .Ox 5.6 | ||
| 325 | and got their final names in | ||
| 326 | .Ox 5.7 . | ||
| 327 | .Pp | ||
| 328 | .Fn tls_load_file , | ||
| 329 | .Fn tls_config_set_ca_mem , | ||
| 330 | and | ||
| 331 | .Fn tls_config_clear_keys | ||
| 332 | appeared in | ||
| 333 | .Ox 5.7 . | ||
| 334 | .Pp | ||
| 335 | .Fn tls_config_verify_client | ||
| 336 | and | ||
| 337 | .Fn tls_config_verify_client_optional | ||
| 338 | appeared in | ||
| 339 | .Ox 5.9 . | ||
| 340 | .Pp | ||
| 341 | .Fn tls_config_set_keypair_file | ||
| 342 | and | ||
| 343 | .Fn tls_config_set_keypair_mem | ||
| 344 | appeared in | ||
| 345 | .Ox 6.0 , | ||
| 346 | and | ||
| 347 | .Fn tls_config_add_keypair_file | ||
| 348 | and | ||
| 349 | .Fn tls_config_add_keypair_mem | ||
| 350 | in | ||
| 351 | .Ox 6.1 . | ||
| 352 | .Pp | ||
| 353 | .Fn tls_config_set_crl_file | ||
| 354 | and | ||
| 355 | .Fn tls_config_set_crl_mem | ||
| 356 | appeared in | ||
| 357 | .Ox 6.2 . | ||
| 358 | .Sh AUTHORS | ||
| 359 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
| 360 | with contributions from | ||
| 361 | .An Ted Unangst Aq Mt tedu@openbsd.org | ||
| 362 | and | ||
| 363 | .An Bob Beck Aq Mt beck@openbsd.org . | ||
| 364 | .Pp | ||
| 365 | .Fn tls_load_file | ||
| 366 | and | ||
| 367 | .Fn tls_config_set_ca_mem | ||
| 368 | were written by | ||
| 369 | .An Reyk Floeter Aq Mt reyk@openbsd.org . | ||
diff --git a/src/lib/libtls/man/tls_ocsp_process_response.3 b/src/lib/libtls/man/tls_ocsp_process_response.3 deleted file mode 100644 index 6e3aa4aecc..0000000000 --- a/src/lib/libtls/man/tls_ocsp_process_response.3 +++ /dev/null | |||
| @@ -1,167 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_ocsp_process_response.3,v 1.6 2018/07/24 02:01:34 tb Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2016 Bob Beck <beck@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 24 2018 $ | ||
| 18 | .Dt TLS_OCSP_PROCESS_RESPONSE 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm tls_ocsp_process_response , | ||
| 22 | .Nm tls_peer_ocsp_url , | ||
| 23 | .Nm tls_peer_ocsp_response_status , | ||
| 24 | .Nm tls_peer_ocsp_cert_status , | ||
| 25 | .Nm tls_peer_ocsp_crl_reason , | ||
| 26 | .Nm tls_peer_ocsp_result , | ||
| 27 | .Nm tls_peer_ocsp_revocation_time , | ||
| 28 | .Nm tls_peer_ocsp_this_update , | ||
| 29 | .Nm tls_peer_ocsp_next_update | ||
| 30 | .Nd inspect an OCSP response | ||
| 31 | .Sh SYNOPSIS | ||
| 32 | .In tls.h | ||
| 33 | .Ft int | ||
| 34 | .Fo tls_ocsp_process_response | ||
| 35 | .Fa "struct tls *ctx" | ||
| 36 | .Fa "const unsigned char *response" | ||
| 37 | .Fa "size_t size" | ||
| 38 | .Fc | ||
| 39 | .Ft const char * | ||
| 40 | .Fn tls_peer_ocsp_url "struct tls *ctx" | ||
| 41 | .Ft int | ||
| 42 | .Fn tls_peer_ocsp_response_status "struct tls *ctx" | ||
| 43 | .Ft int | ||
| 44 | .Fn tls_peer_ocsp_cert_status "struct tls *ctx" | ||
| 45 | .Ft int | ||
| 46 | .Fn tls_peer_ocsp_crl_reason "struct tls *ctx" | ||
| 47 | .Ft const char * | ||
| 48 | .Fn tls_peer_ocsp_result "struct tls *ctx" | ||
| 49 | .Ft time_t | ||
| 50 | .Fn tls_peer_ocsp_revocation_time "struct tls *ctx" | ||
| 51 | .Ft time_t | ||
| 52 | .Fn tls_peer_ocsp_this_update "struct tls *ctx" | ||
| 53 | .Ft time_t | ||
| 54 | .Fn tls_peer_ocsp_next_update "struct tls *ctx" | ||
| 55 | .Sh DESCRIPTION | ||
| 56 | .Fn tls_ocsp_process_response | ||
| 57 | processes a raw OCSP response in | ||
| 58 | .Ar response | ||
| 59 | of size | ||
| 60 | .Ar size | ||
| 61 | to check the revocation status of the peer certificate from | ||
| 62 | .Ar ctx . | ||
| 63 | A successful return code of 0 indicates that the certificate | ||
| 64 | has not been revoked. | ||
| 65 | .Pp | ||
| 66 | .Fn tls_peer_ocsp_url | ||
| 67 | returns the URL for OCSP validation of the peer certificate from | ||
| 68 | .Ar ctx . | ||
| 69 | .Pp | ||
| 70 | The following functions return information about the peer certificate from | ||
| 71 | .Ar ctx | ||
| 72 | that was obtained by validating a stapled OCSP response during the handshake, | ||
| 73 | or via a previous call to | ||
| 74 | .Fn tls_ocsp_process_response . | ||
| 75 | .Pp | ||
| 76 | .Fn tls_peer_ocsp_response_status | ||
| 77 | returns the OCSP response status as per RFC 6960 section 2.3. | ||
| 78 | .Pp | ||
| 79 | .Fn tls_peer_ocsp_cert_status | ||
| 80 | returns the OCSP certificate status code as per RFC 6960 section 2.2. | ||
| 81 | .Pp | ||
| 82 | .Fn tls_peer_ocsp_crl_reason | ||
| 83 | returns the OCSP certificate revocation reason status code as per RFC 5280 | ||
| 84 | section 5.3.1. | ||
| 85 | .Pp | ||
| 86 | .Fn tls_peer_ocsp_result | ||
| 87 | returns a textual representation of the OCSP status code | ||
| 88 | returned by one of the previous three functions. | ||
| 89 | If the OCSP response was valid and the certificate was not | ||
| 90 | revoked, the string indicates the OCSP certificate status. | ||
| 91 | Otherwise, the string indicates | ||
| 92 | the OCSP certificate revocation reason or the OCSP error. | ||
| 93 | .Pp | ||
| 94 | .Fn tls_peer_ocsp_revocation_time | ||
| 95 | returns the OCSP revocation time. | ||
| 96 | .Pp | ||
| 97 | .Fn tls_peer_ocsp_this_update | ||
| 98 | returns the OCSP this update time. | ||
| 99 | .Pp | ||
| 100 | .Fn tls_peer_ocsp_next_update | ||
| 101 | returns the OCSP next update time. | ||
| 102 | .Sh RETURN VALUES | ||
| 103 | .Fn tls_ocsp_process_response | ||
| 104 | returns 0 on success or -1 on error. | ||
| 105 | .Pp | ||
| 106 | .Fn tls_peer_ocsp_url | ||
| 107 | and | ||
| 108 | .Fn tls_peer_ocsp_result | ||
| 109 | return | ||
| 110 | .Dv NULL | ||
| 111 | on error or an out of memory condition. | ||
| 112 | .Pp | ||
| 113 | The | ||
| 114 | .Fn tls_peer_ocsp_response_status | ||
| 115 | function returns one of | ||
| 116 | .Dv TLS_OCSP_RESPONSE_SUCCESSFUL , | ||
| 117 | .Dv TLS_OCSP_RESPONSE_MALFORMED , | ||
| 118 | .Dv TLS_OCSP_RESPONSE_INTERNALERROR , | ||
| 119 | .Dv TLS_OCSP_RESPONSE_TRYLATER , | ||
| 120 | .Dv TLS_OCSP_RESPONSE_SIGREQUIRED , | ||
| 121 | or | ||
| 122 | .Dv TLS_OCSP_RESPONSE_UNAUTHORIZED | ||
| 123 | on success or -1 on error. | ||
| 124 | .Pp | ||
| 125 | The | ||
| 126 | .Fn tls_peer_ocsp_cert_status | ||
| 127 | function returns one of | ||
| 128 | .Dv TLS_OCSP_CERT_GOOD , | ||
| 129 | .Dv TLS_OCSP_CERT_REVOKED , | ||
| 130 | or | ||
| 131 | .Dv TLS_OCSP_CERT_UNKNOWN | ||
| 132 | on success, and -1 on error. | ||
| 133 | .Pp | ||
| 134 | The | ||
| 135 | .Fn tls_peer_ocsp_crl_reason | ||
| 136 | function returns one of | ||
| 137 | .Dv TLS_CRL_REASON_UNSPECIFIED , | ||
| 138 | .Dv TLS_CRL_REASON_KEY_COMPROMISE , | ||
| 139 | .Dv TLS_CRL_REASON_CA_COMPROMISE , | ||
| 140 | .Dv TLS_CRL_REASON_AFFILIATION_CHANGED , | ||
| 141 | .Dv TLS_CRL_REASON_SUPERSEDED , | ||
| 142 | .Dv TLS_CRL_REASON_CESSATION_OF_OPERATION , | ||
| 143 | .Dv TLS_CRL_REASON_CERTIFICATE_HOLD , | ||
| 144 | .Dv TLS_CRL_REASON_REMOVE_FROM_CRL , | ||
| 145 | .Dv TLS_CRL_REASON_PRIVILEGE_WITHDRAWN , | ||
| 146 | or | ||
| 147 | .Dv TLS_CRL_REASON_AA_COMPROMISE | ||
| 148 | on success or -1 on error. | ||
| 149 | .Pp | ||
| 150 | .Fn tls_peer_ocsp_revocation_time , | ||
| 151 | .Fn tls_peer_ocsp_this_update , | ||
| 152 | and | ||
| 153 | .Fn tls_peer_ocsp_next_update | ||
| 154 | return a time in epoch-seconds on success or -1 on error. | ||
| 155 | .Sh SEE ALSO | ||
| 156 | .Xr tls_client 3 , | ||
| 157 | .Xr tls_config_ocsp_require_stapling 3 , | ||
| 158 | .Xr tls_conn_version 3 , | ||
| 159 | .Xr tls_connect 3 , | ||
| 160 | .Xr tls_handshake 3 , | ||
| 161 | .Xr tls_init 3 | ||
| 162 | .Sh HISTORY | ||
| 163 | These functions appeared in | ||
| 164 | .Ox 6.1 . | ||
| 165 | .Sh AUTHORS | ||
| 166 | .An Bob Beck Aq Mt beck@openbsd.org | ||
| 167 | .An Marko Kreen Aq Mt markokr@gmail.com | ||
diff --git a/src/lib/libtls/man/tls_read.3 b/src/lib/libtls/man/tls_read.3 deleted file mode 100644 index f9d949eef5..0000000000 --- a/src/lib/libtls/man/tls_read.3 +++ /dev/null | |||
| @@ -1,240 +0,0 @@ | |||
| 1 | .\" $OpenBSD: tls_read.3,v 1.8 2023/09/18 17:25:15 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2014, 2015 Ted Unangst <tedu@openbsd.org> | ||
| 4 | .\" Copyright (c) 2015 Doug Hogan <doug@openbsd.org> | ||
| 5 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | ||
| 6 | .\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> | ||
| 7 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | ||
| 8 | .\" | ||
| 9 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 10 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 11 | .\" copyright notice and this permission notice appear in all copies. | ||
| 12 | .\" | ||
| 13 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 14 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 15 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 16 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 17 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 20 | .\" | ||
| 21 | .Dd $Mdocdate: September 18 2023 $ | ||
| 22 | .Dt TLS_READ 3 | ||
| 23 | .Os | ||
| 24 | .Sh NAME | ||
| 25 | .Nm tls_read , | ||
| 26 | .Nm tls_write , | ||
| 27 | .Nm tls_handshake , | ||
| 28 | .Nm tls_error , | ||
| 29 | .Nm tls_close | ||
| 30 | .Nd use a TLS connection | ||
| 31 | .Sh SYNOPSIS | ||
| 32 | .In tls.h | ||
| 33 | .Ft ssize_t | ||
| 34 | .Fo tls_read | ||
| 35 | .Fa "struct tls *ctx" | ||
| 36 | .Fa "void *buf" | ||
| 37 | .Fa "size_t buflen" | ||
| 38 | .Fc | ||
| 39 | .Ft ssize_t | ||
| 40 | .Fo tls_write | ||
| 41 | .Fa "struct tls *ctx" | ||
| 42 | .Fa "const void *buf" | ||
| 43 | .Fa "size_t buflen" | ||
| 44 | .Fc | ||
| 45 | .Ft int | ||
| 46 | .Fn tls_handshake "struct tls *ctx" | ||
| 47 | .Ft const char * | ||
| 48 | .Fn tls_error "struct tls *ctx" | ||
| 49 | .Ft int | ||
| 50 | .Fn tls_close "struct tls *ctx" | ||
| 51 | .Sh DESCRIPTION | ||
| 52 | .Fn tls_read | ||
| 53 | reads | ||
| 54 | .Fa buflen | ||
| 55 | bytes of data from the socket into | ||
| 56 | .Fa buf . | ||
| 57 | It returns the amount of data read. | ||
| 58 | .Pp | ||
| 59 | .Fn tls_write | ||
| 60 | writes | ||
| 61 | .Fa buflen | ||
| 62 | bytes of data from | ||
| 63 | .Fa buf | ||
| 64 | to the socket. | ||
| 65 | It returns the amount of data written. | ||
| 66 | .Pp | ||
| 67 | .Fn tls_handshake | ||
| 68 | explicitly performs the TLS handshake. | ||
| 69 | It is only necessary to call this function if you need to guarantee that the | ||
| 70 | handshake has completed, as both | ||
| 71 | .Fn tls_read | ||
| 72 | and | ||
| 73 | .Fn tls_write | ||
| 74 | automatically perform the TLS handshake when necessary. | ||
| 75 | .Pp | ||
| 76 | The | ||
| 77 | .Fn tls_error | ||
| 78 | function may be used to retrieve a string containing more information | ||
| 79 | about the most recent error relating to a context. | ||
| 80 | .Pp | ||
| 81 | .Fn tls_close | ||
| 82 | closes a connection after use. | ||
| 83 | Only the TLS layer will be shut down and the caller is responsible for closing | ||
| 84 | the file descriptors, unless the connection was established using | ||
| 85 | .Xr tls_connect 3 | ||
| 86 | or | ||
| 87 | .Xr tls_connect_servername 3 . | ||
| 88 | After closing the connection, | ||
| 89 | .Fa ctx | ||
| 90 | can be passed to | ||
| 91 | .Xr tls_free 3 . | ||
| 92 | .Sh RETURN VALUES | ||
| 93 | .Fn tls_read | ||
| 94 | and | ||
| 95 | .Fn tls_write | ||
| 96 | return a size on success or -1 on error. | ||
| 97 | .Pp | ||
| 98 | .Fn tls_handshake | ||
| 99 | and | ||
| 100 | .Fn tls_close | ||
| 101 | return 0 on success or -1 on error. | ||
| 102 | .Pp | ||
| 103 | The | ||
| 104 | .Fn tls_read , | ||
| 105 | .Fn tls_write , | ||
| 106 | .Fn tls_handshake , | ||
| 107 | and | ||
| 108 | .Fn tls_close | ||
| 109 | functions also have two special return values: | ||
| 110 | .Pp | ||
| 111 | .Bl -tag -width "TLS_WANT_POLLOUT" -offset indent -compact | ||
| 112 | .It Dv TLS_WANT_POLLIN | ||
| 113 | The underlying read file descriptor needs to be readable in order to continue. | ||
| 114 | .It Dv TLS_WANT_POLLOUT | ||
| 115 | The underlying write file descriptor needs to be writeable in order to continue. | ||
| 116 | .El | ||
| 117 | .Pp | ||
| 118 | In the case of blocking file descriptors, the same function call should be | ||
| 119 | repeated immediately. | ||
| 120 | In the case of non-blocking file descriptors, the same function call should be | ||
| 121 | repeated when the required condition has been met. | ||
| 122 | .Pp | ||
| 123 | Callers of these functions cannot rely on the value of the global | ||
| 124 | .Ar errno . | ||
| 125 | To prevent mishandling of error conditions, | ||
| 126 | .Fn tls_read , | ||
| 127 | .Fn tls_write , | ||
| 128 | .Fn tls_handshake , | ||
| 129 | and | ||
| 130 | .Fn tls_close | ||
| 131 | all explicitly clear | ||
| 132 | .Ar errno . | ||
| 133 | .Pp | ||
| 134 | .Fn tls_error | ||
| 135 | returns | ||
| 136 | .Dv NULL | ||
| 137 | if no error occurred with | ||
| 138 | .Fa ctx | ||
| 139 | during or since the last call to | ||
| 140 | .Fn tls_handshake , | ||
| 141 | .Fn tls_read , | ||
| 142 | .Fn tls_write , | ||
| 143 | .Fn tls_close , | ||
| 144 | or | ||
| 145 | .Xr tls_reset 3 | ||
| 146 | involving | ||
| 147 | .Fa ctx , | ||
| 148 | or if memory allocation failed while trying to assemble the string | ||
| 149 | describing the most recent error related to | ||
| 150 | .Fa ctx . | ||
| 151 | .Sh EXAMPLES | ||
| 152 | The following example demonstrates how to handle TLS writes on a blocking | ||
| 153 | file descriptor: | ||
| 154 | .Bd -literal -offset indent | ||
| 155 | \&... | ||
| 156 | while (len > 0) { | ||
| 157 | ssize_t ret; | ||
| 158 | |||
| 159 | ret = tls_write(ctx, buf, len); | ||
| 160 | if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) | ||
| 161 | continue; | ||
| 162 | if (ret == -1) | ||
| 163 | errx(1, "tls_write: %s", tls_error(ctx)); | ||
| 164 | buf += ret; | ||
| 165 | len -= ret; | ||
| 166 | } | ||
| 167 | \&... | ||
| 168 | .Ed | ||
| 169 | .Pp | ||
| 170 | The following example demonstrates how to handle TLS writes on a | ||
| 171 | non-blocking file descriptor using | ||
| 172 | .Xr poll 2 : | ||
| 173 | .Bd -literal -offset indent | ||
| 174 | \&... | ||
| 175 | pfd[0].fd = fd; | ||
| 176 | pfd[0].events = POLLIN|POLLOUT; | ||
| 177 | while (len > 0) { | ||
| 178 | nready = poll(pfd, 1, 0); | ||
| 179 | if (nready == -1) | ||
| 180 | err(1, "poll"); | ||
| 181 | if ((pfd[0].revents & (POLLERR|POLLNVAL))) | ||
| 182 | errx(1, "bad fd %d", pfd[0].fd); | ||
| 183 | if ((pfd[0].revents & (pfd[0].events|POLLHUP))) { | ||
| 184 | ssize_t ret; | ||
| 185 | |||
| 186 | ret = tls_write(ctx, buf, len); | ||
| 187 | if (ret == TLS_WANT_POLLIN) | ||
| 188 | pfd[0].events = POLLIN; | ||
| 189 | else if (ret == TLS_WANT_POLLOUT) | ||
| 190 | pfd[0].events = POLLOUT; | ||
| 191 | else if (ret == -1) | ||
| 192 | errx(1, "tls_write: %s", tls_error(ctx)); | ||
| 193 | else { | ||
| 194 | buf += ret; | ||
| 195 | len -= ret; | ||
| 196 | } | ||
| 197 | } | ||
| 198 | } | ||
| 199 | \&... | ||
| 200 | .Ed | ||
| 201 | .Sh SEE ALSO | ||
| 202 | .Xr tls_accept_socket 3 , | ||
| 203 | .Xr tls_configure 3 , | ||
| 204 | .Xr tls_conn_version 3 , | ||
| 205 | .Xr tls_connect 3 , | ||
| 206 | .Xr tls_init 3 , | ||
| 207 | .Xr tls_ocsp_process_response 3 | ||
| 208 | .Sh HISTORY | ||
| 209 | .Fn tls_read , | ||
| 210 | .Fn tls_write , | ||
| 211 | .Fn tls_error , | ||
| 212 | and | ||
| 213 | .Fn tls_close | ||
| 214 | appeared in | ||
| 215 | .Ox 5.6 | ||
| 216 | and got their final names in | ||
| 217 | .Ox 5.7 . | ||
| 218 | .Pp | ||
| 219 | .Fn tls_handshake | ||
| 220 | appeared in | ||
| 221 | .Ox 5.9 . | ||
| 222 | .Sh AUTHORS | ||
| 223 | .An Joel Sing Aq Mt jsing@openbsd.org | ||
| 224 | with contributions from | ||
| 225 | .An Bob Beck Aq Mt beck@openbsd.org | ||
| 226 | .Sh CAVEATS | ||
| 227 | The function | ||
| 228 | .Fn tls_error | ||
| 229 | returns an internal pointer. | ||
| 230 | It must not be freed by the application, or a double free error | ||
| 231 | will occur. | ||
| 232 | The pointer will become invalid when the next error occurs with | ||
| 233 | .Fa ctx . | ||
| 234 | Consequently, if the application may need the message at a later | ||
| 235 | time, it has to copy the string before calling the next | ||
| 236 | .Sy libtls | ||
| 237 | function involving | ||
| 238 | .Fa ctx , | ||
| 239 | or a segmentation fault or read access to unintended data is the | ||
| 240 | likely result. | ||
