summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorEmilia Käsper <emilia@openssl.org>2014-07-24 22:15:29 +0200
committerMatt Caswell <matt@openssl.org>2014-08-06 22:02:00 +0100
commitbff5319d9038765f864ef06e2e3c766f5c01dbd7 (patch)
tree2dfd8c1bae7dbdce968a5c1ee934dfc43f6358d7 /ssl
parentfc4bd2f287582c5f51f9549727fd5a49e9fc3012 (diff)
Fix DTLS anonymous EC(DH) denial of service
CVE-2014-3510 Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r--ssl/d1_clnt.c16
-rw-r--r--ssl/s3_clnt.c7
2 files changed, 21 insertions, 2 deletions
diff --git a/ssl/d1_clnt.c b/ssl/d1_clnt.c
index ac24bfb35e..58a3b46994 100644
--- a/ssl/d1_clnt.c
+++ b/ssl/d1_clnt.c
@@ -796,6 +796,13 @@ int dtls1_send_client_key_exchange(SSL *s)
RSA *rsa;
unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH];
+ if (s->session->sess_cert == NULL)
+ {
+ /* We should always have a server certificate with SSL_kRSA. */
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
if (s->session->sess_cert->peer_rsa_tmp != NULL)
rsa=s->session->sess_cert->peer_rsa_tmp;
else
@@ -986,6 +993,13 @@ int dtls1_send_client_key_exchange(SSL *s)
{
DH *dh_srvr,*dh_clnt;
+ if (s->session->sess_cert == NULL)
+ {
+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE);
+ SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNEXPECTED_MESSAGE);
+ goto err;
+ }
+
if (s->session->sess_cert->peer_dh_tmp != NULL)
dh_srvr=s->session->sess_cert->peer_dh_tmp;
else
@@ -1226,5 +1240,3 @@ int dtls1_send_client_certificate(SSL *s)
/* SSL3_ST_CW_CERT_D */
return(dtls1_do_write(s,SSL3_RT_HANDSHAKE));
}
-
-
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
index 4b41a2be9d..c11048edaa 100644
--- a/ssl/s3_clnt.c
+++ b/ssl/s3_clnt.c
@@ -1916,6 +1916,13 @@ int ssl3_send_client_key_exchange(SSL *s)
RSA *rsa;
unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH];
+ if (s->session->sess_cert == NULL)
+ {
+ /* We should always have a server certificate with SSL_kRSA. */
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
if (s->session->sess_cert->peer_rsa_tmp != NULL)
rsa=s->session->sess_cert->peer_rsa_tmp;
else