summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2012-02-16 15:21:46 +0000
committerDr. Stephen Henson <steve@openssl.org>2012-02-16 15:21:46 +0000
commit25128a11fba414b06ba4b48f6b9186c1641ca410 (patch)
tree05abf6f0bdec15a1f08b87fb1fbbee6817d00e34 /ssl
parent3deb968fec4fd5789346f620ddc23b9596daae34 (diff)
Fix bug in CVE-2011-4619: check we have really received a client hello
before rejecting multiple SGC restarts.
Diffstat (limited to 'ssl')
-rw-r--r--ssl/s3_srvr.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index d734c359fb..a79c986da3 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -756,14 +756,6 @@ int ssl3_check_client_hello(SSL *s)
int ok;
long n;
- /* We only allow the client to restart the handshake once per
- * negotiation. */
- if (s->s3->flags & SSL3_FLAGS_SGC_RESTART_DONE)
- {
- SSLerr(SSL_F_SSL3_CHECK_CLIENT_HELLO, SSL_R_MULTIPLE_SGC_RESTARTS);
- return -1;
- }
-
/* this function is called when we really expect a Certificate message,
* so permit appropriate message length */
n=s->method->ssl_get_message(s,
@@ -776,6 +768,13 @@ int ssl3_check_client_hello(SSL *s)
s->s3->tmp.reuse_message = 1;
if (s->s3->tmp.message_type == SSL3_MT_CLIENT_HELLO)
{
+ /* We only allow the client to restart the handshake once per
+ * negotiation. */
+ if (s->s3->flags & SSL3_FLAGS_SGC_RESTART_DONE)
+ {
+ SSLerr(SSL_F_SSL3_CHECK_CLIENT_HELLO, SSL_R_MULTIPLE_SGC_RESTARTS);
+ return -1;
+ }
/* Throw away what we have done so far in the current handshake,
* which will now be aborted. (A full SSL_clear would be too much.) */
#ifndef OPENSSL_NO_DH