openssl/ssl
Benjamin Kaduk a75be9fd34 Improve backwards compat for SSL_get_servername()
Commit 1c4aa31d79 changed how we process
and store SNI information during the handshake, so that a hostname is
only saved in the SSL_SESSION structure if that SNI value has actually
been negotiated.  SSL_get_servername() was adjusted to match, with a new
conditional being added to handle the case when the handshake processing
is ongoing, and a different location should be consulted for the offered
SNI value.  This was done in an attempt to preserve the historical
behavior of SSL_get_servername(), a function whose behavior only mostly
matches its documentation, and whose documentation is both lacking and
does not necessarily reflect the actual desired behavior for such an
API.  Unfortunately, sweeping changes that would bring more sanity to
this space are not possible until OpenSSL 1.2.0, for ABI compatibility
reasons, so we must attempt to maintain the existing behavior to the
extent possible.

The above-mentioned commit did not take into account the behavior
of SSL_get_servername() during resumption handshakes for TLS 1.2 and
prior, where no SNI negotiation is performed.  In that case we would
not properly parse the incoming SNI and erroneously return NULL as
the servername, when instead the logical session is associated with
the SNI value cached in the SSL_SESSION.  (Note that in some cases an
SNI callback may not need to do anything in a TLS 1.2 or prior resumption
flow, but we are calling the callbacks and did not provide any guidance
that they should no-op if the connection is being resumed, so we must
handle this case in a usable fashion.)  Update our behavior accordingly to
return the session's cached value during the handshake, when resuming.
This fixes the boringssl tests.

[extended tests]

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6792)
2018-07-26 15:06:53 -05:00
..
record Introduce the recv_max_early_data setting 2018-07-06 09:26:39 +01:00
statem Normalize SNI hostname handling for SSL and SSL_SESSION 2018-07-20 07:12:24 -05:00
bio_ssl.c
build.info
d1_lib.c
d1_msg.c
d1_srtp.c
methods.c
packet_locl.h Remove __cplusplus preamble from internal headers 2018-06-22 12:24:59 +02:00
packet.c Update copyright year 2018-04-17 15:18:40 +02:00
pqueue.c Use void in all function definitions that do not take any arguments 2018-05-11 14:37:48 +02:00
s3_cbc.c
s3_enc.c
s3_lib.c Add TODO comment for a nonsensical public API 2018-07-20 07:12:24 -05:00
s3_msg.c
ssl_asn1.c Don't use OPENSSL_strdup() for copying alpn_selected 2018-06-21 11:07:45 +01:00
ssl_cert_table.h
ssl_cert.c Check that the public key OID matches the sig alg 2018-07-18 09:58:56 +01:00
ssl_ciph.c Fix configuration of TLSv1.3 ciphersuites 2018-04-04 16:17:26 +01:00
ssl_conf.c Add the ability to configure anti-replay via SSL_CONF 2018-07-02 15:06:12 +01:00
ssl_err.c Validate legacy_version 2018-07-20 10:52:02 +01:00
ssl_init.c Add a config option to disable automatic config loading 2018-04-17 16:33:15 +02:00
ssl_lib.c Improve backwards compat for SSL_get_servername() 2018-07-26 15:06:53 -05:00
ssl_locl.h Check that the public key OID matches the sig alg 2018-07-18 09:58:56 +01:00
ssl_mcnf.c Move the loading of the ssl_conf module to libcrypto 2018-04-05 15:30:12 +01:00
ssl_rsa.c
ssl_sess.c Normalize SNI hostname handling for SSL and SSL_SESSION 2018-07-20 07:12:24 -05:00
ssl_stat.c
ssl_txt.c Address coverity-reported NULL dereference in SSL_SESSION_print() 2018-07-01 18:20:11 -05:00
ssl_utst.c
t1_enc.c
t1_lib.c Check that the public key OID matches the sig alg 2018-07-18 09:58:56 +01:00
t1_trce.c Suport TLSv1.3 draft 28 2018-05-15 10:02:59 +01:00
tls13_enc.c Fix TLSv1.3 ticket nonces 2018-06-07 10:58:35 +01:00
tls_srp.c