openssl/ssl
Matt Caswell a0bd649336 Don't allow a CCS when expecting a CertificateVerify
Currently we set change_cipher_spec_ok to 1 before calling
ssl3_get_cert_verify(). This is because this message is optional and if it
is not sent then the next thing we would expect to get is the CCS. However,
although it is optional, we do actually know whether we should be receiving
one in advance. If we have received a client cert then we should expect
a CertificateVerify message. By the time we get to this point we will
already have bombed out if we didn't get a Certificate when we should have
done, so it is safe just to check whether |peer| is NULL or not. If it is
we won't get a CertificateVerify, otherwise we will. Therefore we should
change the logic so that we only attempt to get the CertificateVerify if
we are expecting one, and not allow a CCS in this scenario.

Whilst this is good practice for TLS it is even more important for DTLS.
In DTLS messages can be lost. Therefore we may be in a situation where a
CertificateVerify message does not arrive even though one was sent. In that
case the next message the server will receive will be the CCS. This could
also happen if messages get re-ordered in-flight. In DTLS if
|change_cipher_spec_ok| is not set and a CCS is received it is ignored.
However if |change_cipher_spec_ok| *is* set then a CCS arrival will
immediately move the server into the next epoch. Any messages arriving for
the previous epoch will be ignored. This means that, in this scenario, the
handshake can never complete. The client will attempt to retransmit
missing messages, but the server will ignore them because they are the wrong
epoch. The server meanwhile will still be waiting for the CertificateVerify
which is never going to arrive.

RT#2958

Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-05-13 11:17:17 +01:00
..
record memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
bio_ssl.c memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
d1_both.c memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
d1_clnt.c Add more error state transitions (DTLS) 2015-05-05 19:45:59 +01:00
d1_lib.c memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
d1_meth.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
d1_msg.c memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
d1_srtp.c Use p==NULL not !p (in if statements, mainly) 2015-05-11 10:06:38 -04:00
d1_srvr.c Don't allow a CCS when expecting a CertificateVerify 2015-05-13 11:17:17 +01:00
install-ssl.com Remove SSL_TASK, the DECnet Based SSL Engine - addendum 2015-03-31 22:19:22 +02:00
kssl.c Use p==NULL not !p (in if statements, mainly) 2015-05-11 10:06:38 -04:00
kssl_lcl.h Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
Makefile make update 2015-05-05 09:06:27 +01:00
s3_both.c Sanity check the return from final_finish_mac 2015-04-30 23:12:39 +01:00
s3_cbc.c Add sanity check in ssl3_cbc_digest_record 2015-04-30 23:12:39 +01:00
s3_clnt.c Use p==NULL not !p (in if statements, mainly) 2015-05-11 10:06:38 -04:00
s3_enc.c memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
s3_lib.c Fix cipherlist order. 2015-05-12 20:51:54 +01:00
s3_meth.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
s3_msg.c Introduce the functions RECORD_LAYER_release, RECORD_LAYER_read_pending, and 2015-03-26 15:01:59 +00:00
s3_srvr.c Don't allow a CCS when expecting a CertificateVerify 2015-05-13 11:17:17 +01:00
s23_clnt.c free NULL cleanup -- coda 2015-05-01 14:37:16 -04:00
s23_lib.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
s23_meth.c OPENSSL_NO_XXX cleanup: NO_TLS, NO_TLS1 2015-01-27 15:14:12 -05:00
s23_srvr.c Code style: space after 'if' 2015-04-16 13:44:59 -04:00
ssl-lib.com Remove SSL_TASK, the DECnet Based SSL Engine 2015-03-31 21:59:43 +02:00
ssl_algs.c Fix missing return value checks 2015-03-23 15:23:11 +00:00
ssl_asn1.c ssl/ssl_asn1.c: Fix typo introduced via cc5b6a03a3 2015-05-05 09:06:15 +01:00
ssl_cert.c memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
ssl_ciph.c Make COMP_CTX and COMP_METHOD opaque 2015-05-12 10:24:48 -04:00
ssl_conf.c Add SSL_use_certificate_chain_file function 2015-05-08 18:43:44 +01:00
ssl_err.c Add SSL_use_certificate_chain_file function 2015-05-08 18:43:44 +01:00
ssl_err2.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
ssl_lib.c Make COMP_CTX and COMP_METHOD opaque 2015-05-12 10:24:48 -04:00
ssl_locl.h Make COMP_CTX and COMP_METHOD opaque 2015-05-12 10:24:48 -04:00
ssl_rsa.c Add SSL_use_certificate_chain_file function 2015-05-08 18:43:44 +01:00
ssl_sess.c memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
ssl_stat.c Add Error state 2015-05-05 19:45:17 +01:00
ssl_txt.c Make COMP_CTX and COMP_METHOD opaque 2015-05-12 10:24:48 -04:00
ssl_utst.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
t1_clnt.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
t1_enc.c Use safer sizeof variant in malloc 2015-05-04 15:00:13 -04:00
t1_ext.c memset, memcpy, sizeof consistency fixes 2015-05-05 22:18:59 -04:00
t1_lib.c Use "==0" instead of "!strcmp" etc 2015-05-06 22:37:53 -04:00
t1_meth.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
t1_reneg.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
t1_srvr.c Run util/openssl-format-source -v -c . 2015-01-22 09:20:09 +00:00
t1_trce.c Add OSSL_NELEM macro. 2015-05-03 12:53:08 +01:00
tls_srp.c Use p==NULL not !p (in if statements, mainly) 2015-05-11 10:06:38 -04:00