Belt and braces. Use existing code to disable renegotiation. Die if we
authorBen Laurie <ben@openssl.org>
Thu, 5 Nov 2009 16:07:42 +0000 (16:07 +0000)
committerBen Laurie <ben@openssl.org>
Thu, 5 Nov 2009 16:07:42 +0000 (16:07 +0000)
see a client hello.

ssl/s3_lib.c
ssl/s3_pkt.c
ssl/s3_srvr.c
ssl/ssl3.h

index 8916a0b1b3c718b7fd9fd4be273ff3630c070f71..5aa7bb21da13cde5f366f0da472aac763afde77a 100644 (file)
@@ -2592,6 +2592,9 @@ int ssl3_renegotiate(SSL *s)
        if (s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)
                return(0);
 
+       if (!(s->s3->flags & SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION))
+               return(0);
+
        s->s3->renegotiate=1;
        return(1);
        }
index 9476dcddf6e958f6f3c566c3279f3f44bf74c4d7..b98b84044fd32382adfaa2cf796b36f88f9306b8 100644 (file)
@@ -985,6 +985,7 @@ start:
 
                if (SSL_is_init_finished(s) &&
                        !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) &&
+                       (s->s3->flags & SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION) &&
                        !s->s3->renegotiate)
                        {
                        ssl3_renegotiate(s);
@@ -1117,7 +1118,8 @@ start:
        if ((s->s3->handshake_fragment_len >= 4) &&     !s->in_handshake)
                {
                if (((s->state&SSL_ST_MASK) == SSL_ST_OK) &&
-                       !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS))
+                       !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) &&
+                       (s->s3->flags & SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION))
                        {
 #if 0 /* worked only because C operator preferences are not as expected (and
        * because this is not really needed for clients except for detecting
index 6719ecf02e2932a18f88b05a0eec7a4819036743..79f3706c314181bf8d983db1934a988246da2551 100644 (file)
@@ -718,14 +718,13 @@ int ssl3_get_client_hello(SSL *s)
 #endif
        STACK_OF(SSL_CIPHER) *ciphers=NULL;
 
-#ifdef OPENSSL_ENABLE_UNSAFE_LEGACY_SESSION_RENEGOTATION
-       if (s->new_session)
+       if (s->new_session
+           && !(s->s3->flags&SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION))
                {
                al=SSL_AD_HANDSHAKE_FAILURE;
-               SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_RENEGOTIATION);
+               SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
                goto f_err;
                }
-#endif  /* ndef OPENSSL_ENABLE_UNSAFE_LEGACY_SESSION_RENEGOTATION */
 
        /* We do this so that we will respond with our native type.
         * If we are TLSv1 and we get SSLv3, we will respond with TLSv1,
index 4b1e2e9834775497d922ab72a7bfc94799398a8d..a1a19cbfcbf6623ee856498b3669f0042226ca72 100644 (file)
@@ -326,10 +326,11 @@ typedef struct ssl3_buffer_st
 #define SSL3_CT_NUMBER                 7
 
 
-#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS      0x0001
-#define SSL3_FLAGS_DELAY_CLIENT_FINISHED       0x0002
-#define SSL3_FLAGS_POP_BUFFER                  0x0004
-#define TLS1_FLAGS_TLS_PADDING_BUG             0x0008
+#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS              0x0001
+#define SSL3_FLAGS_DELAY_CLIENT_FINISHED               0x0002
+#define SSL3_FLAGS_POP_BUFFER                          0x0004
+#define TLS1_FLAGS_TLS_PADDING_BUG                     0x0008
+#define SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION   0x0010
 
 typedef struct ssl3_state_st
        {