openssl/ssl
Matt Caswell 5c122908ab 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>
(cherry picked from commit a0bd649336)
2015-05-13 11:25:10 +01:00
..
.cvsignore Add emacs cache files to .cvsignore. 2005-04-11 14:17:07 +00:00
bio_ssl.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
d1_both.c Code style: space after 'if' 2015-04-16 13:51:51 -04:00
d1_clnt.c Add more error state transitions (DTLS) 2015-05-05 20:09:14 +01:00
d1_enc.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
d1_lib.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
d1_meth.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
d1_pkt.c Harmonize return values in dtls1_buffer_record 2015-03-10 13:52:37 -07:00
d1_srtp.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
d1_srvr.c Don't allow a CCS when expecting a CertificateVerify 2015-05-13 11:25:10 +01:00
dtls1.h Fix d2i_SSL_SESSION for DTLS1_BAD_VER 2015-02-27 20:32:49 +00:00
heartbeat_test.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
install-ssl.com Don't forget to install srtp.h as well 2012-05-10 15:01:22 +00:00
kssl.c Re-align some comments after running the reformat script. 2015-01-22 09:39:01 +00:00
kssl.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
kssl_lcl.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
Makefile make update 2015-04-21 17:53:36 +02:00
s2_clnt.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
s2_enc.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
s2_lib.c Fix reachable assert in SSLv2 servers. 2015-03-19 12:59:31 +00:00
s2_meth.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
s2_pkt.c Add length sanity check in SSLv2 n_do_ssl_write() 2015-04-29 17:44:02 +01:00
s2_srvr.c Harden SSLv2-supporting servers against Bleichenbacher's attack. 2015-04-08 16:42:28 +02:00
s3_both.c Sanity check the return from final_finish_mac 2015-04-30 23:27:05 +01:00
s3_cbc.c Add sanity check in ssl3_cbc_digest_record 2015-04-30 23:26:07 +01:00
s3_clnt.c Add more error state transitions (client) 2015-05-05 20:08:35 +01:00
s3_enc.c Cleanse buffers 2015-03-11 10:49:22 +00:00
s3_lib.c Rerun util/openssl-format-source -v -c . 2015-01-22 09:38:49 +00:00
s3_meth.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
s3_pkt.c Use constants not numbers 2015-03-05 09:30:35 +00:00
s3_srvr.c Don't allow a CCS when expecting a CertificateVerify 2015-05-13 11:25:10 +01:00
s23_clnt.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
s23_lib.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
s23_meth.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
s23_pkt.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
s23_srvr.c Re-align some comments after running the reformat script. 2015-01-22 09:39:01 +00:00
srtp.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl-lib.com Spaces were added in some strings for better readability. However, those spaces do not belong in file names, so when picking out the individual parts, remove the spaces 2014-10-15 10:49:24 +02:00
ssl.h Add Error state 2015-05-05 20:07:48 +01:00
ssl2.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl3.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl23.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl_algs.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl_asn1.c Fix d2i_SSL_SESSION for DTLS1_BAD_VER 2015-02-27 20:32:49 +00:00
ssl_cert.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl_ciph.c Remove export ciphers from the DEFAULT cipher list 2015-03-07 23:08:12 +01:00
ssl_err.c Repair EAP-FAST session resumption 2015-04-21 19:37:17 +02:00
ssl_err2.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl_lib.c Check sk_SSL_CIPHER_new_null return value 2015-05-11 11:54:10 +01:00
ssl_locl.h fix warning 2015-03-08 22:42:23 +00:00
ssl_rsa.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl_sess.c Add sanity check to ssl_get_prev_session 2015-04-30 23:27:07 +01:00
ssl_stat.c Add Error state 2015-05-05 20:07:48 +01:00
ssl_task.c Re-align some comments after running the reformat script. 2015-01-22 09:39:01 +00:00
ssl_txt.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssl_utst.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
ssltest.c Fix error handling in ssltest 2015-02-06 10:10:49 +00:00
t1_clnt.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
t1_enc.c Sanity check EVP_CTRL_AEAD_TLS_AAD 2015-04-30 23:26:06 +01:00
t1_lib.c Code style: space after 'if' 2015-04-16 13:51:51 -04:00
t1_meth.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
t1_reneg.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
t1_srvr.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
tls1.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
tls_srp.c Code style: space after 'if' 2015-04-16 13:51:51 -04:00