| OLD | NEW |
| 1 From 4c2b4b3992f81f062248f03296f7eb59b5fc0868 Mon Sep 17 00:00:00 2001 | 1 From 4c2b4b3992f81f062248f03296f7eb59b5fc0868 Mon Sep 17 00:00:00 2001 |
| 2 From: Adam Langley <agl@chromium.org> | 2 From: Adam Langley <agl@chromium.org> |
| 3 Date: Mon, 3 Oct 2011 12:20:29 -0400 | 3 Date: Mon, 3 Oct 2011 12:20:29 -0400 |
| 4 Subject: [PATCH] cachecerts.patch | 4 Subject: [PATCH] cachecerts.patch |
| 5 | 5 |
| 6 --- | 6 --- |
| 7 mozilla/security/nss/lib/ssl/ssl3con.c | 54 +++++++++++++++++++++++++++++- | 7 mozilla/security/nss/lib/ssl/ssl3con.c | 54 +++++++++++++++++++++++++++++- |
| 8 mozilla/security/nss/lib/ssl/sslimpl.h | 3 ++ | 8 mozilla/security/nss/lib/ssl/sslimpl.h | 3 ++ |
| 9 mozilla/security/nss/lib/ssl/sslnonce.c | 4 ++ | 9 mozilla/security/nss/lib/ssl/sslnonce.c | 4 ++ |
| 10 3 files changed, 59 insertions(+), 2 deletions(-) | 10 3 files changed, 59 insertions(+), 2 deletions(-) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 + ssl3CertNode *c = certs; | 75 + ssl3CertNode *c = certs; |
| 76 + for (; i < MAX_PEER_CERT_CHAIN_SIZE && c; i++, c = c->next) { | 76 + for (; i < MAX_PEER_CERT_CHAIN_SIZE && c; i++, c = c->next) { |
| 77 + PORT_Assert(!sid->peerCertChain[i]); | 77 + PORT_Assert(!sid->peerCertChain[i]); |
| 78 + sid->peerCertChain[i] = CERT_DupCertificate(c->cert); | 78 + sid->peerCertChain[i] = CERT_DupCertificate(c->cert); |
| 79 + } | 79 + } |
| 80 +} | 80 +} |
| 81 + | 81 + |
| 82 /* Called from ssl3_HandleHandshakeMessage() when it has deciphered a complete | 82 /* Called from ssl3_HandleHandshakeMessage() when it has deciphered a complete |
| 83 * ssl3 Certificate message. | 83 * ssl3 Certificate message. |
| 84 * Caller must hold Handshake and RecvBuf locks. | 84 * Caller must hold Handshake and RecvBuf locks. |
| 85 @@ -7769,6 +7810,7 @@ static SECStatus | |
| 86 ssl3_HandleCertificate(sslSocket *ss, SSL3Opaque *b, PRUint32 length) | |
| 87 { | |
| 88 ssl3CertNode * c; | |
| 89 + ssl3CertNode * lastCert = NULL; | |
| 90 ssl3CertNode * certs = NULL; | |
| 91 PRArenaPool * arena = NULL; | |
| 92 CERTCertificate *cert; | |
| 93 @@ -7896,8 +7938,13 @@ ssl3_HandleCertificate(sslSocket *ss, SSL3Opaque *b, PRUi
nt32 length) | |
| 94 if (c->cert->trust) | |
| 95 trusted = PR_TRUE; | |
| 96 | |
| 97 - c->next = certs; | |
| 98 - certs = c; | |
| 99 + c->next = NULL; | |
| 100 + if (lastCert) { | |
| 101 + lastCert->next = c; | |
| 102 + } else { | |
| 103 + certs = c; | |
| 104 + } | |
| 105 + lastCert = c; | |
| 106 } | |
| 107 | |
| 108 if (remaining != 0) | |
| 109 @@ -7947,6 +7994,7 @@ ssl3_HandleCertificate(sslSocket *ss, SSL3Opaque *b, PRUin
t32 length) | 85 @@ -7947,6 +7994,7 @@ ssl3_HandleCertificate(sslSocket *ss, SSL3Opaque *b, PRUin
t32 length) |
| 110 } | 86 } |
| 111 | 87 |
| 112 ss->sec.ci.sid->peerCert = CERT_DupCertificate(ss->sec.peerCert); | 88 ss->sec.ci.sid->peerCert = CERT_DupCertificate(ss->sec.peerCert); |
| 113 + ssl3_CopyPeerCertsToSID(certs, ss->sec.ci.sid); | 89 + ssl3_CopyPeerCertsToSID(ss->ssl3.peerCertChain, ss->sec.ci.sid); |
| 114 | 90 |
| 115 if (!ss->sec.isServer) { | 91 if (!ss->sec.isServer) { |
| 116 /* set the server authentication and key exchange types and sizes | 92 /* set the server authentication and key exchange types and sizes |
| 117 @@ -8118,6 +8166,8 @@ ssl3_RestartHandshakeAfterServerCert(sslSocket *ss) | |
| 118 if (ss->handshake != NULL) { | |
| 119 ss->handshake = ssl_GatherRecord1stHandshake; | |
| 120 ss->sec.ci.sid->peerCert = CERT_DupCertificate(ss->sec.peerCert); | |
| 121 + ssl3_CopyPeerCertsToSID((ssl3CertNode *)ss->ssl3.peerCertChain, | |
| 122 + ss->sec.ci.sid); | |
| 123 | |
| 124 ssl_GetRecvBufLock(ss); | |
| 125 if (ss->ssl3.hs.msgState.buf != NULL) { | |
| 126 diff --git a/mozilla/security/nss/lib/ssl/sslimpl.h b/mozilla/security/nss/lib/s
sl/sslimpl.h | 93 diff --git a/mozilla/security/nss/lib/ssl/sslimpl.h b/mozilla/security/nss/lib/s
sl/sslimpl.h |
| 127 index d1c1181..48d6d83 100644 | 94 index d1c1181..48d6d83 100644 |
| 128 --- a/mozilla/security/nss/lib/ssl/sslimpl.h | 95 --- a/mozilla/security/nss/lib/ssl/sslimpl.h |
| 129 +++ b/mozilla/security/nss/lib/ssl/sslimpl.h | 96 +++ b/mozilla/security/nss/lib/ssl/sslimpl.h |
| 130 @@ -569,10 +569,13 @@ typedef enum { never_cached, | 97 @@ -569,10 +569,13 @@ typedef enum { never_cached, |
| 131 invalid_cache /* no longer in any cache. */ | 98 invalid_cache /* no longer in any cache. */ |
| 132 } Cached; | 99 } Cached; |
| 133 | 100 |
| 134 +#define MAX_PEER_CERT_CHAIN_SIZE 8 | 101 +#define MAX_PEER_CERT_CHAIN_SIZE 8 |
| 135 + | 102 + |
| (...skipping 20 matching lines...) Expand all Loading... |
| 156 @@ -216,6 +217,9 @@ ssl_DestroySID(sslSessionID *sid) | 123 @@ -216,6 +217,9 @@ ssl_DestroySID(sslSessionID *sid) |
| 157 if ( sid->peerCert ) { | 124 if ( sid->peerCert ) { |
| 158 CERT_DestroyCertificate(sid->peerCert); | 125 CERT_DestroyCertificate(sid->peerCert); |
| 159 } | 126 } |
| 160 + for (i = 0; i < MAX_PEER_CERT_CHAIN_SIZE && sid->peerCertChain[i]; i++) { | 127 + for (i = 0; i < MAX_PEER_CERT_CHAIN_SIZE && sid->peerCertChain[i]; i++) { |
| 161 + CERT_DestroyCertificate(sid->peerCertChain[i]); | 128 + CERT_DestroyCertificate(sid->peerCertChain[i]); |
| 162 + } | 129 + } |
| 163 if ( sid->localCert ) { | 130 if ( sid->localCert ) { |
| 164 CERT_DestroyCertificate(sid->localCert); | 131 CERT_DestroyCertificate(sid->localCert); |
| 165 } | 132 } |
| OLD | NEW |