Fix no-ssl3 configuration option
authorGeoff Thorpe <geoff@openssl.org>
Wed, 15 Oct 2014 07:25:50 +0000 (03:25 -0400)
committerGeoff Thorpe <geoff@openssl.org>
Wed, 15 Oct 2014 12:46:57 +0000 (08:46 -0400)
CVE-2014-3568

Reviewed-by: Emilia Kasper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
ssl/s23_clnt.c
ssl/s23_srvr.c

index 910682d32791e03da23b70558c68b6df9d5eaf91..123120868a4f8d43818dbca423ae564de854a5fc 100644 (file)
@@ -72,9 +72,11 @@ static SSL_METHOD *ssl23_get_client_method(int ver)
        if (ver == SSL2_VERSION)
                return(SSLv2_client_method());
 #endif
+#ifndef OPENSSL_NO_SSL3
        if (ver == SSL3_VERSION)
                return(SSLv3_client_method());
-       else if (ver == TLS1_VERSION)
+#endif
+       if (ver == TLS1_VERSION)
                return(TLSv1_client_method());
        else
                return(NULL);
@@ -533,6 +535,7 @@ static int ssl23_get_server_hello(SSL *s)
                {
                /* we have sslv3 or tls1 (server hello or alert) */
 
+#ifndef OPENSSL_NO_SSL3
                if ((p[2] == SSL3_VERSION_MINOR) &&
                        !(s->options & SSL_OP_NO_SSLv3))
                        {
@@ -547,7 +550,9 @@ static int ssl23_get_server_hello(SSL *s)
                        s->version=SSL3_VERSION;
                        s->method=SSLv3_client_method();
                        }
-               else if ((p[2] == TLS1_VERSION_MINOR) &&
+               else
+#endif
+               if ((p[2] == TLS1_VERSION_MINOR) &&
                        !(s->options & SSL_OP_NO_TLSv1))
                        {
                        s->version=TLS1_VERSION;
index df0887315905988a649ea7de6e444f58e32eec7d..3d0069baf3e2af93b0a82979736a7f9933101c49 100644 (file)
@@ -124,9 +124,11 @@ static SSL_METHOD *ssl23_get_server_method(int ver)
        if (ver == SSL2_VERSION)
                return(SSLv2_server_method());
 #endif
+#ifndef OPENSSL_NO_SSL3
        if (ver == SSL3_VERSION)
                return(SSLv3_server_method());
-       else if (ver == TLS1_VERSION)
+#endif
+       if (ver == TLS1_VERSION)
                return(TLSv1_server_method());
        else
                return(NULL);
@@ -557,6 +559,12 @@ int ssl23_get_client_hello(SSL *s)
        if ((type == 2) || (type == 3))
                {
                /* we have SSLv3/TLSv1 (type 2: SSL2 style, type 3: SSL3/TLS style) */
+                s->method = ssl23_get_server_method(s->version);
+               if (s->method == NULL)
+                       {
+                       SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO,SSL_R_UNSUPPORTED_PROTOCOL);
+                       goto err;
+                       }
 
                if (!ssl_init_wbio_buffer(s,1)) goto err;
 
@@ -580,11 +588,6 @@ int ssl23_get_client_hello(SSL *s)
                        s->s3->rbuf.left=0;
                        s->s3->rbuf.offset=0;
                        }
-
-               if (s->version == TLS1_VERSION)
-                       s->method = TLSv1_server_method();
-               else
-                       s->method = SSLv3_server_method();
 #if 0 /* ssl3_get_client_hello does this */
                s->client_version=(v[0]<<8)|v[1];
 #endif