openssl/ssl
Benjamin Kaduk 44bad9cbf7 Code to thread-safety in ChangeCipherState
The server-side ChangeCipherState processing stores the new cipher
in the SSL_SESSION object, so that the new state can be used if
this session gets resumed.  However, writing to the session is only
thread-safe for initial handshakes, as at other times the session
object may be in a shared cache and in use by another thread at the
same time.  Reflect this invariant in the code by only writing to
s->session->cipher when it is currently NULL (we do not cache sessions
with no cipher).  The code prior to this change would never actually
change the (non-NULL) cipher value in a session object, since our
server enforces that (pre-TLS-1.3) resumptions use the exact same
cipher as the initial connection, and non-abbreviated renegotiations
have produced a new session object before we get to this point.
Regardless, include logic to detect such a condition and abort the
handshake if it occurs, to avoid any risk of inadvertently using
the wrong cipher on a connection.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10943)

(cherry picked from commit 2e3ec2e1578977fca830a47fd7f521e290540e6d)
2020-03-13 16:11:45 -07:00
..
record Detect EOF while reading in libssl 2020-02-20 17:02:30 +00:00
statem Code to thread-safety in ChangeCipherState 2020-03-13 16:11:45 -07:00
bio_ssl.c Reorganize local header files 2019-09-27 23:58:06 +02:00
build.info Move ssl/t1_ext.c to ssl/statem/extensions_cust.c 2017-04-07 13:41:04 +01:00
d1_lib.c Reorganize local header files 2019-09-27 23:58:06 +02:00
d1_msg.c Reorganize local header files 2019-09-27 23:58:06 +02:00
d1_srtp.c Reorganize local header files 2019-09-27 23:58:06 +02:00
methods.c Reorganize local header files 2019-09-27 23:58:06 +02:00
packet.c Reorganize local header files 2019-09-27 23:58:06 +02:00
packet_local.h Fix header file include guard names 2019-09-27 23:58:12 +02:00
pqueue.c Reorganize local header files 2019-09-27 23:58:06 +02:00
s3_cbc.c Reorganize local header files 2019-09-27 23:58:06 +02:00
s3_enc.c Reorganize local header files 2019-09-27 23:58:06 +02:00
s3_lib.c Fix whitespace nit in ssl_generate_master_secret() 2020-03-13 15:55:50 -07:00
s3_msg.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_asn1.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_cert.c SSL: Document SSL_add_{file,dir}_cert_subjects_to_stack() 2019-11-12 13:43:33 +01:00
ssl_cert_table.h Update copyright year 2018-03-20 13:08:46 +00:00
ssl_ciph.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_conf.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_err.c Detect EOF while reading in libssl 2020-02-20 17:02:30 +00:00
ssl_init.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_lib.c Fix SSL_get_servername() and SNI behaviour 2020-01-30 16:07:12 +00:00
ssl_local.h Check that the default signature type is allowed 2020-01-25 14:12:10 +01:00
ssl_mcnf.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_rsa.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_sess.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_stat.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_txt.c Reorganize local header files 2019-09-27 23:58:06 +02:00
ssl_utst.c Reorganize local header files 2019-09-27 23:58:06 +02:00
t1_enc.c Fix some typos 2019-12-11 19:17:00 +01:00
t1_lib.c Check that ed25519 and ed448 are allowed by the security level 2020-02-16 11:55:42 +01:00
t1_trce.c Do not print extensions in Certificate message for TLS1.2 and lower 2019-10-03 10:30:57 +10:00
tls13_enc.c Update tls13_enc.c 2020-01-02 13:52:10 +01:00
tls_srp.c Reorganize local header files 2019-09-27 23:58:06 +02:00