openssl/ssl
Benjamin Kaduk 1c4aa31d79 Normalize SNI hostname handling for SSL and SSL_SESSION
In particular, adhere to the rule that we must not modify any
property of an SSL_SESSION object once it is (or might be) in
a session cache.  Such modifications are thread-unsafe and have
been observed to cause crashes at runtime.

To effect this change, standardize on the property that
SSL_SESSION->ext.hostname is set only when that SNI value
has been negotiated by both parties for use with that session.
For session resumption this is trivially the case, so only new
handshakes are affected.

On the client, the new semantics are that the SSL->ext.hostname is
for storing the value configured by the caller, and this value is
used when constructing the ClientHello.  On the server, SSL->ext.hostname
is used to hold the value received from the client.  Only if the
SNI negotiation is successful will the hostname be stored into the
session object; the server can do this after it sends the ServerHello,
and the client after it has received and processed the ServerHello.

This obviates the need to remove the hostname from the session object
in case of failed negotiation (a change that was introduced in commit
9fb6cb810b in order to allow TLS 1.3
early data when SNI was present in the ClientHello but not the session
being resumed), which was modifying cached sessions in certain cases.
(In TLS 1.3 we always produce a new SSL_SESSION object for new
connections, even in the case of resumption, so no TLS 1.3 handshakes
were affected.)

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6378)
2018-07-20 07:12:24 -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 Update copyright year 2018-03-20 13:08:46 +00:00
s3_lib.c Fix no-psk 2018-05-14 17:43:19 +01: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 Update copyright year 2018-03-20 13:08:46 +00:00
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 Normalize SNI hostname handling for SSL and SSL_SESSION 2018-07-20 07:12:24 -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 Update copyright year 2018-03-20 13:08:46 +00:00
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 GOST MAC algorithms don't support EVP_PKEY_new_raw_private_key() 2018-03-30 19:28:33 +01:00
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 Use the private RNG for data that is not public 2018-04-02 22:22:43 +02:00