summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2020-09-15 14:51:42 +0000
committerschwarze <>2020-09-15 14:51:42 +0000
commitd0a9ef033bde1e5274774ee0e23d611f9462a3a9 (patch)
tree03c308a43c202c04b81ebdbd4d7cea43216498ac /src/lib
parent2c1ca37eff900a425e6e7151e749b765ec71eef5 (diff)
downloadopenbsd-d0a9ef033bde1e5274774ee0e23d611f9462a3a9.tar.gz
openbsd-d0a9ef033bde1e5274774ee0e23d611f9462a3a9.tar.bz2
openbsd-d0a9ef033bde1e5274774ee0e23d611f9462a3a9.zip
Create the missing RETURN VALUES section and move the appropriate
content there. Clarify when the returned pointers become invalid, which is far from obvious but sets surprising traps for the user. For three of the functions, correct statements about when they fail. Also improve a number of wordings while here. OK beck@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/man/SSL_get_ciphers.3160
1 files changed, 103 insertions, 57 deletions
diff --git a/src/lib/libssl/man/SSL_get_ciphers.3 b/src/lib/libssl/man/SSL_get_ciphers.3
index 07361da461..5ff1f69c42 100644
--- a/src/lib/libssl/man/SSL_get_ciphers.3
+++ b/src/lib/libssl/man/SSL_get_ciphers.3
@@ -1,10 +1,28 @@
1.\" $OpenBSD: SSL_get_ciphers.3,v 1.7 2019/01/22 01:18:24 tb Exp $ 1.\" $OpenBSD: SSL_get_ciphers.3,v 1.8 2020/09/15 14:51:42 schwarze Exp $
2.\" full merge up to: OpenSSL c3e64028 Mar 30 11:50:14 2005 +0000 2.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 3.\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
4.\" 4.\"
5.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>, 5.\" This file is a derived work.
6.\" Nick Mathewson <nickm@torproject.org>, and Kazuki Yamaguchi <k@rhe.jp>. 6.\" The changes are covered by the following Copyright and license:
7.\" Copyright (c) 2000, 2005, 2015, 2016 The OpenSSL Project. 7.\"
8.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
9.\"
10.\" Permission to use, copy, modify, and distribute this software for any
11.\" purpose with or without fee is hereby granted, provided that the above
12.\" copyright notice and this permission notice appear in all copies.
13.\"
14.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21.\"
22.\" The original file was written by Lutz Jaenicke <jaenicke@openssl.org>,
23.\" Nick Mathewson <nickm@torproject.org>, Kurt Roeckx <kurt@roeckx.be>,
24.\" Kazuki Yamaguchi <k@rhe.jp>, and Benjamin Kaduk <bkaduk@akamai.com>.
25.\" Copyright (c) 2000, 2005, 2015, 2016, 2017 The OpenSSL Project.
8.\" All rights reserved. 26.\" All rights reserved.
9.\" 27.\"
10.\" Redistribution and use in source and binary forms, with or without 28.\" Redistribution and use in source and binary forms, with or without
@@ -51,7 +69,7 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 71.\"
54.Dd $Mdocdate: January 22 2019 $ 72.Dd $Mdocdate: September 15 2020 $
55.Dt SSL_GET_CIPHERS 3 73.Dt SSL_GET_CIPHERS 3
56.Os 74.Os
57.Sh NAME 75.Sh NAME
@@ -60,7 +78,7 @@
60.Nm SSL_get1_supported_ciphers , 78.Nm SSL_get1_supported_ciphers ,
61.Nm SSL_get_client_ciphers , 79.Nm SSL_get_client_ciphers ,
62.Nm SSL_get_cipher_list 80.Nm SSL_get_cipher_list
63.Nd get list of available SSL_CIPHERs 81.Nd get lists of available SSL_CIPHERs
64.Sh SYNOPSIS 82.Sh SYNOPSIS
65.In openssl/ssl.h 83.In openssl/ssl.h
66.Ft STACK_OF(SSL_CIPHER) * 84.Ft STACK_OF(SSL_CIPHER) *
@@ -80,13 +98,6 @@ returns the stack of available
80for 98for
81.Fa ssl , 99.Fa ssl ,
82sorted by preference. 100sorted by preference.
83If
84.Fa ssl
85is
86.Dv NULL
87or no ciphers are available,
88.Dv NULL
89is returned.
90.Pp 101.Pp
91.Fn SSL_CTX_get_ciphers 102.Fn SSL_CTX_get_ciphers
92returns the stack of available 103returns the stack of available
@@ -95,7 +106,7 @@ for
95.Fa ctx . 106.Fa ctx .
96.Pp 107.Pp
97.Fn SSL_get1_supported_ciphers 108.Fn SSL_get1_supported_ciphers
98returns the stack of enabled 109returns a stack of enabled
99.Vt SSL_CIPHER Ns s 110.Vt SSL_CIPHER Ns s
100for 111for
101.Fa ssl 112.Fa ssl
@@ -110,40 +121,12 @@ For example,
110additional ciphers may be usable by a server if there is a gap in the 121additional ciphers may be usable by a server if there is a gap in the
111list of supported protocols, and some ciphers may not be usable by a 122list of supported protocols, and some ciphers may not be usable by a
112server if there is not a suitable certificate configured. 123server if there is not a suitable certificate configured.
113If
114.Fa ssl
115is
116.Dv NULL
117or no ciphers are available,
118.Dv NULL
119is returned.
120.Pp 124.Pp
121.Fn SSL_get_client_ciphers 125.Fn SSL_get_client_ciphers
122returns the stack of available 126returns the stack of available
123.Vt SSL_CIPHER Ns s 127.Vt SSL_CIPHER Ns s
124matching the list received from the client on 128matching the list received from the client on
125.Fa ssl . 129.Fa ssl .
126If
127.Fa ssl
128is
129.Dv NULL ,
130no ciphers are available, or
131.Fa ssl
132is not operating in server mode,
133.Dv NULL
134is returned.
135.Pp
136.Fn SSL_get_ciphers ,
137.Fn SSL_CTX_get_ciphers ,
138and
139.Fn SSL_get_client_ciphers
140return pointers to internal cipher stacks, which will be freed
141later on when the
142.Vt SSL
143or
144.Vt SSL_CTX
145object is freed.
146Therefore, the calling code must not free the return value itself.
147.Pp 130.Pp
148The details of the ciphers obtained by 131The details of the ciphers obtained by
149.Fn SSL_get_ciphers , 132.Fn SSL_get_ciphers ,
@@ -156,29 +139,92 @@ can be obtained using the
156family of functions. 139family of functions.
157.Pp 140.Pp
158.Fn SSL_get_cipher_list 141.Fn SSL_get_cipher_list
159returns a pointer to the name of the 142is badly misnamed; it does not return a list.
160.Vt SSL_CIPHER 143Instead, it returns the name of one element of the return value of
161listed for 144.Fn SSL_get_ciphers ,
145with the index given by the
146.Fa priority
147argument.
148Passing 0 selects the cipher with the highest priority.
149To iterate over all available ciphers in decreasing priority,
150repeatedly increment the argument by 1 until
151.Dv NULL
152is returned.
153.Sh RETURN VALUES
154.Fn SSL_get_ciphers
155returns an internal pointer to a list of ciphers or
156.Dv NULL
157if
158.Fa ssl
159is
160.Dv NULL
161or if no ciphers are available.
162The returned pointer may not only become invalid when
162.Fa ssl 163.Fa ssl
163with 164is destroyed or when
164.Fa priority . 165.Xr SSL_set_cipher_list 3
166is called on it, but also when the
167.Vt SSL_CTX
168object is destroyed that
169.Fa SSL
170was created from or when
171.Xr SSL_CTX_set_cipher_list 3
172is called on that context object.
173.Pp
174.Fn SSL_CTX_get_ciphers
175returns an internal pointer to a list of ciphers or
176.Dv NULL
177if no ciphers are available.
165If 178If
179.Fa ctx
180is
181.Dv NULL ,
182calling this function crashes the program.
183The returned pointer becomes invalid when
184.Fa ctx
185is destroyed or when
186.Xr SSL_CTX_set_cipher_list 3
187is called on it.
188.Pp
189.Fn SSL_get1_supported_ciphers
190returns a newly allocated list of ciphers or
191.Dv NULL
192if
166.Fa ssl 193.Fa ssl
167is 194is
168.Dv NULL , 195.Dv NULL ,
169no ciphers are available, or there are fewer ciphers than 196if no ciphers are available, or if an error occurs.
170.Fa priority 197When the returned pointer is no longer needed, the caller is
171available, 198responsible for freeing it using
199.Fn sk_SSL_CIPHER_free .
200.Pp
201.Fn SSL_get_client_ciphers
202returns an internal pointer to a list of ciphers or
172.Dv NULL 203.Dv NULL
173is returned. 204if
205.Fa ssl
206is
207.Dv NULL ,
208has no active session,
209or is not operating in server mode.
210The returned pointer becomes invalid when the
211.Vt SSL_SESSION
212object is destroyed, even if the
213.Fa ssl
214object remains valid.
215It may also become invalid in other circumstances,
216for example when processing a new ClientHello.
174.Pp 217.Pp
175Call
176.Fn SSL_get_cipher_list 218.Fn SSL_get_cipher_list
177with 219returns an internal pointer to a string or
178.Fa priority
179starting from 0 to obtain the sorted list of available ciphers, until
180.Dv NULL 220.Dv NULL
181is returned. 221if
222.Fa ssl
223is
224.Dv NULL ,
225if no ciphers are available, or if
226.Fa priority
227is greater than or equal to the number of available ciphers.
182.Sh SEE ALSO 228.Sh SEE ALSO
183.Xr ssl 3 , 229.Xr ssl 3 ,
184.Xr SSL_CIPHER_get_name 3 , 230.Xr SSL_CIPHER_get_name 3 ,