Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: net/third_party/nss/patches/restartclientauth.patch

Issue 9558017: Update net/third_party/nss to NSS 3.13.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Upload before checkin Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 From 3c9aa423a3e721fc2223dc5f64d21cc5b4898d4e Mon Sep 17 00:00:00 2001 1 diff -up a/src/net/third_party/nss/ssl/ssl.h b/src/net/third_party/nss/ssl/ssl.h
2 From: Adam Langley <agl@chromium.org> 2 --- a/src/net/third_party/nss/ssl/ssl.h»2012-02-29 17:49:08.431530583 -0800
3 Date: Mon, 3 Oct 2011 12:27:03 -0400 3 +++ b/src/net/third_party/nss/ssl/ssl.h»2012-02-29 19:07:19.298439815 -0800
4 Subject: [PATCH] restartclientauth.patch 4 @@ -306,6 +306,11 @@ SSL_IMPORT SECStatus SSL_ForceHandshake(
5
6 ---
7 mozilla/security/nss/lib/ssl/ssl.h | 5 ++
8 mozilla/security/nss/lib/ssl/ssl3con.c | 70 +++++++++++++++++++++----------
9 mozilla/security/nss/lib/ssl/sslimpl.h | 4 --
10 mozilla/security/nss/lib/ssl/sslsecur.c | 35 ++++++++++++---
11 4 files changed, 80 insertions(+), 34 deletions(-)
12
13 diff --git a/mozilla/security/nss/lib/ssl/ssl.h b/mozilla/security/nss/lib/ssl/s sl.h
14 index 835d3cf..7e748bd 100644
15 --- a/mozilla/security/nss/lib/ssl/ssl.h
16 +++ b/mozilla/security/nss/lib/ssl/ssl.h
17 @@ -236,6 +236,11 @@ SSL_IMPORT SECStatus SSL_ForceHandshake(PRFileDesc *fd);
18 SSL_IMPORT SECStatus SSL_ForceHandshakeWithTimeout(PRFileDesc *fd, 5 SSL_IMPORT SECStatus SSL_ForceHandshakeWithTimeout(PRFileDesc *fd,
19 PRIntervalTime timeout); 6 PRIntervalTime timeout);
20 7
21 +SSL_IMPORT SECStatus SSL_RestartHandshakeAfterCertReq(PRFileDesc *fd, 8 +SSL_IMPORT SECStatus SSL_RestartHandshakeAfterCertReq(PRFileDesc *fd,
22 + CERTCertificate *cert, 9 + CERTCertificate *cert,
23 + SECKEYPrivateKey *key, 10 + SECKEYPrivateKey *key,
24 + CERTCertificateList *certChain); 11 + CERTCertificateList *certChain);
25 + 12 +
26 /* 13 /*
27 ** Query security status of socket. *on is set to one if security is 14 ** Query security status of socket. *on is set to one if security is
28 ** enabled. *keySize will contain the stream key size used. *issuer will 15 ** enabled. *keySize will contain the stream key size used. *issuer will
29 diff --git a/mozilla/security/nss/lib/ssl/ssl3con.c b/mozilla/security/nss/lib/s sl/ssl3con.c 16 diff -up a/src/net/third_party/nss/ssl/ssl3con.c b/src/net/third_party/nss/ssl/s sl3con.c
30 index f8838d6..d372ee2 100644 17 --- a/src/net/third_party/nss/ssl/ssl3con.c» 2012-02-29 17:49:08.431530583 -0 800
31 --- a/mozilla/security/nss/lib/ssl/ssl3con.c 18 +++ b/src/net/third_party/nss/ssl/ssl3con.c» 2012-02-29 18:55:27.038466043 -0 800
32 +++ b/mozilla/security/nss/lib/ssl/ssl3con.c 19 @@ -5769,6 +5769,84 @@ done:
33 @@ -5667,9 +5667,10 @@ done: 20 return rv;
34 *» » reference count. The caller should drop its reference 21 }
35 *» » without calling CERT_DestroyCert after calling this function. 22
36 * 23 +/*
37 - *» key» Private key associated with cert. This function makes a 24 + * attempt to restart the handshake after asynchronously handling
38 - *» » copy of the private key, so the caller remains responsible 25 + * a request for the client's certificate.
39 - *» » for destroying its copy after this function returns. 26 + *
27 + * inputs:
28 + *» cert» Client cert chosen by application.
29 + *» » Note: ssl takes this reference, and does not bump the
30 + *» » reference count. The caller should drop its reference
31 + *» » without calling CERT_DestroyCert after calling this function.
32 + *
40 + * key Private key associated with cert. This function takes 33 + * key Private key associated with cert. This function takes
41 + * ownership of the private key, so the caller should drop its 34 + * ownership of the private key, so the caller should drop its
42 + * reference without destroying the private key after this 35 + * reference without destroying the private key after this
43 + * function returns. 36 + * function returns.
44 * 37 + *
45 *» certChain DER-encoded certs, client cert and its signers. 38 + *» certChain DER-encoded certs, client cert and its signers.
46 *» » Note: ssl takes this reference, and does not copy the chain. 39 + *» » Note: ssl takes this reference, and does not copy the chain.
47 @@ -5689,27 +5690,50 @@ ssl3_RestartHandshakeAfterCertReq(sslSocket * ss , 40 + *» » The caller should drop its reference without destroying the
48 » » » » SECKEYPrivateKey * key, 41 + *» » chain. SSL will free the chain when it is done with it.
49 » » » » CERTCertificateList *certChain) 42 + *
50 { 43 + * Return value: XXX
51 - SECStatus rv = SECSuccess; 44 + *
52 + SECStatus rv = SECFailure; 45 + * XXX This code only works on the initial handshake on a connection, XXX
53 46 + * It does not work on a subsequent handshake (redo).
54 - if (MSB(ss->version) == MSB(SSL_LIBRARY_VERSION_3_0)) { 47 + *
55 -» /* XXX This code only works on the initial handshake on a connection, 48 + * Caller holds 1stHandshakeLock.
56 -» ** XXX It does not work on a subsequent handshake (redo). 49 + */
57 -» */ 50 +SECStatus
58 -» if (ss->handshake != 0) { 51 +ssl3_RestartHandshakeAfterCertReq(sslSocket * ss,
59 -» ss->handshake = ssl_GatherRecord1stHandshake; 52 +» » » » CERTCertificate * cert,
60 -» ss->ssl3.clientCertificate = cert; 53 +» » » » SECKEYPrivateKey * key,
61 -» ss->ssl3.clientCertChain = certChain; 54 +» » » » CERTCertificateList *certChain)
62 -» if (key == NULL) { 55 +{
63 -» » (void)SSL3_SendAlert(ss, alert_warning, no_certificate); 56 + SECStatus rv = SECSuccess;
64 -» » ss->ssl3.clientPrivateKey = NULL; 57 +
65 -» } else {
66 -» » ss->ssl3.clientPrivateKey = SECKEY_CopyPrivateKey(key);
67 -» }
68 -» ssl_GetRecvBufLock(ss);
69 -» if (ss->ssl3.hs.msgState.buf != NULL) {
70 -» » rv = ssl3_HandleRecord(ss, NULL, &ss->gs.buf);
71 -» }
72 -» ssl_ReleaseRecvBufLock(ss);
73 + /* XXX This code only works on the initial handshake on a connection, 58 + /* XXX This code only works on the initial handshake on a connection,
74 + ** XXX It does not work on a subsequent handshake (redo). 59 + ** XXX It does not work on a subsequent handshake (redo).
75 + */ 60 + */
76 + if (ss->handshake != 0) { 61 + if (ss->handshake != 0) {
77 + ss->handshake = ssl_GatherRecord1stHandshake; 62 + ss->handshake = ssl_GatherRecord1stHandshake;
78 + ss->ssl3.clientCertificate = cert; 63 + ss->ssl3.clientCertificate = cert;
79 + ss->ssl3.clientPrivateKey = key; 64 + ss->ssl3.clientPrivateKey = key;
80 + ss->ssl3.clientCertChain = certChain; 65 + ss->ssl3.clientCertChain = certChain;
81 + if (!cert || !key || !certChain) { 66 + if (!cert || !key || !certChain) {
82 + /* we are missing the key, cert, or cert chain */ 67 + /* we are missing the key, cert, or cert chain */
83 + if (ss->ssl3.clientCertificate) { 68 + if (ss->ssl3.clientCertificate) {
84 + CERT_DestroyCertificate(ss->ssl3.clientCertificate); 69 + CERT_DestroyCertificate(ss->ssl3.clientCertificate);
85 + ss->ssl3.clientCertificate = NULL; 70 + ss->ssl3.clientCertificate = NULL;
86 + } 71 + }
87 + if (ss->ssl3.clientPrivateKey) { 72 + if (ss->ssl3.clientPrivateKey) {
88 + SECKEY_DestroyPrivateKey(ss->ssl3.clientPrivateKey); 73 + SECKEY_DestroyPrivateKey(ss->ssl3.clientPrivateKey);
89 + ss->ssl3.clientPrivateKey = NULL; 74 + ss->ssl3.clientPrivateKey = NULL;
90 + } 75 + }
91 + if (ss->ssl3.clientCertChain != NULL) { 76 + if (ss->ssl3.clientCertChain != NULL) {
92 + CERT_DestroyCertificateList(ss->ssl3.clientCertChain); 77 + CERT_DestroyCertificateList(ss->ssl3.clientCertChain);
93 + ss->ssl3.clientCertChain = NULL; 78 + ss->ssl3.clientCertChain = NULL;
94 + } 79 + }
95 + if (ss->ssl3.prSpec->version > SSL_LIBRARY_VERSION_3_0) { 80 + if (ss->ssl3.prSpec->version > SSL_LIBRARY_VERSION_3_0) {
96 + ss->ssl3.sendEmptyCert = PR_TRUE; 81 + ss->ssl3.sendEmptyCert = PR_TRUE;
97 + } else { 82 + } else {
98 + (void)SSL3_SendAlert(ss, alert_warning, no_certificate); 83 + (void)SSL3_SendAlert(ss, alert_warning, no_certificate);
99 + } 84 + }
100 + } 85 + }
101 + ssl_GetRecvBufLock(ss);
102 + if (ss->ssl3.hs.msgState.buf != NULL) {
103 + rv = ssl3_HandleRecord(ss, NULL, &ss->gs.buf);
104 + }
105 + ssl_ReleaseRecvBufLock(ss);
106 + } else { 86 + } else {
107 + if (cert) { 87 + if (cert) {
108 + CERT_DestroyCertificate(cert); 88 + CERT_DestroyCertificate(cert);
109 + } 89 + }
110 + if (key) { 90 + if (key) {
111 + SECKEY_DestroyPrivateKey(key); 91 + SECKEY_DestroyPrivateKey(key);
112 + } 92 + }
113 + if (certChain) { 93 + if (certChain) {
114 + CERT_DestroyCertificateList(certChain); 94 + CERT_DestroyCertificateList(certChain);
115 » } 95 +» }
116 } 96 +» rv = SECFailure;
117 return rv; 97 + }
118 diff --git a/mozilla/security/nss/lib/ssl/sslimpl.h b/mozilla/security/nss/lib/s sl/sslimpl.h 98 + return rv;
119 index 906874a..70ff4c3 100644 99 +}
120 --- a/mozilla/security/nss/lib/ssl/sslimpl.h 100 +
121 +++ b/mozilla/security/nss/lib/ssl/sslimpl.h 101 PRBool
122 @@ -1356,10 +1356,6 @@ extern SECStatus ssl3_MasterKeyDeriveBypass( ssl3CipherS pec * pwSpec, 102 ssl3_CanFalseStart(sslSocket *ss) {
103 PRBool rv;
104 diff -up a/src/net/third_party/nss/ssl/sslimpl.h b/src/net/third_party/nss/ssl/s slimpl.h
105 --- a/src/net/third_party/nss/ssl/sslimpl.h» 2012-02-29 17:49:08.431530583 -0 800
106 +++ b/src/net/third_party/nss/ssl/sslimpl.h» 2012-02-29 19:05:27.766882356 -0 800
107 @@ -1392,15 +1392,16 @@ extern SECStatus ssl3_MasterKeyDeriveBy
108 /* These functions are called from secnav, even though they're "private". */
123 109
124 extern int ssl2_SendErrorMessage(struct sslSocketStr *ss, int error); 110 extern int ssl2_SendErrorMessage(struct sslSocketStr *ss, int error);
125 extern int SSL_RestartHandshakeAfterServerCert(struct sslSocketStr *ss);
126 -extern int SSL_RestartHandshakeAfterCertReq(struct sslSocketStr *ss, 111 -extern int SSL_RestartHandshakeAfterCertReq(struct sslSocketStr *ss,
127 - CERTCertificate *cert, 112 - CERTCertificate *cert,
128 - SECKEYPrivateKey *key, 113 - SECKEYPrivateKey *key,
129 - CERTCertificateList *certChain); 114 - CERTCertificateList *certChain);
130 extern sslSocket *ssl_FindSocket(PRFileDesc *fd); 115 extern sslSocket *ssl_FindSocket(PRFileDesc *fd);
131 extern void ssl_FreeSocket(struct sslSocketStr *ssl); 116 extern void ssl_FreeSocket(struct sslSocketStr *ssl);
132 extern SECStatus SSL3_SendAlert(sslSocket *ss, SSL3AlertLevel level, 117 extern SECStatus SSL3_SendAlert(sslSocket *ss, SSL3AlertLevel level,
133 diff --git a/mozilla/security/nss/lib/ssl/sslsecur.c b/mozilla/security/nss/lib/ ssl/sslsecur.c 118 » » » » SSL3AlertDescription desc);
134 index dc374e0..bb5f0eb 100644 119
135 --- a/mozilla/security/nss/lib/ssl/sslsecur.c 120 +extern SECStatus ssl3_RestartHandshakeAfterCertReq(sslSocket * ss,
136 +++ b/mozilla/security/nss/lib/ssl/sslsecur.c 121 +» » » » » CERTCertificate * cert,
137 @@ -1460,11 +1460,13 @@ SSL_CertDBHandleSet(PRFileDesc *fd, CERTCertDBHandle *db Handle) 122 +» » » » » SECKEYPrivateKey * key,
138 *» cert» Client cert chosen by application. 123 +» » » » » CERTCertificateList *certChain);
139 *» » Note: ssl takes this reference, and does not bump the 124 +
140 *» » reference count. The caller should drop its reference 125 extern SECStatus ssl3_AuthCertificateComplete(sslSocket *ss, PRErrorCode error) ;
141 - *» » without calling CERT_DestroyCert after calling this function. 126
127 /*
128 diff -up a/src/net/third_party/nss/ssl/sslsecur.c b/src/net/third_party/nss/ssl/ sslsecur.c
129 --- a/src/net/third_party/nss/ssl/sslsecur.c» 2012-02-28 16:15:34.790321976 -0 800
130 +++ b/src/net/third_party/nss/ssl/sslsecur.c» 2012-02-29 19:01:32.303586125 -0 800
131 @@ -1468,17 +1468,70 @@ SSL_CertDBHandleSet(PRFileDesc *fd, CERT
132 return SECSuccess;
133 }
134
135 -/* DO NOT USE. This function was exported in ssl.def with the wrong signature;
136 - * this implementation exists to maintain link-time compatibility.
137 +/*
138 + * attempt to restart the handshake after asynchronously handling
139 + * a request for the client's certificate.
140 + *
141 + * inputs:
142 + *» cert» Client cert chosen by application.
143 + *» » Note: ssl takes this reference, and does not bump the
144 + *» » reference count. The caller should drop its reference
142 + * without calling CERT_DestroyCertificate after calling this 145 + * without calling CERT_DestroyCertificate after calling this
143 + * function. 146 + * function.
144 * 147 + *
145 - *» key» Private key associated with cert. This function makes a
146 - *» » copy of the private key, so the caller remains responsible
147 - *» » for destroying its copy after this function returns.
148 + * key Private key associated with cert. This function takes 148 + * key Private key associated with cert. This function takes
149 + * ownership of the private key, so the caller should drop its 149 + * ownership of the private key, so the caller should drop its
150 + * reference without destroying the private key after this 150 + * reference without destroying the private key after this
151 + * function returns. 151 + * function returns.
152 * 152 + *
153 *» certChain Chain of signers for cert. 153 + *» certChain Chain of signers for cert.
154 *» » Note: ssl takes this reference, and does not copy the chain. 154 + *» » Note: ssl takes this reference, and does not copy the chain.
155 @@ -1476,19 +1478,38 @@ SSL_CertDBHandleSet(PRFileDesc *fd, CERTCertDBHandle *db Handle) 155 + *» » The caller should drop its reference without destroying the
156 * XXX This code only works on the initial handshake on a connection, XXX 156 + *» » chain. SSL will free the chain when it is done with it.
157 * It does not work on a subsequent handshake (redo). 157 + *
158 + * Return value: XXX
159 + *
160 + * XXX This code only works on the initial handshake on a connection, XXX
161 + * It does not work on a subsequent handshake (redo).
158 */ 162 */
159 -int 163 -int
160 -SSL_RestartHandshakeAfterCertReq(sslSocket * ss, 164 -SSL_RestartHandshakeAfterCertReq(sslSocket * ss,
161 +SECStatus 165 +SECStatus
162 +SSL_RestartHandshakeAfterCertReq(PRFileDesc * fd, 166 +SSL_RestartHandshakeAfterCertReq(PRFileDesc * fd,
163 CERTCertificate * cert, 167 CERTCertificate * cert,
164 SECKEYPrivateKey * key, 168 SECKEYPrivateKey * key,
165 CERTCertificateList *certChain) 169 CERTCertificateList *certChain)
166 { 170 {
167 - int ret; 171 - PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
172 - return -1;
168 + sslSocket * ss = ssl_FindSocket(fd); 173 + sslSocket * ss = ssl_FindSocket(fd);
169 + SECStatus ret; 174 + SECStatus ret;
170 + 175 +
171 + if (!ss) { 176 + if (!ss) {
172 + SSL_DBG(("%d: SSL[%d]: bad socket in SSL_RestartHandshakeAfterCertReq", 177 + SSL_DBG(("%d: SSL[%d]: bad socket in SSL_RestartHandshakeAfterCertReq",
173 + SSL_GETPID(), fd)); 178 + SSL_GETPID(), fd));
174 + if (cert) { 179 + if (cert) {
175 + CERT_DestroyCertificate(cert); 180 + CERT_DestroyCertificate(cert);
176 + } 181 + }
177 + if (key) { 182 + if (key) {
178 + SECKEY_DestroyPrivateKey(key); 183 + SECKEY_DestroyPrivateKey(key);
179 + } 184 + }
180 + if (certChain) { 185 + if (certChain) {
181 + CERT_DestroyCertificateList(certChain); 186 + CERT_DestroyCertificateList(certChain);
182 + } 187 + }
183 + return SECFailure; 188 + return SECFailure;
184 + } 189 + }
185 190 +
186 ssl_Get1stHandshakeLock(ss); /************************************/ 191 + ssl_Get1stHandshakeLock(ss); /************************************/
187 192 +
188 if (ss->version >= SSL_LIBRARY_VERSION_3_0) { 193 + if (ss->version >= SSL_LIBRARY_VERSION_3_0) {
189 » ret = ssl3_RestartHandshakeAfterCertReq(ss, cert, key, certChain); 194 +» ret = ssl3_RestartHandshakeAfterCertReq(ss, cert, key, certChain);
190 } else { 195 + } else {
191 + if (certChain != NULL) { 196 + if (certChain != NULL) {
192 + CERT_DestroyCertificateList(certChain); 197 + CERT_DestroyCertificateList(certChain);
193 + } 198 + }
194 » ret = ssl2_RestartHandshakeAfterCertReq(ss, cert, key); 199 +» PORT_SetError(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_SSL2);
195 } 200 +» ret = SECFailure;
201 + }
202 +
203 + ssl_Release1stHandshakeLock(ss); /************************************/
204 + return ret;
205 }
196 206
207 /* DO NOT USE. This function was exported in ssl.def with the wrong signature;
OLDNEW
« no previous file with comments | « net/third_party/nss/patches/peercertchain.patch ('k') | net/third_party/nss/patches/secret_exporter.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698