summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.378
1 files changed, 48 insertions, 30 deletions
diff --git a/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 b/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3
index 5f8da325bb..42f68e0a3a 100644
--- a/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3
+++ b/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_alpn_select_cb.3,v 1.9 2024/06/28 14:48:43 tb Exp $ 1.\" $OpenBSD: SSL_CTX_set_alpn_select_cb.3,v 1.10 2024/07/11 13:50:44 tb Exp $
2.\" OpenSSL 87b81496 Apr 19 12:38:27 2017 -0400 2.\" OpenSSL 87b81496 Apr 19 12:38:27 2017 -0400
3.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 3.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
4.\" 4.\"
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 28 2024 $ 52.Dd $Mdocdate: July 11 2024 $
53.Dt SSL_CTX_SET_ALPN_SELECT_CB 3 53.Dt SSL_CTX_SET_ALPN_SELECT_CB 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -85,10 +85,10 @@
85.Fo SSL_select_next_proto 85.Fo SSL_select_next_proto
86.Fa "unsigned char **out" 86.Fa "unsigned char **out"
87.Fa "unsigned char *outlen" 87.Fa "unsigned char *outlen"
88.Fa "const unsigned char *server" 88.Fa "const unsigned char *peer_list"
89.Fa "unsigned int server_len" 89.Fa "unsigned int peer_list_len"
90.Fa "const unsigned char *client" 90.Fa "const unsigned char *supported_list"
91.Fa "unsigned int client_len" 91.Fa "unsigned int supported_list_len"
92.Fc 92.Fc
93.Ft void 93.Ft void
94.Fo SSL_get0_alpn_selected 94.Fo SSL_get0_alpn_selected
@@ -149,7 +149,6 @@ parameter is the pointer set via
149.Pp 149.Pp
150.Fn SSL_select_next_proto 150.Fn SSL_select_next_proto
151is a helper function used to select protocols. 151is a helper function used to select protocols.
152It implements the standard protocol selection.
153It is expected that this function is called from the application 152It is expected that this function is called from the application
154callback 153callback
155.Fa cb . 154.Fa cb .
@@ -163,32 +162,30 @@ should ignore
163and fail by returning 162and fail by returning
164.Dv SSL_TLSEXT_ERR_ALERT_FATAL . 163.Dv SSL_TLSEXT_ERR_ALERT_FATAL .
165The protocol data in 164The protocol data in
166.Fa server , 165.Fa peer_list ,
167.Fa server_len 166.Fa peer_list_len
168and 167and
169.Fa client , 168.Fa supported_list ,
170.Fa client_len 169.Fa supported_list_len
171must be in the protocol-list format described below. 170must be two non-empty lists, validly encoded
171in the protocol-list format described below.
172The first item in the 172The first item in the
173.Fa server , 173.Fa peer_list
174.Fa server_len 174that matches an item in the
175list that matches an item in the 175.Fa supported_list
176.Fa client , 176is selected, and returned in
177.Fa client_len
178list is selected, and returned in
179.Fa out , 177.Fa out ,
180.Fa outlen . 178.Fa outlen .
181The 179The
182.Fa out 180.Fa out
183value will point into either 181value will point into either
184.Fa server 182.Fa peer_list
185or 183or
186.Fa client , 184.Fa supported_list ,
187so it must not be modified and 185so it must not be modified and
188should be copied immediately. 186should be copied immediately.
189If no match is found, the first item in 187If no match is found, the first item in
190.Fa client , 188.Fa supported_list
191.Fa client_len
192is returned in 189is returned in
193.Fa out , 190.Fa out ,
194.Fa outlen . 191.Fa outlen .
@@ -213,17 +210,13 @@ of non-empty, 8-bit length-prefixed byte strings.
213The length-prefix byte is not included in the length. 210The length-prefix byte is not included in the length.
214Each string is limited to 255 bytes. 211Each string is limited to 255 bytes.
215A byte-string length of 0 is invalid. 212A byte-string length of 0 is invalid.
216A truncated byte-string is invalid.
217The length of the vector is not in the vector itself, but in a separate 213The length of the vector is not in the vector itself, but in a separate
218variable. 214variable.
219.Pp 215.Pp
220For example: 216For example:
221.Bd -literal 217.Bd -literal
222unsigned char vector[] = { 218const unsigned char *vector = "\e6" "spdy/1" "\e8" "http/1.1";
223 6, 's', 'p', 'd', 'y', '/', '1', 219unsigned int length = strlen(vector);
224 8, 'h', 't', 't', 'p', '/', '1', '.', '1'
225};
226unsigned int length = sizeof(vector);
227.Ed 220.Ed
228.Pp 221.Pp
229The ALPN callback is executed after the servername callback; as that 222The ALPN callback is executed after the servername callback; as that
@@ -249,8 +242,8 @@ A match was found and is returned in
249.It OPENSSL_NPN_NO_OVERLAP 242.It OPENSSL_NPN_NO_OVERLAP
250No match was found. 243No match was found.
251The first item in 244The first item in
252.Fa client , 245.Fa supported_list ,
253.Fa client_len 246.Fa supported_list_len
254is returned in 247is returned in
255.Fa out , 248.Fa out ,
256.Fa outlen . 249.Fa outlen .
@@ -273,6 +266,16 @@ configured for this connection.
273.Xr ssl 3 , 266.Xr ssl 3 ,
274.Xr SSL_CTX_set_tlsext_servername_arg 3 , 267.Xr SSL_CTX_set_tlsext_servername_arg 3 ,
275.Xr SSL_CTX_set_tlsext_servername_callback 3 268.Xr SSL_CTX_set_tlsext_servername_callback 3
269.Sh STANDARDS
270.Rs
271.%T TLS Application-Layer Protocol Negotiation Extension
272.%R RFC 7301
273.Re
274.Pp
275.Rs
276.%T TLS Next Protocol Negotiation Extension
277.%U https://datatracker.ietf.org/doc/html/draft-agl-tls-nextprotoneg
278.Re
276.Sh HISTORY 279.Sh HISTORY
277.Fn SSL_select_next_proto 280.Fn SSL_select_next_proto
278first appeared in OpenSSL 1.0.1 and has been available since 281first appeared in OpenSSL 1.0.1 and has been available since
@@ -285,3 +288,18 @@ and
285.Fn SSL_get0_alpn_selected 288.Fn SSL_get0_alpn_selected
286first appeared in OpenSSL 1.0.2 and have been available since 289first appeared in OpenSSL 1.0.2 and have been available since
287.Ox 5.7 . 290.Ox 5.7 .
291.Sh CAVEATS
292The fallback to the first supported protocol in
293.Fn SSL_select_next_proto
294comes from the opportunistic fallback mechanism in the NPN extension.
295This behavior does not make sense for ALPN,
296where missing protocol overlap should result in a handshake failure.
297To avoid accidental selection of a protocol that the server does not
298support, it is recommended to pass the locally configured protocols
299as second pair of protocols in the ALPN callback.
300.Sh BUGS
301The
302.Fa out
303argument of
304.Fn SSL_select_next_proto
305should have been const.