Module Name: src
Committed By: snj
Date: Tue Jan 12 09:19:38 UTC 2010
Modified Files:
src/crypto/dist/openssl/ssl [netbsd-4-0]: s3_lib.c s3_pkt.c s3_srvr.c
ssl_locl.h
Log Message:
Apply patch (requested by tonnerre in ticket #1373):
Disable OpenSSL renegotiation, thus avoiding CVE-2009-3555.
To generate a diff of this commit:
cvs rdiff -u -r1.11.2.1 -r1.11.2.1.2.1 src/crypto/dist/openssl/ssl/s3_lib.c
cvs rdiff -u -r1.6.4.1.2.1 -r1.6.4.1.2.2 src/crypto/dist/openssl/ssl/s3_pkt.c
cvs rdiff -u -r1.13.2.1.2.1 -r1.13.2.1.2.2 \
src/crypto/dist/openssl/ssl/s3_srvr.c
cvs rdiff -u -r1.11 -r1.11.12.1 src/crypto/dist/openssl/ssl/ssl_locl.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/crypto/dist/openssl/ssl/s3_lib.c
diff -u src/crypto/dist/openssl/ssl/s3_lib.c:1.11.2.1 src/crypto/dist/openssl/ssl/s3_lib.c:1.11.2.1.2.1
--- src/crypto/dist/openssl/ssl/s3_lib.c:1.11.2.1 Sat Aug 25 17:53:00 2007
+++ src/crypto/dist/openssl/ssl/s3_lib.c Tue Jan 12 09:19:37 2010
@@ -2375,6 +2375,9 @@
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: src/crypto/dist/openssl/ssl/s3_pkt.c
diff -u src/crypto/dist/openssl/ssl/s3_pkt.c:1.6.4.1.2.1 src/crypto/dist/openssl/ssl/s3_pkt.c:1.6.4.1.2.2
--- src/crypto/dist/openssl/ssl/s3_pkt.c:1.6.4.1.2.1 Sun Jul 5 00:57:34 2009
+++ src/crypto/dist/openssl/ssl/s3_pkt.c Tue Jan 12 09:19:37 2010
@@ -979,6 +979,7 @@
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);
@@ -1111,7 +1112,8 @@
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: src/crypto/dist/openssl/ssl/s3_srvr.c
diff -u src/crypto/dist/openssl/ssl/s3_srvr.c:1.13.2.1.2.1 src/crypto/dist/openssl/ssl/s3_srvr.c:1.13.2.1.2.2
--- src/crypto/dist/openssl/ssl/s3_srvr.c:1.13.2.1.2.1 Sun Jul 5 00:41:02 2009
+++ src/crypto/dist/openssl/ssl/s3_srvr.c Tue Jan 12 09:19:37 2010
@@ -672,6 +672,14 @@
#endif
STACK_OF(SSL_CIPHER) *ciphers=NULL;
+ 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, ERR_R_INTERNAL_ERROR);
+ goto f_err;
+ }
+
/* 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,
* This down switching should be handled by a different method.
Index: src/crypto/dist/openssl/ssl/ssl_locl.h
diff -u src/crypto/dist/openssl/ssl/ssl_locl.h:1.11 src/crypto/dist/openssl/ssl/ssl_locl.h:1.11.12.1
--- src/crypto/dist/openssl/ssl/ssl_locl.h:1.11 Mon Nov 13 21:55:37 2006
+++ src/crypto/dist/openssl/ssl/ssl_locl.h Tue Jan 12 09:19:37 2010
@@ -397,6 +397,8 @@
#define NAMED_CURVE_TYPE 3
#endif /* OPENSSL_NO_EC */
+#define SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x0010
+
typedef struct cert_pkey_st
{
X509 *x509;