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

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

Issue 142283002: Update net/third_party/nss to NSS_3_15_5_BETA2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix applypatches.sh mistakes Created 6 years, 11 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 diff -pu a/nss/lib/ssl/ssl3con.c b/nss/lib/ssl/ssl3con.c 1 diff -pu a/nss/lib/ssl/ssl3con.c b/nss/lib/ssl/ssl3con.c
2 --- a/nss/lib/ssl/ssl3con.c» 2014-01-03 19:36:09.938766379 -0800 2 --- a/nss/lib/ssl/ssl3con.c» 2014-01-18 10:39:50.799150460 -0800
3 +++ b/nss/lib/ssl/ssl3con.c» 2014-01-03 19:37:50.360408300 -0800 3 +++ b/nss/lib/ssl/ssl3con.c» 2014-01-18 10:40:15.489552270 -0800
4 @@ -55,6 +55,7 @@ static SECStatus ssl3_SendCertificateSta 4 @@ -55,6 +55,7 @@ static SECStatus ssl3_SendCertificateSta
5 static SECStatus ssl3_SendEmptyCertificate( sslSocket *ss); 5 static SECStatus ssl3_SendEmptyCertificate( sslSocket *ss);
6 static SECStatus ssl3_SendCertificateRequest(sslSocket *ss); 6 static SECStatus ssl3_SendCertificateRequest(sslSocket *ss);
7 static SECStatus ssl3_SendNextProto( sslSocket *ss); 7 static SECStatus ssl3_SendNextProto( sslSocket *ss);
8 +static SECStatus ssl3_SendEncryptedExtensions(sslSocket *ss); 8 +static SECStatus ssl3_SendEncryptedExtensions(sslSocket *ss);
9 static SECStatus ssl3_SendFinished( sslSocket *ss, PRInt32 flags); 9 static SECStatus ssl3_SendFinished( sslSocket *ss, PRInt32 flags);
10 static SECStatus ssl3_SendServerHello( sslSocket *ss); 10 static SECStatus ssl3_SendServerHello( sslSocket *ss);
11 static SECStatus ssl3_SendServerHelloDone( sslSocket *ss); 11 static SECStatus ssl3_SendServerHelloDone( sslSocket *ss);
12 @@ -6198,6 +6199,15 @@ ssl3_HandleServerHello(sslSocket *ss, SS 12 @@ -6221,6 +6222,15 @@ ssl3_HandleServerHello(sslSocket *ss, SS
13 } 13 }
14 #endif /* NSS_PLATFORM_CLIENT_AUTH */ 14 #endif /* NSS_PLATFORM_CLIENT_AUTH */
15 15
16 + if (ss->ssl3.channelID != NULL) { 16 + if (ss->ssl3.channelID != NULL) {
17 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID); 17 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID);
18 + ss->ssl3.channelID = NULL; 18 + ss->ssl3.channelID = NULL;
19 + } 19 + }
20 + if (ss->ssl3.channelIDPub != NULL) { 20 + if (ss->ssl3.channelIDPub != NULL) {
21 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); 21 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub);
22 + ss->ssl3.channelIDPub = NULL; 22 + ss->ssl3.channelIDPub = NULL;
23 + } 23 + }
24 + 24 +
25 temp = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length); 25 temp = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length);
26 if (temp < 0) { 26 if (temp < 0) {
27 goto loser; /* alert has been sent */ 27 goto loser; /* alert has been sent */
28 @@ -6480,7 +6490,7 @@ ssl3_HandleServerHello(sslSocket *ss, SS 28 @@ -6503,7 +6513,7 @@ ssl3_HandleServerHello(sslSocket *ss, SS
29 if (rv != SECSuccess) { 29 if (rv != SECSuccess) {
30 goto alert_loser; /* err code was set */ 30 goto alert_loser; /* err code was set */
31 } 31 }
32 - return SECSuccess; 32 - return SECSuccess;
33 + goto winner; 33 + goto winner;
34 } while (0); 34 } while (0);
35 35
36 if (sid_match) 36 if (sid_match)
37 @@ -6506,6 +6516,27 @@ ssl3_HandleServerHello(sslSocket *ss, SS 37 @@ -6529,6 +6539,27 @@ ssl3_HandleServerHello(sslSocket *ss, SS
38 38
39 ss->ssl3.hs.isResuming = PR_FALSE; 39 ss->ssl3.hs.isResuming = PR_FALSE;
40 ss->ssl3.hs.ws = wait_server_cert; 40 ss->ssl3.hs.ws = wait_server_cert;
41 + 41 +
42 +winner: 42 +winner:
43 + /* 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
44 + * allows the handshake to be restarted cleanly if the callback returns 44 + * allows the handshake to be restarted cleanly if the callback returns
45 + * SECWouldBlock. */ 45 + * SECWouldBlock. */
46 + if (ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) { 46 + if (ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) {
47 + rv = ss->getChannelID(ss->getChannelIDArg, ss->fd, 47 + rv = ss->getChannelID(ss->getChannelIDArg, ss->fd,
48 + &ss->ssl3.channelIDPub, &ss->ssl3.channelID); 48 + &ss->ssl3.channelIDPub, &ss->ssl3.channelID);
49 + if (rv == SECWouldBlock) { 49 + if (rv == SECWouldBlock) {
50 + ssl3_SetAlwaysBlock(ss); 50 + ssl3_SetAlwaysBlock(ss);
51 + return rv; 51 + return rv;
52 + } 52 + }
53 + if (rv != SECSuccess || 53 + if (rv != SECSuccess ||
54 + ss->ssl3.channelIDPub == NULL || 54 + ss->ssl3.channelIDPub == NULL ||
55 + ss->ssl3.channelID == NULL) { 55 + ss->ssl3.channelID == NULL) {
56 + PORT_SetError(SSL_ERROR_GET_CHANNEL_ID_FAILED); 56 + PORT_SetError(SSL_ERROR_GET_CHANNEL_ID_FAILED);
57 + desc = internal_error; 57 + desc = internal_error;
58 + goto alert_loser; 58 + goto alert_loser;
59 + } 59 + }
60 + } 60 + }
61 + 61 +
62 return SECSuccess; 62 return SECSuccess;
63 63
64 alert_loser: 64 alert_loser:
65 @@ -7467,7 +7498,14 @@ ssl3_SendClientSecondRound(sslSocket *ss 65 @@ -7490,7 +7521,14 @@ ssl3_SendClientSecondRound(sslSocket *ss
66 if (rv != SECSuccess) { 66 if (rv != SECSuccess) {
67 goto loser; /* err code was set. */ 67 goto loser; /* err code was set. */
68 } 68 }
69 + } 69 + }
70 70
71 + rv = ssl3_SendEncryptedExtensions(ss); 71 + rv = ssl3_SendEncryptedExtensions(ss);
72 + if (rv != SECSuccess) { 72 + if (rv != SECSuccess) {
73 + goto loser; /* err code was set. */ 73 + goto loser; /* err code was set. */
74 + } 74 + }
75 + 75 +
76 + if (!ss->firstHsDone) { 76 + if (!ss->firstHsDone) {
77 if (ss->opt.enableFalseStart) { 77 if (ss->opt.enableFalseStart) {
78 if (!ss->ssl3.hs.authCertificatePending) { 78 if (!ss->ssl3.hs.authCertificatePending) {
79 /* When we fix bug 589047, we will need to know whether we are 79 /* When we fix bug 589047, we will need to know whether we are
80 @@ -7504,6 +7542,33 @@ ssl3_SendClientSecondRound(sslSocket *ss 80 @@ -7527,6 +7565,33 @@ ssl3_SendClientSecondRound(sslSocket *ss
81 81
82 ssl_ReleaseXmitBufLock(ss); /******************************* / 82 ssl_ReleaseXmitBufLock(ss); /******************************* /
83 83
84 + if (!ss->ssl3.hs.isResuming && 84 + if (!ss->ssl3.hs.isResuming &&
85 + ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) { 85 + ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) {
86 + /* If we are negotiating ChannelID on a full handshake then we record 86 + /* If we are negotiating ChannelID on a full handshake then we record
87 + * the handshake hashes in |sid| at this point. They will be needed in 87 + * the handshake hashes in |sid| at this point. They will be needed in
88 + * the event that we resume this session and use ChannelID on the 88 + * the event that we resume this session and use ChannelID on the
89 + * resumption handshake. */ 89 + * resumption handshake. */
90 + SSL3Hashes hashes; 90 + SSL3Hashes hashes;
(...skipping 13 matching lines...) Expand all
104 + originalHandshakeHash->data = PORT_Alloc(hashes.len); 104 + originalHandshakeHash->data = PORT_Alloc(hashes.len);
105 + if (!originalHandshakeHash->data) 105 + if (!originalHandshakeHash->data)
106 + return SECFailure; 106 + return SECFailure;
107 + originalHandshakeHash->len = hashes.len; 107 + originalHandshakeHash->len = hashes.len;
108 + memcpy(originalHandshakeHash->data, hashes.u.raw, hashes.len); 108 + memcpy(originalHandshakeHash->data, hashes.u.raw, hashes.len);
109 + } 109 + }
110 + 110 +
111 if (ssl3_ExtensionNegotiated(ss, ssl_session_ticket_xtn)) 111 if (ssl3_ExtensionNegotiated(ss, ssl_session_ticket_xtn))
112 ss->ssl3.hs.ws = wait_new_session_ticket; 112 ss->ssl3.hs.ws = wait_new_session_ticket;
113 else 113 else
114 @@ -10469,6 +10534,184 @@ ssl3_RecordKeyLog(sslSocket *ss) 114 @@ -10494,6 +10559,184 @@ ssl3_RecordKeyLog(sslSocket *ss)
115 } 115 }
116 116
117 /* called from ssl3_SendClientSecondRound 117 /* called from ssl3_SendClientSecondRound
118 + * ssl3_HandleFinished 118 + * ssl3_HandleFinished
119 + */ 119 + */
120 +static SECStatus 120 +static SECStatus
121 +ssl3_SendEncryptedExtensions(sslSocket *ss) 121 +ssl3_SendEncryptedExtensions(sslSocket *ss)
122 +{ 122 +{
123 + static const char CHANNEL_ID_MAGIC[] = "TLS Channel ID signature"; 123 + static const char CHANNEL_ID_MAGIC[] = "TLS Channel ID signature";
124 + static const char CHANNEL_ID_RESUMPTION_MAGIC[] = "Resumption"; 124 + static const char CHANNEL_ID_RESUMPTION_MAGIC[] = "Resumption";
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 + ss->ssl3.channelID = channelID; 289 + ss->ssl3.channelID = channelID;
290 + ss->ssl3.channelIDPub = channelIDPub; 290 + ss->ssl3.channelIDPub = channelIDPub;
291 + 291 +
292 + return SECSuccess; 292 + return SECSuccess;
293 +} 293 +}
294 + 294 +
295 +/* called from ssl3_SendClientSecondRound 295 +/* called from ssl3_SendClientSecondRound
296 * ssl3_HandleClientHello 296 * ssl3_HandleClientHello
297 * ssl3_HandleFinished 297 * ssl3_HandleFinished
298 */ 298 */
299 @@ -10728,11 +10971,16 @@ ssl3_HandleFinished(sslSocket *ss, SSL3O 299 @@ -10753,11 +10996,16 @@ ssl3_HandleFinished(sslSocket *ss, SSL3O
300 flags = ssl_SEND_FLAG_FORCE_INTO_BUFFER; 300 flags = ssl_SEND_FLAG_FORCE_INTO_BUFFER;
301 } 301 }
302 302
303 - if (!isServer && !ss->firstHsDone) { 303 - if (!isServer && !ss->firstHsDone) {
304 - rv = ssl3_SendNextProto(ss); 304 - rv = ssl3_SendNextProto(ss);
305 - if (rv != SECSuccess) { 305 - if (rv != SECSuccess) {
306 - goto xmit_loser; /* err code was set. */ 306 - goto xmit_loser; /* err code was set. */
307 + if (!isServer) { 307 + if (!isServer) {
308 + if (!ss->firstHsDone) { 308 + if (!ss->firstHsDone) {
309 + rv = ssl3_SendNextProto(ss); 309 + rv = ssl3_SendNextProto(ss);
310 + if (rv != SECSuccess) { 310 + if (rv != SECSuccess) {
311 + goto xmit_loser; /* err code was set. */ 311 + goto xmit_loser; /* err code was set. */
312 + } 312 + }
313 } 313 }
314 + rv = ssl3_SendEncryptedExtensions(ss); 314 + rv = ssl3_SendEncryptedExtensions(ss);
315 + if (rv != SECSuccess) 315 + if (rv != SECSuccess)
316 + goto xmit_loser; /* err code was set. */ 316 + goto xmit_loser; /* err code was set. */
317 } 317 }
318 318
319 if (IS_DTLS(ss)) { 319 if (IS_DTLS(ss)) {
320 @@ -12212,6 +12460,11 @@ ssl3_DestroySSL3Info(sslSocket *ss) 320 @@ -12237,6 +12485,11 @@ ssl3_DestroySSL3Info(sslSocket *ss)
321 ssl_FreePlatformKey(ss->ssl3.platformClientKey); 321 ssl_FreePlatformKey(ss->ssl3.platformClientKey);
322 #endif /* NSS_PLATFORM_CLIENT_AUTH */ 322 #endif /* NSS_PLATFORM_CLIENT_AUTH */
323 323
324 + if (ss->ssl3.channelID) 324 + if (ss->ssl3.channelID)
325 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID); 325 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID);
326 + if (ss->ssl3.channelIDPub) 326 + if (ss->ssl3.channelIDPub)
327 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); 327 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub);
328 + 328 +
329 if (ss->ssl3.peerCertArena != NULL) 329 if (ss->ssl3.peerCertArena != NULL)
330 ssl3_CleanupPeerCerts(ss); 330 ssl3_CleanupPeerCerts(ss);
331 331
332 diff -pu a/nss/lib/ssl/ssl3ext.c b/nss/lib/ssl/ssl3ext.c 332 diff -pu a/nss/lib/ssl/ssl3ext.c b/nss/lib/ssl/ssl3ext.c
333 --- a/nss/lib/ssl/ssl3ext.c» 2014-01-03 19:31:09.783859095 -0800 333 --- a/nss/lib/ssl/ssl3ext.c» 2014-01-18 10:39:50.749149654 -0800
334 +++ b/nss/lib/ssl/ssl3ext.c» 2014-01-03 19:36:25.379018825 -0800 334 +++ b/nss/lib/ssl/ssl3ext.c» 2014-01-18 10:43:52.543083984 -0800
335 @@ -60,6 +60,10 @@ static PRInt32 ssl3_SendUseSRTPXtn(sslSo 335 @@ -64,6 +64,10 @@ static PRInt32 ssl3_SendUseSRTPXtn(sslSo
336 PRUint32 maxBytes); 336 PRUint32 maxBytes);
337 static SECStatus ssl3_HandleUseSRTPXtn(sslSocket * ss, PRUint16 ex_type, 337 static SECStatus ssl3_HandleUseSRTPXtn(sslSocket * ss, PRUint16 ex_type,
338 SECItem *data); 338 SECItem *data);
339 +static SECStatus ssl3_ClientHandleChannelIDXtn(sslSocket *ss, 339 +static SECStatus ssl3_ClientHandleChannelIDXtn(sslSocket *ss,
340 + PRUint16 ex_type, SECItem *data); 340 + PRUint16 ex_type, SECItem *data);
341 +static PRInt32 ssl3_ClientSendChannelIDXtn(sslSocket *ss, PRBool append, 341 +static PRInt32 ssl3_ClientSendChannelIDXtn(sslSocket *ss, PRBool append,
342 + PRUint32 maxBytes); 342 + PRUint32 maxBytes);
343 static SECStatus ssl3_ServerSendStatusRequestXtn(sslSocket * ss, 343 static SECStatus ssl3_ServerSendStatusRequestXtn(sslSocket * ss,
344 PRBool append, PRUint32 maxBytes); 344 PRBool append, PRUint32 maxBytes);
345 static SECStatus ssl3_ServerHandleStatusRequestXtn(sslSocket *ss, 345 static SECStatus ssl3_ServerHandleStatusRequestXtn(sslSocket *ss,
346 @@ -248,6 +252,7 @@ static const ssl3HelloExtensionHandler s 346 @@ -253,6 +257,7 @@ static const ssl3HelloExtensionHandler s
347 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn },
348 { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn }, 347 { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn },
348 { ssl_app_layer_protocol_xtn, &ssl3_ClientHandleAppProtoXtn },
349 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn }, 349 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn },
350 + { ssl_channel_id_xtn, &ssl3_ClientHandleChannelIDXtn }, 350 + { ssl_channel_id_xtn, &ssl3_ClientHandleChannelIDXtn },
351 { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn }, 351 { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn },
352 { -1, NULL } 352 { -1, NULL }
353 }; 353 };
354 @@ -274,6 +279,7 @@ ssl3HelloExtensionSender clientHelloSend 354 @@ -280,6 +285,7 @@ ssl3HelloExtensionSender clientHelloSend
355 { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn },
356 { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn }, 355 { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn },
356 { ssl_app_layer_protocol_xtn, &ssl3_ClientSendAppProtoXtn },
357 { ssl_use_srtp_xtn, &ssl3_SendUseSRTPXtn }, 357 { ssl_use_srtp_xtn, &ssl3_SendUseSRTPXtn },
358 + { ssl_channel_id_xtn, &ssl3_ClientSendChannelIDXtn }, 358 + { ssl_channel_id_xtn, &ssl3_ClientSendChannelIDXtn },
359 { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn }, 359 { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn },
360 { ssl_signature_algorithms_xtn, &ssl3_ClientSendSigAlgsXtn } 360 { ssl_signature_algorithms_xtn, &ssl3_ClientSendSigAlgsXtn }
361 /* any extra entries will appear as { 0, NULL } */ 361 /* any extra entries will appear as { 0, NULL } */
362 @@ -669,6 +675,61 @@ ssl3_ClientSendNextProtoNegoXtn(sslSocke 362 @@ -795,6 +801,61 @@ loser:
363 } 363 return -1;
364 }
364 365
365 return extension_length;
366 +
367 +loser:
368 + return -1;
369 +}
370 +
371 +static SECStatus 366 +static SECStatus
372 +ssl3_ClientHandleChannelIDXtn(sslSocket *ss, PRUint16 ex_type, 367 +ssl3_ClientHandleChannelIDXtn(sslSocket *ss, PRUint16 ex_type,
373 + SECItem *data) 368 + SECItem *data)
374 +{ 369 +{
375 + PORT_Assert(ss->getChannelID != NULL); 370 + PORT_Assert(ss->getChannelID != NULL);
376 + 371 +
377 + if (data->len) { 372 + if (data->len) {
378 + PORT_SetError(SSL_ERROR_BAD_CHANNEL_ID_DATA); 373 + PORT_SetError(SSL_ERROR_BAD_CHANNEL_ID_DATA);
379 + return SECFailure; 374 + return SECFailure;
380 + } 375 + }
(...skipping 30 matching lines...) Expand all
411 + if (rv != SECSuccess) 406 + if (rv != SECSuccess)
412 + goto loser; 407 + goto loser;
413 + rv = ssl3_AppendHandshakeNumber(ss, 0, 2); 408 + rv = ssl3_AppendHandshakeNumber(ss, 0, 2);
414 + if (rv != SECSuccess) 409 + if (rv != SECSuccess)
415 + goto loser; 410 + goto loser;
416 + ss->xtnData.advertised[ss->xtnData.numAdvertised++] = 411 + ss->xtnData.advertised[ss->xtnData.numAdvertised++] =
417 + ssl_channel_id_xtn; 412 + ssl_channel_id_xtn;
418 + } 413 + }
419 + 414 +
420 + return extension_length; 415 + return extension_length;
421 416 +
422 loser: 417 +loser:
423 return -1; 418 + return -1;
419 +}
420 +
421 static SECStatus
422 ssl3_ClientHandleStatusRequestXtn(sslSocket *ss, PRUint16 ex_type,
423 SECItem *data)
424 diff -pu a/nss/lib/ssl/ssl3prot.h b/nss/lib/ssl/ssl3prot.h 424 diff -pu a/nss/lib/ssl/ssl3prot.h b/nss/lib/ssl/ssl3prot.h
425 --- a/nss/lib/ssl/ssl3prot.h» 2014-01-03 19:28:03.550814608 -0800 425 --- a/nss/lib/ssl/ssl3prot.h» 2014-01-18 10:39:34.278881614 -0800
426 +++ b/nss/lib/ssl/ssl3prot.h» 2014-01-03 19:36:25.379018825 -0800 426 +++ b/nss/lib/ssl/ssl3prot.h» 2014-01-18 10:40:15.499552430 -0800
427 @@ -129,7 +129,8 @@ typedef enum { 427 @@ -129,7 +129,8 @@ typedef enum {
428 client_key_exchange = 16, 428 client_key_exchange = 16,
429 finished = 20, 429 finished = 20,
430 certificate_status = 22, 430 certificate_status = 22,
431 - next_proto = 67 431 - next_proto = 67
432 + next_proto = 67, 432 + next_proto = 67,
433 + encrypted_extensions= 203 433 + encrypted_extensions= 203
434 } SSL3HandshakeType; 434 } SSL3HandshakeType;
435 435
436 typedef struct { 436 typedef struct {
437 diff -pu a/nss/lib/ssl/sslauth.c b/nss/lib/ssl/sslauth.c 437 diff -pu a/nss/lib/ssl/sslauth.c b/nss/lib/ssl/sslauth.c
438 --- a/nss/lib/ssl/sslauth.c» 2014-01-03 19:31:09.783859095 -0800 438 --- a/nss/lib/ssl/sslauth.c» 2014-01-18 10:39:50.749149654 -0800
439 +++ b/nss/lib/ssl/sslauth.c» 2014-01-03 19:36:25.379018825 -0800 439 +++ b/nss/lib/ssl/sslauth.c» 2014-01-18 10:40:15.499552430 -0800
440 @@ -216,6 +216,24 @@ SSL_GetClientAuthDataHook(PRFileDesc *s, 440 @@ -216,6 +216,24 @@ SSL_GetClientAuthDataHook(PRFileDesc *s,
441 return SECSuccess; 441 return SECSuccess;
442 } 442 }
443 443
444 +SECStatus 444 +SECStatus
445 +SSL_SetClientChannelIDCallback(PRFileDesc *fd, 445 +SSL_SetClientChannelIDCallback(PRFileDesc *fd,
446 + SSLClientChannelIDCallback callback, 446 + SSLClientChannelIDCallback callback,
447 + void *arg) { 447 + void *arg) {
448 + sslSocket *ss = ssl_FindSocket(fd); 448 + sslSocket *ss = ssl_FindSocket(fd);
449 + 449 +
450 + if (!ss) { 450 + if (!ss) {
451 + SSL_DBG(("%d: SSL[%d]: bad socket in SSL_SetClientChannelIDCallback", 451 + SSL_DBG(("%d: SSL[%d]: bad socket in SSL_SetClientChannelIDCallback",
452 + SSL_GETPID(), fd)); 452 + SSL_GETPID(), fd));
453 + return SECFailure; 453 + return SECFailure;
454 + } 454 + }
455 + 455 +
456 + ss->getChannelID = callback; 456 + ss->getChannelID = callback;
457 + ss->getChannelIDArg = arg; 457 + ss->getChannelIDArg = arg;
458 + 458 +
459 + return SECSuccess; 459 + return SECSuccess;
460 +} 460 +}
461 + 461 +
462 #ifdef NSS_PLATFORM_CLIENT_AUTH 462 #ifdef NSS_PLATFORM_CLIENT_AUTH
463 /* NEED LOCKS IN HERE. */ 463 /* NEED LOCKS IN HERE. */
464 SECStatus 464 SECStatus
465 diff -pu a/nss/lib/ssl/sslerr.h b/nss/lib/ssl/sslerr.h 465 diff -pu a/nss/lib/ssl/sslerr.h b/nss/lib/ssl/sslerr.h
466 --- a/nss/lib/ssl/sslerr.h» 2014-01-03 19:28:03.550814608 -0800 466 --- a/nss/lib/ssl/sslerr.h» 2014-01-18 10:39:34.288881780 -0800
467 +++ b/nss/lib/ssl/sslerr.h» 2014-01-03 19:36:25.379018825 -0800 467 +++ b/nss/lib/ssl/sslerr.h» 2014-01-18 10:40:15.499552430 -0800
468 @@ -193,6 +193,10 @@ SSL_ERROR_UNSUPPORTED_HASH_ALGORITHM = ( 468 @@ -193,6 +193,10 @@ SSL_ERROR_UNSUPPORTED_HASH_ALGORITHM = (
469 SSL_ERROR_DIGEST_FAILURE = (SSL_ERROR_BASE + 127), 469 SSL_ERROR_DIGEST_FAILURE = (SSL_ERROR_BASE + 127),
470 SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM = (SSL_ERROR_BASE + 128), 470 SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM = (SSL_ERROR_BASE + 128),
471 471
472 +SSL_ERROR_BAD_CHANNEL_ID_DATA = (SSL_ERROR_BASE + 129), 472 +SSL_ERROR_BAD_CHANNEL_ID_DATA = (SSL_ERROR_BASE + 129),
473 +SSL_ERROR_INVALID_CHANNEL_ID_KEY = (SSL_ERROR_BASE + 130), 473 +SSL_ERROR_INVALID_CHANNEL_ID_KEY = (SSL_ERROR_BASE + 130),
474 +SSL_ERROR_GET_CHANNEL_ID_FAILED = (SSL_ERROR_BASE + 131), 474 +SSL_ERROR_GET_CHANNEL_ID_FAILED = (SSL_ERROR_BASE + 131),
475 + 475 +
476 SSL_ERROR_END_OF_LIST /* let the c compiler determine the value of this. */ 476 SSL_ERROR_END_OF_LIST /* let the c compiler determine the value of this. */
477 } SSLErrorCodes; 477 } SSLErrorCodes;
478 #endif /* NO_SECURITY_ERROR_ENUM */ 478 #endif /* NO_SECURITY_ERROR_ENUM */
479 diff -pu a/nss/lib/ssl/SSLerrs.h b/nss/lib/ssl/SSLerrs.h 479 diff -pu a/nss/lib/ssl/SSLerrs.h b/nss/lib/ssl/SSLerrs.h
480 --- a/nss/lib/ssl/SSLerrs.h» 2014-01-03 19:28:03.540814444 -0800 480 --- a/nss/lib/ssl/SSLerrs.h» 2014-01-18 10:39:34.238880964 -0800
481 +++ b/nss/lib/ssl/SSLerrs.h» 2014-01-03 19:36:25.379018825 -0800 481 +++ b/nss/lib/ssl/SSLerrs.h» 2014-01-18 10:40:15.499552430 -0800
482 @@ -412,3 +412,12 @@ ER3(SSL_ERROR_DIGEST_FAILURE, (SSL_ERROR 482 @@ -412,3 +412,12 @@ ER3(SSL_ERROR_DIGEST_FAILURE, (SSL_ERROR
483 483
484 ER3(SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM, (SSL_ERROR_BASE + 128), 484 ER3(SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM, (SSL_ERROR_BASE + 128),
485 "Incorrect signature algorithm specified in a digitally-signed element.") 485 "Incorrect signature algorithm specified in a digitally-signed element.")
486 + 486 +
487 +ER3(SSL_ERROR_BAD_CHANNEL_ID_DATA, (SSL_ERROR_BASE + 129), 487 +ER3(SSL_ERROR_BAD_CHANNEL_ID_DATA, (SSL_ERROR_BASE + 129),
488 +"SSL received a malformed TLS Channel ID extension.") 488 +"SSL received a malformed TLS Channel ID extension.")
489 + 489 +
490 +ER3(SSL_ERROR_INVALID_CHANNEL_ID_KEY, (SSL_ERROR_BASE + 130), 490 +ER3(SSL_ERROR_INVALID_CHANNEL_ID_KEY, (SSL_ERROR_BASE + 130),
491 +"The application provided an invalid TLS Channel ID key.") 491 +"The application provided an invalid TLS Channel ID key.")
492 + 492 +
493 +ER3(SSL_ERROR_GET_CHANNEL_ID_FAILED, (SSL_ERROR_BASE + 131), 493 +ER3(SSL_ERROR_GET_CHANNEL_ID_FAILED, (SSL_ERROR_BASE + 131),
494 +"The application could not get a TLS Channel ID.") 494 +"The application could not get a TLS Channel ID.")
495 diff -pu a/nss/lib/ssl/ssl.h b/nss/lib/ssl/ssl.h 495 diff -pu a/nss/lib/ssl/ssl.h b/nss/lib/ssl/ssl.h
496 --- a/nss/lib/ssl/ssl.h»2014-01-03 19:36:09.938766379 -0800 496 --- a/nss/lib/ssl/ssl.h»2014-01-18 10:39:50.799150460 -0800
497 +++ b/nss/lib/ssl/ssl.h»2014-01-03 19:36:25.379018825 -0800 497 +++ b/nss/lib/ssl/ssl.h»2014-01-18 10:40:15.499552430 -0800
498 @@ -985,6 +985,34 @@ SSL_IMPORT SECStatus SSL_HandshakeNegoti 498 @@ -1015,6 +1015,34 @@ SSL_IMPORT SECStatus SSL_HandshakeNegoti
499 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd, 499 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd,
500 PRBool *last_handshake_resumed ); 500 PRBool *last_handshake_resumed );
501 501
502 +/* See SSL_SetClientChannelIDCallback for usage. If the callback returns 502 +/* See SSL_SetClientChannelIDCallback for usage. If the callback returns
503 + * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in 503 + * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in
504 + * the future to restart the handshake. On SECSuccess, the callback must have 504 + * the future to restart the handshake. On SECSuccess, the callback must have
505 + * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */ 505 + * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */
506 +typedef SECStatus (PR_CALLBACK *SSLClientChannelIDCallback)( 506 +typedef SECStatus (PR_CALLBACK *SSLClientChannelIDCallback)(
507 + void *arg, 507 + void *arg,
508 + PRFileDesc *fd, 508 + PRFileDesc *fd,
(...skipping 15 matching lines...) Expand all
524 + * extension to be advertised. */ 524 + * extension to be advertised. */
525 +SSL_IMPORT SECStatus SSL_SetClientChannelIDCallback( 525 +SSL_IMPORT SECStatus SSL_SetClientChannelIDCallback(
526 + PRFileDesc *fd, 526 + PRFileDesc *fd,
527 + SSLClientChannelIDCallback callback, 527 + SSLClientChannelIDCallback callback,
528 + void *arg); 528 + void *arg);
529 + 529 +
530 /* 530 /*
531 ** How long should we wait before retransmitting the next flight of 531 ** How long should we wait before retransmitting the next flight of
532 ** the DTLS handshake? Returns SECFailure if not DTLS or not in a 532 ** the DTLS handshake? Returns SECFailure if not DTLS or not in a
533 diff -pu a/nss/lib/ssl/sslimpl.h b/nss/lib/ssl/sslimpl.h 533 diff -pu a/nss/lib/ssl/sslimpl.h b/nss/lib/ssl/sslimpl.h
534 --- a/nss/lib/ssl/sslimpl.h» 2014-01-03 19:36:09.938766379 -0800 534 --- a/nss/lib/ssl/sslimpl.h» 2014-01-18 10:39:50.799150460 -0800
535 +++ b/nss/lib/ssl/sslimpl.h» 2014-01-03 19:36:25.379018825 -0800 535 +++ b/nss/lib/ssl/sslimpl.h» 2014-01-18 10:40:15.499552430 -0800
536 @@ -700,6 +700,14 @@ struct sslSessionIDStr { 536 @@ -709,6 +709,14 @@ struct sslSessionIDStr {
537 537
538 SECItem srvName; 538 SECItem srvName;
539 539
540 + /* originalHandshakeHash contains the hash of the original, full 540 + /* originalHandshakeHash contains the hash of the original, full
541 + * handshake prior to the server's final flow. This is either a 541 + * handshake prior to the server's final flow. This is either a
542 + * SHA-1/MD5 combination (for TLS < 1.2) or the TLS PRF hash (for 542 + * SHA-1/MD5 combination (for TLS < 1.2) or the TLS PRF hash (for
543 + * TLS 1.2). This is recorded and used only when ChannelID is 543 + * TLS 1.2). This is recorded and used only when ChannelID is
544 + * negotiated as it's used to bind the ChannelID signature on the 544 + * negotiated as it's used to bind the ChannelID signature on the
545 + * resumption handshake to the original handshake. */ 545 + * resumption handshake to the original handshake. */
546 + SECItem originalHandshakeHash; 546 + SECItem originalHandshakeHash;
547 + 547 +
548 /* This lock is lazily initialized by CacheSID when a sid is first 548 /* This lock is lazily initialized by CacheSID when a sid is first
549 * cached. Before then, there is no need to lock anything because 549 * cached. Before then, there is no need to lock anything because
550 * the sid isn't being shared by anything. 550 * the sid isn't being shared by anything.
551 @@ -969,6 +977,9 @@ struct ssl3StateStr { 551 @@ -978,6 +986,9 @@ struct ssl3StateStr {
552 CERTCertificateList *clientCertChain; /* used by client */ 552 CERTCertificateList *clientCertChain; /* used by client */
553 PRBool sendEmptyCert; /* used by client */ 553 PRBool sendEmptyCert; /* used by client */
554 554
555 + SECKEYPrivateKey *channelID; /* used by client */ 555 + SECKEYPrivateKey *channelID; /* used by client */
556 + SECKEYPublicKey *channelIDPub; /* used by client */ 556 + SECKEYPublicKey *channelIDPub; /* used by client */
557 + 557 +
558 int policy; 558 int policy;
559 /* This says what cipher suites we can do, and should 559 /* This says what cipher suites we can do, and should
560 * be either SSL_ALLOWED or SSL_RESTRICTED 560 * be either SSL_ALLOWED or SSL_RESTRICTED
561 @@ -1246,6 +1257,8 @@ const unsigned char * preferredCipher; 561 @@ -1255,6 +1266,8 @@ const unsigned char * preferredCipher;
562 void *pkcs11PinArg; 562 void *pkcs11PinArg;
563 SSLNextProtoCallback nextProtoCallback; 563 SSLNextProtoCallback nextProtoCallback;
564 void *nextProtoArg; 564 void *nextProtoArg;
565 + SSLClientChannelIDCallback getChannelID; 565 + SSLClientChannelIDCallback getChannelID;
566 + void *getChannelIDArg; 566 + void *getChannelIDArg;
567 567
568 PRIntervalTime rTimeout; /* timeout for NSPR I/O */ 568 PRIntervalTime rTimeout; /* timeout for NSPR I/O */
569 PRIntervalTime wTimeout; /* timeout for NSPR I/O */ 569 PRIntervalTime wTimeout; /* timeout for NSPR I/O */
570 @@ -1590,6 +1603,11 @@ extern SECStatus ssl3_RestartHandshakeAf 570 @@ -1599,6 +1612,11 @@ extern SECStatus ssl3_RestartHandshakeAf
571 SECKEYPrivateKey * key, 571 SECKEYPrivateKey * key,
572 CERTCertificateList *certChain); 572 CERTCertificateList *certChain);
573 573
574 +extern SECStatus ssl3_RestartHandshakeAfterChannelIDReq( 574 +extern SECStatus ssl3_RestartHandshakeAfterChannelIDReq(
575 + sslSocket *ss, 575 + sslSocket *ss,
576 + SECKEYPublicKey *channelIDPub, 576 + SECKEYPublicKey *channelIDPub,
577 + SECKEYPrivateKey *channelID); 577 + SECKEYPrivateKey *channelID);
578 + 578 +
579 extern SECStatus ssl3_AuthCertificateComplete(sslSocket *ss, PRErrorCode error) ; 579 extern SECStatus ssl3_AuthCertificateComplete(sslSocket *ss, PRErrorCode error) ;
580 580
581 /* 581 /*
582 diff -pu a/nss/lib/ssl/sslnonce.c b/nss/lib/ssl/sslnonce.c 582 diff -pu a/nss/lib/ssl/sslnonce.c b/nss/lib/ssl/sslnonce.c
583 --- a/nss/lib/ssl/sslnonce.c» 2014-01-03 19:30:40.073373382 -0800 583 --- a/nss/lib/ssl/sslnonce.c» 2014-01-18 10:39:50.739149486 -0800
584 +++ b/nss/lib/ssl/sslnonce.c» 2014-01-03 19:36:25.379018825 -0800 584 +++ b/nss/lib/ssl/sslnonce.c» 2014-01-18 10:40:15.499552430 -0800
585 @@ -182,6 +182,9 @@ ssl_DestroySID(sslSessionID *sid) 585 @@ -180,6 +180,9 @@ ssl_DestroySID(sslSessionID *sid)
586 if (sid->u.ssl3.srvName.data) { 586 if (sid->u.ssl3.srvName.data) {
587 SECITEM_FreeItem(&sid->u.ssl3.srvName, PR_FALSE); 587 SECITEM_FreeItem(&sid->u.ssl3.srvName, PR_FALSE);
588 } 588 }
589 + if (sid->u.ssl3.originalHandshakeHash.data) { 589 + if (sid->u.ssl3.originalHandshakeHash.data) {
590 + SECITEM_FreeItem(&sid->u.ssl3.originalHandshakeHash, PR_FALSE); 590 + SECITEM_FreeItem(&sid->u.ssl3.originalHandshakeHash, PR_FALSE);
591 + } 591 + }
592 592
593 if (sid->u.ssl3.lock) { 593 if (sid->u.ssl3.lock) {
594 PR_DestroyRWLock(sid->u.ssl3.lock); 594 PR_DestroyRWLock(sid->u.ssl3.lock);
595 diff -pu a/nss/lib/ssl/sslsecur.c b/nss/lib/ssl/sslsecur.c 595 diff -pu a/nss/lib/ssl/sslsecur.c b/nss/lib/ssl/sslsecur.c
596 --- a/nss/lib/ssl/sslsecur.c» 2014-01-03 19:36:09.938766379 -0800 596 --- a/nss/lib/ssl/sslsecur.c» 2014-01-18 10:39:50.799150460 -0800
597 +++ b/nss/lib/ssl/sslsecur.c» 2014-01-03 19:36:25.379018825 -0800 597 +++ b/nss/lib/ssl/sslsecur.c» 2014-01-18 10:40:15.499552430 -0800
598 @@ -1584,6 +1584,42 @@ SSL_RestartHandshakeAfterCertReq(PRFileD 598 @@ -1584,6 +1584,42 @@ SSL_RestartHandshakeAfterCertReq(PRFileD
599 return ret; 599 return ret;
600 } 600 }
601 601
602 +SECStatus 602 +SECStatus
603 +SSL_RestartHandshakeAfterChannelIDReq(PRFileDesc * fd, 603 +SSL_RestartHandshakeAfterChannelIDReq(PRFileDesc * fd,
604 + SECKEYPublicKey * channelIDPub, 604 + SECKEYPublicKey * channelIDPub,
605 + SECKEYPrivateKey *channelID) 605 + SECKEYPrivateKey *channelID)
606 +{ 606 +{
607 + sslSocket * ss = ssl_FindSocket(fd); 607 + sslSocket * ss = ssl_FindSocket(fd);
(...skipping 24 matching lines...) Expand all
632 +loser: 632 +loser:
633 + SECKEY_DestroyPublicKey(channelIDPub); 633 + SECKEY_DestroyPublicKey(channelIDPub);
634 + SECKEY_DestroyPrivateKey(channelID); 634 + SECKEY_DestroyPrivateKey(channelID);
635 + return SECFailure; 635 + return SECFailure;
636 +} 636 +}
637 + 637 +
638 /* DO NOT USE. This function was exported in ssl.def with the wrong signature; 638 /* DO NOT USE. This function was exported in ssl.def with the wrong signature;
639 * this implementation exists to maintain link-time compatibility. 639 * this implementation exists to maintain link-time compatibility.
640 */ 640 */
641 diff -pu a/nss/lib/ssl/sslsock.c b/nss/lib/ssl/sslsock.c 641 diff -pu a/nss/lib/ssl/sslsock.c b/nss/lib/ssl/sslsock.c
642 --- a/nss/lib/ssl/sslsock.c» 2014-01-03 19:32:06.914793097 -0800 642 --- a/nss/lib/ssl/sslsock.c» 2014-01-18 10:39:50.769149984 -0800
643 +++ b/nss/lib/ssl/sslsock.c» 2014-01-03 19:36:25.379018825 -0800 643 +++ b/nss/lib/ssl/sslsock.c» 2014-01-18 10:40:15.499552430 -0800
644 @@ -274,6 +274,8 @@ ssl_DupSocket(sslSocket *os) 644 @@ -276,6 +276,8 @@ ssl_DupSocket(sslSocket *os)
645 ss->canFalseStartCallback = os->canFalseStartCallback; 645 ss->canFalseStartCallback = os->canFalseStartCallback;
646 ss->canFalseStartCallbackData = os->canFalseStartCallbackData; 646 ss->canFalseStartCallbackData = os->canFalseStartCallbackData;
647 ss->pkcs11PinArg = os->pkcs11PinArg; 647 ss->pkcs11PinArg = os->pkcs11PinArg;
648 + ss->getChannelID = os->getChannelID; 648 + ss->getChannelID = os->getChannelID;
649 + ss->getChannelIDArg = os->getChannelIDArg; 649 + ss->getChannelIDArg = os->getChannelIDArg;
650 650
651 /* Create security data */ 651 /* Create security data */
652 rv = ssl_CopySecurityInfo(ss, os); 652 rv = ssl_CopySecurityInfo(ss, os);
653 @@ -1669,6 +1671,10 @@ SSL_ReconfigFD(PRFileDesc *model, PRFile 653 @@ -1691,6 +1693,10 @@ SSL_ReconfigFD(PRFileDesc *model, PRFile
654 ss->handshakeCallbackData = sm->handshakeCallbackData; 654 ss->handshakeCallbackData = sm->handshakeCallbackData;
655 if (sm->pkcs11PinArg) 655 if (sm->pkcs11PinArg)
656 ss->pkcs11PinArg = sm->pkcs11PinArg; 656 ss->pkcs11PinArg = sm->pkcs11PinArg;
657 + if (sm->getChannelID) 657 + if (sm->getChannelID)
658 + ss->getChannelID = sm->getChannelID; 658 + ss->getChannelID = sm->getChannelID;
659 + if (sm->getChannelIDArg) 659 + if (sm->getChannelIDArg)
660 + ss->getChannelIDArg = sm->getChannelIDArg; 660 + ss->getChannelIDArg = sm->getChannelIDArg;
661 return fd; 661 return fd;
662 loser: 662 loser:
663 return NULL; 663 return NULL;
664 @@ -2946,6 +2952,8 @@ ssl_NewSocket(PRBool makeLocks, SSLProto 664 @@ -2968,6 +2974,8 @@ ssl_NewSocket(PRBool makeLocks, SSLProto
665 ss->badCertArg = NULL; 665 ss->badCertArg = NULL;
666 ss->pkcs11PinArg = NULL; 666 ss->pkcs11PinArg = NULL;
667 ss->ephemeralECDHKeyPair = NULL; 667 ss->ephemeralECDHKeyPair = NULL;
668 + ss->getChannelID = NULL; 668 + ss->getChannelID = NULL;
669 + ss->getChannelIDArg = NULL; 669 + ss->getChannelIDArg = NULL;
670 670
671 ssl_ChooseOps(ss); 671 ssl_ChooseOps(ss);
672 ssl2_InitSocketPolicy(ss); 672 ssl2_InitSocketPolicy(ss);
673 diff -pu a/nss/lib/ssl/sslt.h b/nss/lib/ssl/sslt.h 673 diff -pu a/nss/lib/ssl/sslt.h b/nss/lib/ssl/sslt.h
674 --- a/nss/lib/ssl/sslt.h» 2014-01-03 19:28:03.560814773 -0800 674 --- a/nss/lib/ssl/sslt.h» 2014-01-18 10:39:34.328882426 -0800
675 +++ b/nss/lib/ssl/sslt.h» 2014-01-03 19:36:25.379018825 -0800 675 +++ b/nss/lib/ssl/sslt.h» 2014-01-18 10:40:15.499552430 -0800
676 @@ -189,9 +189,10 @@ typedef enum { 676 @@ -190,10 +190,11 @@ typedef enum {
677 ssl_use_srtp_xtn = 14, 677 ssl_app_layer_protocol_xtn = 16,
678 ssl_session_ticket_xtn = 35, 678 ssl_session_ticket_xtn = 35,
679 ssl_next_proto_nego_xtn = 13172, 679 ssl_next_proto_nego_xtn = 13172,
680 + ssl_channel_id_xtn = 30032, 680 + ssl_channel_id_xtn = 30032,
681 ssl_padding_xtn = 35655,
681 ssl_renegotiation_info_xtn = 0xff01 /* experimental number */ 682 ssl_renegotiation_info_xtn = 0xff01 /* experimental number */
682 } SSLExtensionType; 683 } SSLExtensionType;
683 684
684 -#define SSL_MAX_EXTENSIONS 9 685 -#define SSL_MAX_EXTENSIONS 10 /* doesn't include ssl_padding_xtn. * /
685 +#define SSL_MAX_EXTENSIONS 10 686 +#define SSL_MAX_EXTENSIONS 11 /* doesn't include ssl_padding_xtn. * /
686 687
687 #endif /* __sslt_h_ */ 688 #endif /* __sslt_h_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698