summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2009-12-16 20:25:59 +0000
committerDr. Stephen Henson <steve@openssl.org>2009-12-16 20:25:59 +0000
commitef51b4b9b469fc93a91de47b63a143a3c60c5530 (patch)
tree41aa22b18fc09720e33516ba30082b786d08ce51
parentc27c9cb4f7ab74d772521fd927918f354724c2fc (diff)
New option to enable/disable connection to unpatched servers
-rw-r--r--CHANGES5
-rw-r--r--apps/s_client.c9
-rw-r--r--ssl/ssl.h2
-rw-r--r--ssl/ssl3.h2
-rw-r--r--ssl/ssl_lib.c4
-rw-r--r--ssl/t1_lib.c5
6 files changed, 24 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index ed3870c7c4..8041501448 100644
--- a/CHANGES
+++ b/CHANGES
@@ -863,6 +863,11 @@
Changes between 0.9.8l (?) and 0.9.8m (?) [xx XXX xxxx]
+ *) Add option SSL_OP_LEGACY_SERVER_CONNECT which will allow clients to
+ connect (but not renegotiate) with servers which do not support RI.
+ Until RI is more widely deployed this option is enabled by default.
+ [Steve Henson]
+
*) Add "missing" ssl ctrls to clear options and mode.
[Steve Henson]
diff --git a/apps/s_client.c b/apps/s_client.c
index a52e728a16..484d009987 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -383,7 +383,7 @@ int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
- int off=0;
+ unsigned int off=0, clr=0;
SSL *con=NULL;
int s,k,width,state=0;
char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
@@ -666,6 +666,10 @@ int MAIN(int argc, char **argv)
off|=SSL_OP_CIPHER_SERVER_PREFERENCE;
else if (strcmp(*argv,"-legacy_renegotiation") == 0)
off|=SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION;
+ else if (strcmp(*argv,"-legacy_server_connect") == 0)
+ { off|=SSL_OP_LEGACY_SERVER_CONNECT; }
+ else if (strcmp(*argv,"-no_legacy_server_connect") == 0)
+ { clr|=SSL_OP_LEGACY_SERVER_CONNECT; }
else if (strcmp(*argv,"-cipher") == 0)
{
if (--argc < 1) goto bad;
@@ -876,6 +880,9 @@ bad:
SSL_CTX_set_options(ctx,SSL_OP_ALL|off);
else
SSL_CTX_set_options(ctx,off);
+
+ if (clr)
+ SSL_CTX_clear_options(ctx, clr);
/* DTLS: partial reads end up discarding unread UDP bytes :-(
* Setting read ahead solves this problem.
*/
diff --git a/ssl/ssl.h b/ssl/ssl.h
index dbfcca7bef..3c3ab46efd 100644
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -518,6 +518,8 @@ typedef struct ssl_session_st
#define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L
#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L
+/* Allow initial connection to servers that don't support RI */
+#define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004L
#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L
#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x00000010L
#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L
diff --git a/ssl/ssl3.h b/ssl/ssl3.h
index d929569aef..414ad2d58a 100644
--- a/ssl/ssl3.h
+++ b/ssl/ssl3.h
@@ -129,7 +129,9 @@ extern "C" {
#endif
/* Magic Cipher Suite Value. NB: bogus value used for testing */
+#ifndef SSL3_CK_MCSV
#define SSL3_CK_MCSV 0x03000FEC
+#endif
#define SSL3_CK_RSA_NULL_MD5 0x03000001
#define SSL3_CK_RSA_NULL_SHA 0x03000002
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 6e29f9a4c6..8d37e4914a 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -1677,6 +1677,10 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
}
#endif
#endif
+ /* Default is to connect to non-RI servers. When RI is more widely
+ * deployed might change this.
+ */
+ ret->options = SSL_OP_LEGACY_SERVER_CONNECT;
return(ret);
err:
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index bdbb806fa5..667892690b 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -1157,8 +1157,9 @@ int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
* which doesn't support RI so for the immediate future tolerate RI
* absence on initial connect only.
*/
- if (!renegotiate_seen && s->new_session &&
- !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION))
+ if (!renegotiate_seen &&
+ (s->new_session || !(s->options & SSL_OP_LEGACY_SERVER_CONNECT))
+ && !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION))
{
/* FIXME: Spec currently doesn't give alert to use */
*al = SSL_AD_ILLEGAL_PARAMETER;