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

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

Issue 11275240: Update net/third_party/nss/ssl to NSS 3.14. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Upload before commit Created 8 years, 1 month 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 diff --git a/net/third_party/nss/ssl/SSLerrs.h b/net/third_party/nss/ssl/SSLerrs .h 1 diff -pu -r a/net/third_party/nss/ssl/ssl3con.c b/net/third_party/nss/ssl/ssl3co n.c
2 index e3f9a1c..2d92514 100644 2 --- a/net/third_party/nss/ssl/ssl3con.c»2012-11-09 15:57:12.838336618 -0800
3 --- a/net/third_party/nss/ssl/SSLerrs.h 3 +++ b/net/third_party/nss/ssl/ssl3con.c»2012-11-09 16:11:46.721027895 -0800
4 +++ b/net/third_party/nss/ssl/SSLerrs.h 4 @@ -53,6 +53,7 @@ static SECStatus ssl3_SendCertificate(
5 @@ -429,3 +429,12 @@ ER3(SSL_ERROR_RX_MALFORMED_HELLO_VERIFY_REQUEST, (SSL_ERROR _BASE + 122),
6
7 ER3(SSL_ERROR_RX_UNEXPECTED_HELLO_VERIFY_REQUEST, (SSL_ERROR_BASE + 123),
8 "SSL received an unexpected Hello Verify Request handshake message.")
9 +
10 +ER3(SSL_ERROR_BAD_CHANNEL_ID_DATA, (SSL_ERROR_BASE + 124),
11 +"SSL received a malformed TLS Channel ID extension.")
12 +
13 +ER3(SSL_ERROR_INVALID_CHANNEL_ID_KEY, (SSL_ERROR_BASE + 125),
14 +"The application provided an invalid TLS Channel ID key.")
15 +
16 +ER3(SSL_ERROR_GET_CHANNEL_ID_FAILED, (SSL_ERROR_BASE + 126),
17 +"The application could not get a TLS Channel ID.")
18 diff --git a/net/third_party/nss/ssl/ssl.h b/net/third_party/nss/ssl/ssl.h
19 index 1368e2f..9b3a199 100644
20 --- a/net/third_party/nss/ssl/ssl.h
21 +++ b/net/third_party/nss/ssl/ssl.h
22 @@ -945,6 +945,34 @@ SSL_IMPORT SECStatus SSL_HandshakeNegotiatedExtension(PRFil eDesc * socket,
23 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd,
24 PRBool *last_handshake_resumed );
25
26 +/* See SSL_SetClientChannelIDCallback for usage. If the callback returns
27 + * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in
28 + * the future to restart the handshake. On SECSuccess, the callback must have
29 + * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */
30 +typedef SECStatus (PR_CALLBACK *SSLClientChannelIDCallback)(
31 + void *arg,
32 + PRFileDesc *fd,
33 + SECKEYPublicKey **out_public_key,
34 + SECKEYPrivateKey **out_private_key);
35 +
36 +/* SSL_RestartHandshakeAfterChannelIDReq attempts to restart the handshake
37 + * after a ChannelID callback returned SECWouldBlock.
38 + *
39 + * This function takes ownership of |channelIDPub| and |channelID|. */
40 +SSL_IMPORT SECStatus SSL_RestartHandshakeAfterChannelIDReq(
41 + PRFileDesc *fd,
42 + SECKEYPublicKey *channelIDPub,
43 + SECKEYPrivateKey *channelID);
44 +
45 +/* SSL_SetClientChannelIDCallback sets a callback function that will be called
46 + * once the server's ServerHello has been processed. This is only applicable to
47 + * a client socket and setting this callback causes the TLS Channel ID
48 + * extension to be advertised. */
49 +SSL_IMPORT SECStatus SSL_SetClientChannelIDCallback(
50 + PRFileDesc *fd,
51 + SSLClientChannelIDCallback callback,
52 + void *arg);
53 +
54 /*
55 ** How long should we wait before retransmitting the next flight of
56 ** the DTLS handshake? Returns SECFailure if not DTLS or not in a
57 diff --git a/net/third_party/nss/ssl/ssl3con.c b/net/third_party/nss/ssl/ssl3con .c
58 index db9fad3..cb2906f 100644
59 --- a/net/third_party/nss/ssl/ssl3con.c
60 +++ b/net/third_party/nss/ssl/ssl3con.c
61 @@ -86,6 +86,7 @@ static SECStatus ssl3_SendCertificate( sslSocket *ss);
62 static SECStatus ssl3_SendEmptyCertificate( sslSocket *ss); 5 static SECStatus ssl3_SendEmptyCertificate( sslSocket *ss);
63 static SECStatus ssl3_SendCertificateRequest(sslSocket *ss); 6 static SECStatus ssl3_SendCertificateRequest(sslSocket *ss);
64 static SECStatus ssl3_SendNextProto( sslSocket *ss); 7 static SECStatus ssl3_SendNextProto( sslSocket *ss);
65 +static SECStatus ssl3_SendEncryptedExtensions(sslSocket *ss); 8 +static SECStatus ssl3_SendEncryptedExtensions(sslSocket *ss);
66 static SECStatus ssl3_SendFinished( sslSocket *ss, PRInt32 flags); 9 static SECStatus ssl3_SendFinished( sslSocket *ss, PRInt32 flags);
67 static SECStatus ssl3_SendServerHello( sslSocket *ss); 10 static SECStatus ssl3_SendServerHello( sslSocket *ss);
68 static SECStatus ssl3_SendServerHelloDone( sslSocket *ss); 11 static SECStatus ssl3_SendServerHelloDone( sslSocket *ss);
69 @@ -5200,6 +5201,15 @@ ssl3_HandleServerHello(sslSocket *ss, SSL3Opaque *b, PRUi nt32 length) 12 @@ -5330,6 +5331,15 @@ ssl3_HandleServerHello(sslSocket *ss, SS
70 } 13 }
71 #endif /* NSS_PLATFORM_CLIENT_AUTH */ 14 #endif /* NSS_PLATFORM_CLIENT_AUTH */
72 15
73 + if (ss->ssl3.channelID != NULL) { 16 + if (ss->ssl3.channelID != NULL) {
74 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID); 17 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID);
75 + ss->ssl3.channelID = NULL; 18 + ss->ssl3.channelID = NULL;
76 + } 19 + }
77 + if (ss->ssl3.channelIDPub != NULL) { 20 + if (ss->ssl3.channelIDPub != NULL) {
78 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); 21 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub);
79 + ss->ssl3.channelIDPub = NULL; 22 + ss->ssl3.channelIDPub = NULL;
80 + } 23 + }
81 + 24 +
82 temp = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length); 25 temp = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length);
83 if (temp < 0) { 26 if (temp < 0) {
84 goto loser; /* alert has been sent */ 27 goto loser; /* alert has been sent */
85 @@ -5452,13 +5462,12 @@ ssl3_HandleServerHello(sslSocket *ss, SSL3Opaque *b, PRU int32 length) 28 @@ -5603,7 +5613,7 @@ ssl3_HandleServerHello(sslSocket *ss, SS
86 » ssl3_CopyPeerCertsFromSID(ss, sid);
87 » }
88
89 -
90 » /* NULL value for PMS signifies re-use of the old MS */
91 » rv = ssl3_InitPendingCipherSpec(ss, NULL);
92 if (rv != SECSuccess) { 29 if (rv != SECSuccess) {
93 goto alert_loser; /* err code was set */ 30 goto alert_loser; /* err code was set */
94 } 31 }
95 - return SECSuccess; 32 - return SECSuccess;
96 + goto winner; 33 + goto winner;
97 } while (0); 34 } while (0);
98 35
99 if (sid_match) 36 if (sid_match)
100 @@ -5483,6 +5492,27 @@ ssl3_HandleServerHello(sslSocket *ss, SSL3Opaque *b, PRUi nt32 length) 37 @@ -5629,6 +5639,27 @@ ssl3_HandleServerHello(sslSocket *ss, SS
101 38
102 ss->ssl3.hs.isResuming = PR_FALSE; 39 ss->ssl3.hs.isResuming = PR_FALSE;
103 ss->ssl3.hs.ws = wait_server_cert; 40 ss->ssl3.hs.ws = wait_server_cert;
104 + 41 +
105 +winner: 42 +winner:
106 + /* If we will need a ChannelID key then we make the callback now. This 43 + /* If we will need a ChannelID key then we make the callback now. This
107 + * allows the handshake to be restarted cleanly if the callback returns 44 + * allows the handshake to be restarted cleanly if the callback returns
108 + * SECWouldBlock. */ 45 + * SECWouldBlock. */
109 + if (ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) { 46 + if (ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) {
110 + rv = ss->getChannelID(ss->getChannelIDArg, ss->fd, 47 + rv = ss->getChannelID(ss->getChannelIDArg, ss->fd,
111 + &ss->ssl3.channelIDPub, &ss->ssl3.channelID); 48 + &ss->ssl3.channelIDPub, &ss->ssl3.channelID);
112 + if (rv == SECWouldBlock) { 49 + if (rv == SECWouldBlock) {
113 + ssl3_SetAlwaysBlock(ss); 50 + ssl3_SetAlwaysBlock(ss);
114 + return rv; 51 + return rv;
115 + } 52 + }
116 + if (rv != SECSuccess || 53 + if (rv != SECSuccess ||
117 + ss->ssl3.channelIDPub == NULL || 54 + ss->ssl3.channelIDPub == NULL ||
118 + ss->ssl3.channelID == NULL) { 55 + ss->ssl3.channelID == NULL) {
119 + PORT_SetError(SSL_ERROR_GET_CHANNEL_ID_FAILED); 56 + PORT_SetError(SSL_ERROR_GET_CHANNEL_ID_FAILED);
120 + desc = internal_error; 57 + desc = internal_error;
121 + goto alert_loser; 58 + goto alert_loser;
122 + } 59 + }
123 + } 60 + }
124 + 61 +
125 return SECSuccess; 62 return SECSuccess;
126 63
127 alert_loser: 64 alert_loser:
128 @@ -6239,6 +6269,10 @@ ssl3_SendClientSecondRound(sslSocket *ss) 65 @@ -6385,6 +6416,10 @@ ssl3_SendClientSecondRound(sslSocket *ss
129 goto loser; /* err code was set. */ 66 goto loser; /* err code was set. */
130 } 67 }
131 } 68 }
132 + rv = ssl3_SendEncryptedExtensions(ss); 69 + rv = ssl3_SendEncryptedExtensions(ss);
133 + if (rv != SECSuccess) { 70 + if (rv != SECSuccess) {
134 + goto loser; /* err code was set. */ 71 + goto loser; /* err code was set. */
135 + } 72 + }
136 73
137 rv = ssl3_SendFinished(ss, 0); 74 rv = ssl3_SendFinished(ss, 0);
138 if (rv != SECSuccess) { 75 if (rv != SECSuccess) {
139 @@ -8855,6 +8889,164 @@ ssl3_SendNextProto(sslSocket *ss) 76 @@ -9102,6 +9137,164 @@ ssl3_RecordKeyLog(sslSocket *ss)
140 return rv; 77 return;
141 } 78 }
142 79
143 +/* called from ssl3_SendClientSecondRound 80 +/* called from ssl3_SendClientSecondRound
144 + * ssl3_HandleFinished 81 + * ssl3_HandleFinished
145 + */ 82 + */
146 +static SECStatus 83 +static SECStatus
147 +ssl3_SendEncryptedExtensions(sslSocket *ss) 84 +ssl3_SendEncryptedExtensions(sslSocket *ss)
148 +{ 85 +{
149 + static const char CHANNEL_ID_MAGIC[] = "TLS Channel ID signature"; 86 + static const char CHANNEL_ID_MAGIC[] = "TLS Channel ID signature";
150 + /* This is the ASN.1 prefix for a P-256 public key. Specifically it's: 87 + /* This is the ASN.1 prefix for a P-256 public key. Specifically it's:
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 + ss->handshake = ssl_GatherRecord1stHandshake; 231 + ss->handshake = ssl_GatherRecord1stHandshake;
295 + ss->ssl3.channelID = channelID; 232 + ss->ssl3.channelID = channelID;
296 + ss->ssl3.channelIDPub = channelIDPub; 233 + ss->ssl3.channelIDPub = channelIDPub;
297 + 234 +
298 + return SECSuccess; 235 + return SECSuccess;
299 +} 236 +}
300 + 237 +
301 /* called from ssl3_HandleServerHelloDone 238 /* called from ssl3_HandleServerHelloDone
302 * ssl3_HandleClientHello 239 * ssl3_HandleClientHello
303 * ssl3_HandleFinished 240 * ssl3_HandleFinished
304 @@ -9105,11 +9297,16 @@ ssl3_HandleFinished(sslSocket *ss, SSL3Opaque *b, PRUint 32 length, 241 @@ -9355,11 +9548,16 @@ ssl3_HandleFinished(sslSocket *ss, SSL3O
305 flags = ssl_SEND_FLAG_FORCE_INTO_BUFFER; 242 flags = ssl_SEND_FLAG_FORCE_INTO_BUFFER;
306 } 243 }
307 244
308 - if (!isServer && !ss->firstHsDone) { 245 - if (!isServer && !ss->firstHsDone) {
309 - rv = ssl3_SendNextProto(ss); 246 - rv = ssl3_SendNextProto(ss);
310 - if (rv != SECSuccess) { 247 - if (rv != SECSuccess) {
311 - goto xmit_loser; /* err code was set. */ 248 - goto xmit_loser; /* err code was set. */
312 + if (!isServer) { 249 + if (!isServer) {
313 + if (!ss->firstHsDone) { 250 + if (!ss->firstHsDone) {
314 + rv = ssl3_SendNextProto(ss); 251 + rv = ssl3_SendNextProto(ss);
315 + if (rv != SECSuccess) { 252 + if (rv != SECSuccess) {
316 + goto xmit_loser; /* err code was set. */ 253 + goto xmit_loser; /* err code was set. */
317 + } 254 + }
318 } 255 }
319 + rv = ssl3_SendEncryptedExtensions(ss); 256 + rv = ssl3_SendEncryptedExtensions(ss);
320 + if (rv != SECSuccess) 257 + if (rv != SECSuccess)
321 + goto xmit_loser; /* err code was set. */ 258 + goto xmit_loser; /* err code was set. */
322 } 259 }
323 260
324 if (IS_DTLS(ss)) { 261 if (IS_DTLS(ss)) {
325 @@ -10376,6 +10573,11 @@ ssl3_DestroySSL3Info(sslSocket *ss) 262 @@ -10623,6 +10821,11 @@ ssl3_DestroySSL3Info(sslSocket *ss)
326 ssl_FreePlatformKey(ss->ssl3.platformClientKey); 263 ssl_FreePlatformKey(ss->ssl3.platformClientKey);
327 #endif /* NSS_PLATFORM_CLIENT_AUTH */ 264 #endif /* NSS_PLATFORM_CLIENT_AUTH */
328 265
329 + if (ss->ssl3.channelID) 266 + if (ss->ssl3.channelID)
330 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID); 267 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID);
331 + if (ss->ssl3.channelIDPub) 268 + if (ss->ssl3.channelIDPub)
332 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); 269 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub);
333 + 270 +
334 if (ss->ssl3.peerCertArena != NULL) 271 if (ss->ssl3.peerCertArena != NULL)
335 ssl3_CleanupPeerCerts(ss); 272 ssl3_CleanupPeerCerts(ss);
336 273
337 diff --git a/net/third_party/nss/ssl/ssl3ext.c b/net/third_party/nss/ssl/ssl3ext .c 274 diff -pu -r a/net/third_party/nss/ssl/ssl3ext.c b/net/third_party/nss/ssl/ssl3ex t.c
338 index b9fd6e7..029487e 100644 275 --- a/net/third_party/nss/ssl/ssl3ext.c»2012-11-09 15:57:12.838336618 -0800
339 --- a/net/third_party/nss/ssl/ssl3ext.c 276 +++ b/net/third_party/nss/ssl/ssl3ext.c»2012-11-09 16:04:14.414475097 -0800
340 +++ b/net/third_party/nss/ssl/ssl3ext.c 277 @@ -61,6 +61,10 @@ static PRInt32 ssl3_SendUseSRTPXtn(sslSo
341 @@ -80,10 +80,14 @@ static SECStatus ssl3_HandleRenegotiationInfoXtn(sslSocket * ss, 278 PRUint32 maxBytes);
342 PRUint16 ex_type, SECItem *data); 279 static SECStatus ssl3_HandleUseSRTPXtn(sslSocket * ss, PRUint16 ex_type,
343 static SECStatus ssl3_ClientHandleNextProtoNegoXtn(sslSocket *ss, 280 SECItem *data);
344 » » » PRUint16 ex_type, SECItem *data);
345 +static SECStatus ssl3_ClientHandleChannelIDXtn(sslSocket *ss, 281 +static SECStatus ssl3_ClientHandleChannelIDXtn(sslSocket *ss,
346 +» » » PRUint16 ex_type, SECItem *data); 282 + PRUint16 ex_type, SECItem *data);
347 static SECStatus ssl3_ServerHandleNextProtoNegoXtn(sslSocket *ss,
348 » » » PRUint16 ex_type, SECItem *data);
349 static PRInt32 ssl3_ClientSendNextProtoNegoXtn(sslSocket *ss, PRBool append,
350 » » » » » PRUint32 maxBytes);
351 +static PRInt32 ssl3_ClientSendChannelIDXtn(sslSocket *ss, PRBool append, 283 +static PRInt32 ssl3_ClientSendChannelIDXtn(sslSocket *ss, PRBool append,
352 +» » » » » PRUint32 maxBytes); 284 + PRUint32 maxBytes);
353 285
354 /* 286 /*
355 * Write bytes. Using this function means the SECItem structure 287 * Write bytes. Using this function means the SECItem structure
356 @@ -253,6 +257,7 @@ static const ssl3HelloExtensionHandler serverHelloHandlersTL S[] = { 288 @@ -234,6 +238,7 @@ static const ssl3HelloExtensionHandler s
357 { ssl_session_ticket_xtn, &ssl3_ClientHandleSessionTicketXtn },
358 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn }, 289 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn },
359 { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn }, 290 { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn },
360 + { ssl_channel_id_xtn, &ssl3_ClientHandleChannelIDXtn }, 291 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn },
292 + { ssl_channel_id_xtn, &ssl3_ClientHandleChannelIDXtn },
361 { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn }, 293 { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn },
362 { -1, NULL } 294 { -1, NULL }
363 }; 295 };
364 @@ -278,6 +283,7 @@ ssl3HelloExtensionSender clientHelloSendersTLS[SSL_MAX_EXTEN SIONS] = { 296 @@ -260,6 +265,7 @@ ssl3HelloExtensionSender clientHelloSend
365 #endif
366 { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn }, 297 { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn },
367 { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn }, 298 { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn },
299 { ssl_use_srtp_xtn, &ssl3_SendUseSRTPXtn },
368 + { ssl_channel_id_xtn, &ssl3_ClientSendChannelIDXtn }, 300 + { ssl_channel_id_xtn, &ssl3_ClientSendChannelIDXtn },
369 { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn } 301 { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn }
370 /* any extra entries will appear as { 0, NULL } */ 302 /* any extra entries will appear as { 0, NULL } */
371 }; 303 };
372 @@ -668,6 +674,52 @@ loser: 304 @@ -650,6 +656,52 @@ loser:
373 return -1; 305 return -1;
374 } 306 }
375 307
376 +static SECStatus 308 +static SECStatus
377 +ssl3_ClientHandleChannelIDXtn(sslSocket *ss, PRUint16 ex_type, 309 +ssl3_ClientHandleChannelIDXtn(sslSocket *ss, PRUint16 ex_type,
378 + SECItem *data) 310 + SECItem *data)
379 +{ 311 +{
380 + PORT_Assert(ss->getChannelID != NULL); 312 + PORT_Assert(ss->getChannelID != NULL);
381 + 313 +
382 + if (data->len) { 314 + if (data->len) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 + 347 +
416 + return extension_length; 348 + return extension_length;
417 + 349 +
418 +loser: 350 +loser:
419 + return -1; 351 + return -1;
420 +} 352 +}
421 + 353 +
422 SECStatus 354 SECStatus
423 ssl3_ClientHandleStatusRequestXtn(sslSocket *ss, PRUint16 ex_type, 355 ssl3_ClientHandleStatusRequestXtn(sslSocket *ss, PRUint16 ex_type,
424 SECItem *data) 356 SECItem *data)
425 diff --git a/net/third_party/nss/ssl/ssl3prot.h b/net/third_party/nss/ssl/ssl3pr ot.h 357 diff -pu -r a/net/third_party/nss/ssl/ssl3prot.h b/net/third_party/nss/ssl/ssl3p rot.h
426 index 550c341..11f9624 100644 358 --- a/net/third_party/nss/ssl/ssl3prot.h» 2012-11-09 15:34:12.258133766 -0 800
427 --- a/net/third_party/nss/ssl/ssl3prot.h 359 +++ b/net/third_party/nss/ssl/ssl3prot.h» 2012-11-09 15:58:06.979126989 -0 800
428 +++ b/net/third_party/nss/ssl/ssl3prot.h 360 @@ -130,7 +130,8 @@ typedef enum {
429 @@ -163,7 +163,8 @@ typedef enum {
430 client_key_exchange = 16, 361 client_key_exchange = 16,
431 finished = 20, 362 finished = 20,
432 certificate_status = 22, 363 certificate_status = 22,
433 - next_proto = 67 364 - next_proto = 67
434 + next_proto = 67, 365 + next_proto = 67,
435 + encrypted_extensions= 203 366 + encrypted_extensions= 203
436 } SSL3HandshakeType; 367 } SSL3HandshakeType;
437 368
438 typedef struct { 369 typedef struct {
439 diff --git a/net/third_party/nss/ssl/sslauth.c b/net/third_party/nss/ssl/sslauth .c 370 diff -pu -r a/net/third_party/nss/ssl/sslauth.c b/net/third_party/nss/ssl/sslaut h.c
440 index 8ccd1a4..e8b4acb 100644 371 --- a/net/third_party/nss/ssl/sslauth.c»2012-11-09 15:39:36.892892416 -0800
441 --- a/net/third_party/nss/ssl/sslauth.c 372 +++ b/net/third_party/nss/ssl/sslauth.c»2012-11-09 15:58:06.979126989 -0800
442 +++ b/net/third_party/nss/ssl/sslauth.c 373 @@ -219,6 +219,24 @@ SSL_GetClientAuthDataHook(PRFileDesc *s,
443 @@ -251,6 +251,24 @@ SSL_GetClientAuthDataHook(PRFileDesc *s, SSLGetClientAuthDa ta func,
444 return SECSuccess; 374 return SECSuccess;
445 } 375 }
446 376
447 +SECStatus 377 +SECStatus
448 +SSL_SetClientChannelIDCallback(PRFileDesc *fd, 378 +SSL_SetClientChannelIDCallback(PRFileDesc *fd,
449 + SSLClientChannelIDCallback callback, 379 + SSLClientChannelIDCallback callback,
450 + void *arg) { 380 + void *arg) {
451 + sslSocket *ss = ssl_FindSocket(fd); 381 + sslSocket *ss = ssl_FindSocket(fd);
452 + 382 +
453 + if (!ss) { 383 + if (!ss) {
454 + SSL_DBG(("%d: SSL[%d]: bad socket in SSL_SetClientChannelIDCallback", 384 + SSL_DBG(("%d: SSL[%d]: bad socket in SSL_SetClientChannelIDCallback",
455 + SSL_GETPID(), fd)); 385 + SSL_GETPID(), fd));
456 + return SECFailure; 386 + return SECFailure;
457 + } 387 + }
458 + 388 +
459 + ss->getChannelID = callback; 389 + ss->getChannelID = callback;
460 + ss->getChannelIDArg = arg; 390 + ss->getChannelIDArg = arg;
461 + 391 +
462 + return SECSuccess; 392 + return SECSuccess;
463 +} 393 +}
464 + 394 +
465 #ifdef NSS_PLATFORM_CLIENT_AUTH 395 #ifdef NSS_PLATFORM_CLIENT_AUTH
466 /* NEED LOCKS IN HERE. */ 396 /* NEED LOCKS IN HERE. */
467 SECStatus 397 SECStatus
468 diff --git a/net/third_party/nss/ssl/sslerr.h b/net/third_party/nss/ssl/sslerr.h 398 diff -pu -r a/net/third_party/nss/ssl/sslerr.h b/net/third_party/nss/ssl/sslerr. h
469 index 9d3bebc..53c897c 100644 399 --- a/net/third_party/nss/ssl/sslerr.h» 2012-11-09 15:34:12.258133766 -0800
470 --- a/net/third_party/nss/ssl/sslerr.h 400 +++ b/net/third_party/nss/ssl/sslerr.h» 2012-11-09 16:00:57.921621448 -0800
471 +++ b/net/third_party/nss/ssl/sslerr.h 401 @@ -190,6 +190,10 @@ SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_VERS
472 @@ -218,6 +218,10 @@ SSL_ERROR_RX_UNEXPECTED_CERT_STATUS = (SSL_ERROR_BASE + 121),
473 SSL_ERROR_RX_MALFORMED_HELLO_VERIFY_REQUEST = (SSL_ERROR_BASE + 122),
474 SSL_ERROR_RX_UNEXPECTED_HELLO_VERIFY_REQUEST = (SSL_ERROR_BASE + 123),
475 402
476 +SSL_ERROR_BAD_CHANNEL_ID_DATA = (SSL_ERROR_BASE + 124), 403 SSL_ERROR_RX_UNEXPECTED_CERT_STATUS = (SSL_ERROR_BASE + 125),
477 +SSL_ERROR_INVALID_CHANNEL_ID_KEY = (SSL_ERROR_BASE + 125), 404
478 +SSL_ERROR_GET_CHANNEL_ID_FAILED = (SSL_ERROR_BASE + 126), 405 +SSL_ERROR_BAD_CHANNEL_ID_DATA = (SSL_ERROR_BASE + 126),
406 +SSL_ERROR_INVALID_CHANNEL_ID_KEY = (SSL_ERROR_BASE + 127),
407 +SSL_ERROR_GET_CHANNEL_ID_FAILED = (SSL_ERROR_BASE + 128),
479 + 408 +
480 SSL_ERROR_END_OF_LIST /* let the c compiler determine the value of this. */ 409 SSL_ERROR_END_OF_LIST /* let the c compiler determine the value of this. */
481 } SSLErrorCodes; 410 } SSLErrorCodes;
482 #endif /* NO_SECURITY_ERROR_ENUM */ 411 #endif /* NO_SECURITY_ERROR_ENUM */
483 diff --git a/net/third_party/nss/ssl/sslimpl.h b/net/third_party/nss/ssl/sslimpl .h 412 diff -pu -r a/net/third_party/nss/ssl/SSLerrs.h b/net/third_party/nss/ssl/SSLerr s.h
484 index 8ab865a..d7335ae 100644 413 --- a/net/third_party/nss/ssl/SSLerrs.h»2012-11-09 15:34:12.258133766 -0800
485 --- a/net/third_party/nss/ssl/sslimpl.h 414 +++ b/net/third_party/nss/ssl/SSLerrs.h»2012-11-09 16:00:11.540944794 -0800
486 +++ b/net/third_party/nss/ssl/sslimpl.h 415 @@ -403,3 +403,12 @@ ER3(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_
487 @@ -930,6 +930,9 @@ struct ssl3StateStr { 416
417 ER3(SSL_ERROR_RX_UNEXPECTED_CERT_STATUS, (SSL_ERROR_BASE + 125),
418 "SSL received an unexpected Certificate Status handshake message.")
419 +
420 +ER3(SSL_ERROR_BAD_CHANNEL_ID_DATA, (SSL_ERROR_BASE + 126),
421 +"SSL received a malformed TLS Channel ID extension.")
422 +
423 +ER3(SSL_ERROR_INVALID_CHANNEL_ID_KEY, (SSL_ERROR_BASE + 127),
424 +"The application provided an invalid TLS Channel ID key.")
425 +
426 +ER3(SSL_ERROR_GET_CHANNEL_ID_FAILED, (SSL_ERROR_BASE + 128),
427 +"The application could not get a TLS Channel ID.")
428 diff -pu -r a/net/third_party/nss/ssl/ssl.h b/net/third_party/nss/ssl/ssl.h
429 --- a/net/third_party/nss/ssl/ssl.h» 2012-11-09 15:53:13.884846338 -0800
430 +++ b/net/third_party/nss/ssl/ssl.h» 2012-11-09 15:58:06.969126842 -0800
431 @@ -935,6 +935,34 @@ SSL_IMPORT SECStatus SSL_HandshakeNegoti
432 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd,
433 PRBool *last_handshake_resumed );
434
435 +/* See SSL_SetClientChannelIDCallback for usage. If the callback returns
436 + * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in
437 + * the future to restart the handshake. On SECSuccess, the callback must have
438 + * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */
439 +typedef SECStatus (PR_CALLBACK *SSLClientChannelIDCallback)(
440 + void *arg,
441 + PRFileDesc *fd,
442 + SECKEYPublicKey **out_public_key,
443 + SECKEYPrivateKey **out_private_key);
444 +
445 +/* SSL_RestartHandshakeAfterChannelIDReq attempts to restart the handshake
446 + * after a ChannelID callback returned SECWouldBlock.
447 + *
448 + * This function takes ownership of |channelIDPub| and |channelID|. */
449 +SSL_IMPORT SECStatus SSL_RestartHandshakeAfterChannelIDReq(
450 + PRFileDesc *fd,
451 + SECKEYPublicKey *channelIDPub,
452 + SECKEYPrivateKey *channelID);
453 +
454 +/* SSL_SetClientChannelIDCallback sets a callback function that will be called
455 + * once the server's ServerHello has been processed. This is only applicable to
456 + * a client socket and setting this callback causes the TLS Channel ID
457 + * extension to be advertised. */
458 +SSL_IMPORT SECStatus SSL_SetClientChannelIDCallback(
459 + PRFileDesc *fd,
460 + SSLClientChannelIDCallback callback,
461 + void *arg);
462 +
463 /*
464 ** How long should we wait before retransmitting the next flight of
465 ** the DTLS handshake? Returns SECFailure if not DTLS or not in a
466 diff -pu -r a/net/third_party/nss/ssl/sslimpl.h b/net/third_party/nss/ssl/sslimp l.h
467 --- a/net/third_party/nss/ssl/sslimpl.h»2012-11-09 15:53:13.884846338 -0800
468 +++ b/net/third_party/nss/ssl/sslimpl.h»2012-11-09 15:58:06.979126989 -0800
469 @@ -894,6 +894,9 @@ struct ssl3StateStr {
488 CERTCertificateList *clientCertChain; /* used by client */ 470 CERTCertificateList *clientCertChain; /* used by client */
489 PRBool sendEmptyCert; /* used by client */ 471 PRBool sendEmptyCert; /* used by client */
490 472
491 + SECKEYPrivateKey *channelID; /* used by client */ 473 + SECKEYPrivateKey *channelID; /* used by client */
492 + SECKEYPublicKey *channelIDPub; /* used by client */ 474 + SECKEYPublicKey *channelIDPub; /* used by client */
493 + 475 +
494 int policy; 476 int policy;
495 /* This says what cipher suites we can do, and should 477 /* This says what cipher suites we can do, and should
496 * be either SSL_ALLOWED or SSL_RESTRICTED 478 * be either SSL_ALLOWED or SSL_RESTRICTED
497 @@ -1198,6 +1201,8 @@ const unsigned char * preferredCipher; 479 @@ -1165,6 +1168,8 @@ const unsigned char * preferredCipher;
498 void *pkcs11PinArg; 480 void *pkcs11PinArg;
499 SSLNextProtoCallback nextProtoCallback; 481 SSLNextProtoCallback nextProtoCallback;
500 void *nextProtoArg; 482 void *nextProtoArg;
501 + SSLClientChannelIDCallback getChannelID; 483 + SSLClientChannelIDCallback getChannelID;
502 + void *getChannelIDArg; 484 + void *getChannelIDArg;
503 485
504 PRIntervalTime rTimeout; /* timeout for NSPR I/O */ 486 PRIntervalTime rTimeout; /* timeout for NSPR I/O */
505 PRIntervalTime wTimeout; /* timeout for NSPR I/O */ 487 PRIntervalTime wTimeout; /* timeout for NSPR I/O */
506 @@ -1529,6 +1534,11 @@ extern SECStatus ssl3_RestartHandshakeAfterCertReq(sslSoc ket * ss, 488 @@ -1495,6 +1500,11 @@ extern SECStatus ssl3_RestartHandshakeAf
507 SECKEYPrivateKey * key, 489 SECKEYPrivateKey * key,
508 CERTCertificateList *certChain); 490 CERTCertificateList *certChain);
509 491
510 +extern SECStatus ssl3_RestartHandshakeAfterChannelIDReq( 492 +extern SECStatus ssl3_RestartHandshakeAfterChannelIDReq(
511 + sslSocket *ss, 493 + sslSocket *ss,
512 + SECKEYPublicKey *channelIDPub, 494 + SECKEYPublicKey *channelIDPub,
513 + SECKEYPrivateKey *channelID); 495 + SECKEYPrivateKey *channelID);
514 + 496 +
515 extern SECStatus ssl3_AuthCertificateComplete(sslSocket *ss, PRErrorCode error) ; 497 extern SECStatus ssl3_AuthCertificateComplete(sslSocket *ss, PRErrorCode error) ;
516 498
517 /* 499 /*
518 diff --git a/net/third_party/nss/ssl/sslsecur.c b/net/third_party/nss/ssl/sslsec ur.c 500 diff -pu -r a/net/third_party/nss/ssl/sslsecur.c b/net/third_party/nss/ssl/sslse cur.c
519 index e4804d0..526d654 100644 501 --- a/net/third_party/nss/ssl/sslsecur.c» 2012-11-09 15:53:13.884846338 -0 800
520 --- a/net/third_party/nss/ssl/sslsecur.c 502 +++ b/net/third_party/nss/ssl/sslsecur.c» 2012-11-09 15:58:06.979126989 -0 800
521 +++ b/net/third_party/nss/ssl/sslsecur.c 503 @@ -1503,6 +1503,42 @@ SSL_RestartHandshakeAfterCertReq(PRFileD
522 @@ -1535,6 +1535,42 @@ SSL_RestartHandshakeAfterCertReq(PRFileDesc * fd,
523 return ret; 504 return ret;
524 } 505 }
525 506
526 +SECStatus 507 +SECStatus
527 +SSL_RestartHandshakeAfterChannelIDReq(PRFileDesc * fd, 508 +SSL_RestartHandshakeAfterChannelIDReq(PRFileDesc * fd,
528 + SECKEYPublicKey * channelIDPub, 509 + SECKEYPublicKey * channelIDPub,
529 + SECKEYPrivateKey *channelID) 510 + SECKEYPrivateKey *channelID)
530 +{ 511 +{
531 + sslSocket * ss = ssl_FindSocket(fd); 512 + sslSocket * ss = ssl_FindSocket(fd);
532 + SECStatus ret; 513 + SECStatus ret;
(...skipping 22 matching lines...) Expand all
555 + 536 +
556 +loser: 537 +loser:
557 + SECKEY_DestroyPublicKey(channelIDPub); 538 + SECKEY_DestroyPublicKey(channelIDPub);
558 + SECKEY_DestroyPrivateKey(channelID); 539 + SECKEY_DestroyPrivateKey(channelID);
559 + return SECFailure; 540 + return SECFailure;
560 +} 541 +}
561 + 542 +
562 /* DO NOT USE. This function was exported in ssl.def with the wrong signature; 543 /* DO NOT USE. This function was exported in ssl.def with the wrong signature;
563 * this implementation exists to maintain link-time compatibility. 544 * this implementation exists to maintain link-time compatibility.
564 */ 545 */
565 diff --git a/net/third_party/nss/ssl/sslsock.c b/net/third_party/nss/ssl/sslsock .c 546 diff -pu -r a/net/third_party/nss/ssl/sslsock.c b/net/third_party/nss/ssl/sslsoc k.c
566 index ebc245a..9498828 100644 547 --- a/net/third_party/nss/ssl/sslsock.c»2012-11-09 15:48:41.260860199 -0800
567 --- a/net/third_party/nss/ssl/sslsock.c 548 +++ b/net/third_party/nss/ssl/sslsock.c»2012-11-09 15:58:06.979126989 -0800
568 +++ b/net/third_party/nss/ssl/sslsock.c 549 @@ -346,6 +346,8 @@ ssl_DupSocket(sslSocket *os)
569 @@ -374,6 +374,8 @@ ssl_DupSocket(sslSocket *os)
570 ss->handshakeCallback = os->handshakeCallback; 550 ss->handshakeCallback = os->handshakeCallback;
571 ss->handshakeCallbackData = os->handshakeCallbackData; 551 ss->handshakeCallbackData = os->handshakeCallbackData;
572 ss->pkcs11PinArg = os->pkcs11PinArg; 552 ss->pkcs11PinArg = os->pkcs11PinArg;
573 + ss->getChannelID = os->getChannelID; 553 + ss->getChannelID = os->getChannelID;
574 + ss->getChannelIDArg = os->getChannelIDArg; 554 + ss->getChannelIDArg = os->getChannelIDArg;
575 555
576 /* Create security data */ 556 /* Create security data */
577 rv = ssl_CopySecurityInfo(ss, os); 557 rv = ssl_CopySecurityInfo(ss, os);
578 @@ -1688,6 +1690,10 @@ SSL_ReconfigFD(PRFileDesc *model, PRFileDesc *fd) 558 @@ -1736,6 +1738,10 @@ SSL_ReconfigFD(PRFileDesc *model, PRFile
579 ss->handshakeCallbackData = sm->handshakeCallbackData; 559 ss->handshakeCallbackData = sm->handshakeCallbackData;
580 if (sm->pkcs11PinArg) 560 if (sm->pkcs11PinArg)
581 ss->pkcs11PinArg = sm->pkcs11PinArg; 561 ss->pkcs11PinArg = sm->pkcs11PinArg;
582 + if (sm->getChannelID) 562 + if (sm->getChannelID)
583 + ss->getChannelID = sm->getChannelID; 563 + ss->getChannelID = sm->getChannelID;
584 + if (sm->getChannelIDArg) 564 + if (sm->getChannelIDArg)
585 + ss->getChannelIDArg = sm->getChannelIDArg; 565 + ss->getChannelIDArg = sm->getChannelIDArg;
586 return fd; 566 return fd;
587 loser: 567 loser:
588 return NULL; 568 return NULL;
589 @@ -2938,6 +2944,8 @@ ssl_NewSocket(PRBool makeLocks, SSLProtocolVariant protoco lVariant) 569 @@ -2988,6 +2994,8 @@ ssl_NewSocket(PRBool makeLocks, SSLProto
590 ss->handleBadCert = NULL; 570 ss->handleBadCert = NULL;
591 ss->badCertArg = NULL; 571 ss->badCertArg = NULL;
592 ss->pkcs11PinArg = NULL; 572 ss->pkcs11PinArg = NULL;
593 + ss->getChannelID = NULL; 573 + ss->getChannelID = NULL;
594 + ss->getChannelIDArg = NULL; 574 + ss->getChannelIDArg = NULL;
595 575
596 ssl_ChooseOps(ss); 576 ssl_ChooseOps(ss);
597 ssl2_InitSocketPolicy(ss); 577 ssl2_InitSocketPolicy(ss);
598 diff --git a/net/third_party/nss/ssl/sslt.h b/net/third_party/nss/ssl/sslt.h 578 diff -pu -r a/net/third_party/nss/ssl/sslt.h b/net/third_party/nss/ssl/sslt.h
599 index 0636570..978b1cb 100644 579 --- a/net/third_party/nss/ssl/sslt.h» 2012-11-09 15:34:12.268133912 -0800
600 --- a/net/third_party/nss/ssl/sslt.h 580 +++ b/net/third_party/nss/ssl/sslt.h» 2012-11-09 15:58:55.569836197 -0800
601 +++ b/net/third_party/nss/ssl/sslt.h 581 @@ -183,9 +183,10 @@ typedef enum {
602 @@ -215,9 +215,10 @@ typedef enum { 582 ssl_use_srtp_xtn = 14,
603 #endif
604 ssl_session_ticket_xtn = 35, 583 ssl_session_ticket_xtn = 35,
605 ssl_next_proto_nego_xtn = 13172, 584 ssl_next_proto_nego_xtn = 13172,
606 + ssl_channel_id_xtn = 30031, 585 + ssl_channel_id_xtn = 30031,
607 ssl_renegotiation_info_xtn = 0xff01 /* experimental number */ 586 ssl_renegotiation_info_xtn = 0xff01 /* experimental number */
608 } SSLExtensionType; 587 } SSLExtensionType;
609 588
610 -#define SSL_MAX_EXTENSIONS 7 589 -#define SSL_MAX_EXTENSIONS 8
611 +#define SSL_MAX_EXTENSIONS 8 590 +#define SSL_MAX_EXTENSIONS 9
612 591
613 #endif /* __sslt_h_ */ 592 #endif /* __sslt_h_ */
OLDNEW
« no previous file with comments | « net/third_party/nss/patches/cachecerts.patch ('k') | net/third_party/nss/patches/checkuncache.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698