1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | SSL_SESSION_get0_hostname,
|
---|
6 | SSL_SESSION_set1_hostname,
|
---|
7 | SSL_SESSION_get0_alpn_selected,
|
---|
8 | SSL_SESSION_set1_alpn_selected
|
---|
9 | - get and set SNI and ALPN data associated with a session
|
---|
10 |
|
---|
11 | =head1 SYNOPSIS
|
---|
12 |
|
---|
13 | #include <openssl/ssl.h>
|
---|
14 |
|
---|
15 | const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s);
|
---|
16 | int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname);
|
---|
17 |
|
---|
18 | void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s,
|
---|
19 | const unsigned char **alpn,
|
---|
20 | size_t *len);
|
---|
21 | int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, const unsigned char *alpn,
|
---|
22 | size_t len);
|
---|
23 |
|
---|
24 | =head1 DESCRIPTION
|
---|
25 |
|
---|
26 | SSL_SESSION_get0_hostname() retrieves the SNI value that was sent by the
|
---|
27 | client when the session was created if it was accepted by the server and TLSv1.2
|
---|
28 | or below was negotiated. Otherwise NULL is returned. Note that in TLSv1.3 the
|
---|
29 | SNI hostname is negotiated with each handshake including resumption handshakes
|
---|
30 | and is therefore never associated with the session.
|
---|
31 |
|
---|
32 | The value returned is a pointer to memory maintained within B<s> and
|
---|
33 | should not be free'd.
|
---|
34 |
|
---|
35 | SSL_SESSION_set1_hostname() sets the SNI value for the hostname to a copy of
|
---|
36 | the string provided in hostname.
|
---|
37 |
|
---|
38 | SSL_SESSION_get0_alpn_selected() retrieves the selected ALPN protocol for this
|
---|
39 | session and its associated length in bytes. The returned value of B<*alpn> is a
|
---|
40 | pointer to memory maintained within B<s> and should not be free'd.
|
---|
41 |
|
---|
42 | SSL_SESSION_set1_alpn_selected() sets the ALPN protocol for this session to the
|
---|
43 | value in B<alpn> which should be of length B<len> bytes. A copy of the input
|
---|
44 | value is made, and the caller retains ownership of the memory pointed to by
|
---|
45 | B<alpn>.
|
---|
46 |
|
---|
47 | =head1 RETURN VALUES
|
---|
48 |
|
---|
49 | SSL_SESSION_get0_hostname() returns either a string or NULL based on if there
|
---|
50 | is the SNI value sent by client.
|
---|
51 |
|
---|
52 | SSL_SESSION_set1_hostname() returns 1 on success or 0 on error.
|
---|
53 |
|
---|
54 | SSL_SESSION_set1_alpn_selected() returns 1 on success or 0 on error.
|
---|
55 |
|
---|
56 | =head1 SEE ALSO
|
---|
57 |
|
---|
58 | L<ssl(7)>,
|
---|
59 | L<d2i_SSL_SESSION(3)>,
|
---|
60 | L<SSL_SESSION_get_time(3)>,
|
---|
61 | L<SSL_SESSION_free(3)>
|
---|
62 |
|
---|
63 | =head1 HISTORY
|
---|
64 |
|
---|
65 | The SSL_SESSION_set1_hostname(), SSL_SESSION_get0_alpn_selected() and
|
---|
66 | SSL_SESSION_set1_alpn_selected() functions were added in OpenSSL 1.1.1.
|
---|
67 |
|
---|
68 | =head1 COPYRIGHT
|
---|
69 |
|
---|
70 | Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
---|
71 |
|
---|
72 | Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
73 | this file except in compliance with the License. You can obtain a copy
|
---|
74 | in the file LICENSE in the source distribution or at
|
---|
75 | L<https://www.openssl.org/source/license.html>.
|
---|
76 |
|
---|
77 | =cut
|
---|