5c122908ab
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
|
||
---|---|---|
.. | ||
.cvsignore | ||
bio_ssl.c | ||
d1_both.c | ||
d1_clnt.c | ||
d1_enc.c | ||
d1_lib.c | ||
d1_meth.c | ||
d1_pkt.c | ||
d1_srtp.c | ||
d1_srvr.c | ||
dtls1.h | ||
heartbeat_test.c | ||
install-ssl.com | ||
kssl.c | ||
kssl.h | ||
kssl_lcl.h | ||
Makefile | ||
s2_clnt.c | ||
s2_enc.c | ||
s2_lib.c | ||
s2_meth.c | ||
s2_pkt.c | ||
s2_srvr.c | ||
s3_both.c | ||
s3_cbc.c | ||
s3_clnt.c | ||
s3_enc.c | ||
s3_lib.c | ||
s3_meth.c | ||
s3_pkt.c | ||
s3_srvr.c | ||
s23_clnt.c | ||
s23_lib.c | ||
s23_meth.c | ||
s23_pkt.c | ||
s23_srvr.c | ||
srtp.h | ||
ssl-lib.com | ||
ssl.h | ||
ssl2.h | ||
ssl3.h | ||
ssl23.h | ||
ssl_algs.c | ||
ssl_asn1.c | ||
ssl_cert.c | ||
ssl_ciph.c | ||
ssl_err.c | ||
ssl_err2.c | ||
ssl_lib.c | ||
ssl_locl.h | ||
ssl_rsa.c | ||
ssl_sess.c | ||
ssl_stat.c | ||
ssl_task.c | ||
ssl_txt.c | ||
ssl_utst.c | ||
ssltest.c | ||
t1_clnt.c | ||
t1_enc.c | ||
t1_lib.c | ||
t1_meth.c | ||
t1_reneg.c | ||
t1_srvr.c | ||
tls1.h | ||
tls_srp.c |