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

Side by Side Diff: net/third_party/nss/ssl/ssl3ext.c

Issue 10014010: net: False Start only for NPN capable servers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 /* 1 /*
2 * SSL3 Protocol 2 * SSL3 Protocol
3 * 3 *
4 * ***** BEGIN LICENSE BLOCK ***** 4 * ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * 6 *
7 * The contents of this file are subject to the Mozilla Public License Version 7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with 8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at 9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/ 10 * http://www.mozilla.org/MPL/
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 /* handle an incoming Next Protocol Negotiation extension. */ 560 /* handle an incoming Next Protocol Negotiation extension. */
561 static SECStatus 561 static SECStatus
562 ssl3_ServerHandleNextProtoNegoXtn(sslSocket * ss, PRUint16 ex_type, SECItem *dat a) 562 ssl3_ServerHandleNextProtoNegoXtn(sslSocket * ss, PRUint16 ex_type, SECItem *dat a)
563 { 563 {
564 if (ss->firstHsDone || data->len != 0) { 564 if (ss->firstHsDone || data->len != 0) {
565 /* Clients MUST send an empty NPN extension, if any. */ 565 /* Clients MUST send an empty NPN extension, if any. */
566 PORT_SetError(SSL_ERROR_NEXT_PROTOCOL_DATA_INVALID); 566 PORT_SetError(SSL_ERROR_NEXT_PROTOCOL_DATA_INVALID);
567 return SECFailure; 567 return SECFailure;
568 } 568 }
569 569
570 ss->xtnData.negotiated[ss->xtnData.numNegotiated++] = ex_type;
wtc 2012/04/17 22:46:09 Nit: please add a TODO or XXX comment that we also
571
570 return SECSuccess; 572 return SECSuccess;
571 } 573 }
572 574
573 /* ssl3_ValidateNextProtoNego checks that the given block of data is valid: none 575 /* ssl3_ValidateNextProtoNego checks that the given block of data is valid: none
574 * of the lengths may be 0 and the sum of the lengths must equal the length of 576 * of the lengths may be 0 and the sum of the lengths must equal the length of
575 * the block. */ 577 * the block. */
576 SECStatus 578 SECStatus
577 ssl3_ValidateNextProtoNego(const unsigned char* data, unsigned int length) 579 ssl3_ValidateNextProtoNego(const unsigned char* data, unsigned int length)
578 { 580 {
579 unsigned int offset = 0; 581 unsigned int offset = 0;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 result.data, &result.len, sizeof resultBuffer); 630 result.data, &result.len, sizeof resultBuffer);
629 if (rv != SECSuccess) 631 if (rv != SECSuccess)
630 return rv; 632 return rv;
631 /* If the callback wrote more than allowed to |result| it has corrupted our 633 /* If the callback wrote more than allowed to |result| it has corrupted our
632 * stack. */ 634 * stack. */
633 if (result.len > sizeof resultBuffer) { 635 if (result.len > sizeof resultBuffer) {
634 PORT_SetError(SEC_ERROR_OUTPUT_LEN); 636 PORT_SetError(SEC_ERROR_OUTPUT_LEN);
635 return SECFailure; 637 return SECFailure;
636 } 638 }
637 639
640 ss->xtnData.negotiated[ss->xtnData.numNegotiated++] = ex_type;
641
638 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); 642 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE);
639 return SECITEM_CopyItem(NULL, &ss->ssl3.nextProto, &result); 643 return SECITEM_CopyItem(NULL, &ss->ssl3.nextProto, &result);
640 } 644 }
641 645
642 static PRInt32 646 static PRInt32
643 ssl3_ClientSendNextProtoNegoXtn(sslSocket * ss, PRBool append, 647 ssl3_ClientSendNextProtoNegoXtn(sslSocket * ss, PRBool append,
644 PRUint32 maxBytes) 648 PRUint32 maxBytes)
645 { 649 {
646 PRInt32 extension_length; 650 PRInt32 extension_length;
647 651
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 1865
1862 /* The echoed extension must be empty. */ 1866 /* The echoed extension must be empty. */
1863 if (data->len != 0) 1867 if (data->len != 0)
1864 return SECFailure; 1868 return SECFailure;
1865 1869
1866 /* Keep track of negotiated extensions. */ 1870 /* Keep track of negotiated extensions. */
1867 ss->xtnData.negotiated[ss->xtnData.numNegotiated++] = ex_type; 1871 ss->xtnData.negotiated[ss->xtnData.numNegotiated++] = ex_type;
1868 1872
1869 return SECSuccess; 1873 return SECSuccess;
1870 } 1874 }
OLDNEW
« net/third_party/nss/ssl/ssl3con.c ('K') | « net/third_party/nss/ssl/ssl3con.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698