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

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

Issue 20598007: NSS: rename ALPN extension to have _xtn suffix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update wtc's land that landed in the meantime. Created 7 years, 4 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
« no previous file with comments | « net/third_party/nss/patches/alpn.patch ('k') | net/third_party/nss/ssl/sslt.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * SSL3 Protocol 2 * SSL3 Protocol
3 * 3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public 4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 7
8 /* TLS extension code moved here from ssl3ecc.c */ 8 /* TLS extension code moved here from ssl3ecc.c */
9 9
10 #include "nssrenam.h" 10 #include "nssrenam.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 { ssl_next_proto_nego_xtn, &ssl3_ServerHandleNextProtoNegoXtn }, 243 { ssl_next_proto_nego_xtn, &ssl3_ServerHandleNextProtoNegoXtn },
244 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn }, 244 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn },
245 { ssl_cert_status_xtn, &ssl3_ServerHandleStatusRequestXtn }, 245 { ssl_cert_status_xtn, &ssl3_ServerHandleStatusRequestXtn },
246 { ssl_signature_algorithms_xtn, &ssl3_ServerHandleSigAlgsXtn }, 246 { ssl_signature_algorithms_xtn, &ssl3_ServerHandleSigAlgsXtn },
247 { -1, NULL } 247 { -1, NULL }
248 }; 248 };
249 249
250 /* These two tables are used by the client, to handle server hello 250 /* These two tables are used by the client, to handle server hello
251 * extensions. */ 251 * extensions. */
252 static const ssl3HelloExtensionHandler serverHelloHandlersTLS[] = { 252 static const ssl3HelloExtensionHandler serverHelloHandlersTLS[] = {
253 { ssl_server_name_xtn, &ssl3_HandleServerNameXtn }, 253 { ssl_server_name_xtn, &ssl3_HandleServerNameXtn },
254 /* TODO: add a handler for ssl_ec_point_formats_xtn */ 254 /* TODO: add a handler for ssl_ec_point_formats_xtn */
255 { ssl_session_ticket_xtn, &ssl3_ClientHandleSessionTicketXtn }, 255 { ssl_session_ticket_xtn, &ssl3_ClientHandleSessionTicketXtn },
256 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn }, 256 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn },
257 { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn }, 257 { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn },
258 { ssl_application_layer_protocol, &ssl3_ClientHandleAppProtoXtn }, 258 { ssl_app_layer_protocol_xtn, &ssl3_ClientHandleAppProtoXtn },
259 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn }, 259 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn },
260 { ssl_channel_id_xtn, &ssl3_ClientHandleChannelIDXtn }, 260 { ssl_channel_id_xtn, &ssl3_ClientHandleChannelIDXtn },
261 { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn }, 261 { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn },
262 { -1, NULL } 262 { -1, NULL }
263 }; 263 };
264 264
265 static const ssl3HelloExtensionHandler serverHelloHandlersSSL3[] = { 265 static const ssl3HelloExtensionHandler serverHelloHandlersSSL3[] = {
266 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn }, 266 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn },
267 { -1, NULL } 267 { -1, NULL }
268 }; 268 };
269 269
270 /* Tables of functions to format TLS hello extensions, one function per 270 /* Tables of functions to format TLS hello extensions, one function per
271 * extension. 271 * extension.
272 * These static tables are for the formatting of client hello extensions. 272 * These static tables are for the formatting of client hello extensions.
273 * The server's table of hello senders is dynamic, in the socket struct, 273 * The server's table of hello senders is dynamic, in the socket struct,
274 * and sender functions are registered there. 274 * and sender functions are registered there.
275 */ 275 */
276 static const 276 static const
277 ssl3HelloExtensionSender clientHelloSendersTLS[SSL_MAX_EXTENSIONS] = { 277 ssl3HelloExtensionSender clientHelloSendersTLS[SSL_MAX_EXTENSIONS] = {
278 { ssl_server_name_xtn, &ssl3_SendServerNameXtn }, 278 { ssl_server_name_xtn, &ssl3_SendServerNameXtn },
279 { ssl_renegotiation_info_xtn, &ssl3_SendRenegotiationInfoXtn }, 279 { ssl_renegotiation_info_xtn, &ssl3_SendRenegotiationInfoXtn },
280 #ifdef NSS_ENABLE_ECC 280 #ifdef NSS_ENABLE_ECC
281 { ssl_elliptic_curves_xtn, &ssl3_SendSupportedCurvesXtn }, 281 { ssl_elliptic_curves_xtn, &ssl3_SendSupportedCurvesXtn },
282 { ssl_ec_point_formats_xtn, &ssl3_SendSupportedPointFormatsXtn }, 282 { ssl_ec_point_formats_xtn, &ssl3_SendSupportedPointFormatsXtn },
283 #endif 283 #endif
284 { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn }, 284 { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn },
285 { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn }, 285 { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn },
286 { ssl_application_layer_protocol, &ssl3_ClientSendAppProtoXtn }, 286 { ssl_app_layer_protocol_xtn, &ssl3_ClientSendAppProtoXtn },
287 { ssl_use_srtp_xtn, &ssl3_SendUseSRTPXtn }, 287 { ssl_use_srtp_xtn, &ssl3_SendUseSRTPXtn },
288 { ssl_channel_id_xtn, &ssl3_ClientSendChannelIDXtn }, 288 { ssl_channel_id_xtn, &ssl3_ClientSendChannelIDXtn },
289 { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn }, 289 { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn },
290 { ssl_signature_algorithms_xtn, &ssl3_ClientSendSigAlgsXtn } 290 { ssl_signature_algorithms_xtn, &ssl3_ClientSendSigAlgsXtn }
291 /* any extra entries will appear as { 0, NULL } */ 291 /* any extra entries will appear as { 0, NULL } */
292 }; 292 };
293 293
294 static const 294 static const
295 ssl3HelloExtensionSender clientHelloSendersSSL3[SSL_MAX_EXTENSIONS] = { 295 ssl3HelloExtensionSender clientHelloSendersSSL3[SSL_MAX_EXTENSIONS] = {
296 { ssl_renegotiation_info_xtn, &ssl3_SendRenegotiationInfoXtn } 296 { ssl_renegotiation_info_xtn, &ssl3_SendRenegotiationInfoXtn }
297 /* any extra entries will appear as { 0, NULL } */ 297 /* any extra entries will appear as { 0, NULL } */
298 }; 298 };
299 299
300 static PRBool 300 static PRBool
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 static SECStatus 604 static SECStatus
605 ssl3_ClientHandleNextProtoNegoXtn(sslSocket *ss, PRUint16 ex_type, 605 ssl3_ClientHandleNextProtoNegoXtn(sslSocket *ss, PRUint16 ex_type,
606 SECItem *data) 606 SECItem *data)
607 { 607 {
608 SECStatus rv; 608 SECStatus rv;
609 unsigned char resultBuffer[255]; 609 unsigned char resultBuffer[255];
610 SECItem result = { siBuffer, resultBuffer, 0 }; 610 SECItem result = { siBuffer, resultBuffer, 0 };
611 611
612 PORT_Assert(!ss->firstHsDone); 612 PORT_Assert(!ss->firstHsDone);
613 613
614 if (ssl3_ExtensionNegotiated(ss, ssl_application_layer_protocol)) { 614 if (ssl3_ExtensionNegotiated(ss, ssl_app_layer_protocol_xtn)) {
615 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); 615 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
616 return SECFailure; 616 return SECFailure;
617 } 617 }
618 618
619 rv = ssl3_ValidateNextProtoNego(data->data, data->len); 619 rv = ssl3_ValidateNextProtoNego(data->data, data->len);
620 if (rv != SECSuccess) 620 if (rv != SECSuccess)
621 return rv; 621 return rv;
622 622
623 /* ss->nextProtoCallback cannot normally be NULL if we negotiated the 623 /* ss->nextProtoCallback cannot normally be NULL if we negotiated the
624 * extension. However, It is possible that an application erroneously 624 * extension. However, It is possible that an application erroneously
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 if (!ss->opt.nextProtoNego.data || ss->firstHsDone) { 729 if (!ss->opt.nextProtoNego.data || ss->firstHsDone) {
730 return 0; 730 return 0;
731 } 731 }
732 732
733 extension_length = 2 /* extension type */ + 2 /* extension length */ + 733 extension_length = 2 /* extension type */ + 2 /* extension length */ +
734 2 /* protocol name list length */ + 734 2 /* protocol name list length */ +
735 ss->opt.nextProtoNego.len; 735 ss->opt.nextProtoNego.len;
736 736
737 if (append && maxBytes >= extension_length) { 737 if (append && maxBytes >= extension_length) {
738 SECStatus rv; 738 SECStatus rv;
739 » rv = ssl3_AppendHandshakeNumber(ss, ssl_application_layer_protocol, 2); 739 » rv = ssl3_AppendHandshakeNumber(ss, ssl_app_layer_protocol_xtn, 2);
740 if (rv != SECSuccess) 740 if (rv != SECSuccess)
741 goto loser; 741 goto loser;
742 rv = ssl3_AppendHandshakeNumber(ss, extension_length - 4, 2); 742 rv = ssl3_AppendHandshakeNumber(ss, extension_length - 4, 2);
743 if (rv != SECSuccess) 743 if (rv != SECSuccess)
744 goto loser; 744 goto loser;
745 rv = ssl3_AppendHandshakeVariable(ss, ss->opt.nextProtoNego.data, 745 rv = ssl3_AppendHandshakeVariable(ss, ss->opt.nextProtoNego.data,
746 ss->opt.nextProtoNego.len, 2); 746 ss->opt.nextProtoNego.len, 2);
747 if (rv != SECSuccess) 747 if (rv != SECSuccess)
748 goto loser; 748 goto loser;
749 ss->xtnData.advertised[ss->xtnData.numAdvertised++] = 749 ss->xtnData.advertised[ss->xtnData.numAdvertised++] =
750 » » ssl_application_layer_protocol; 750 » » ssl_app_layer_protocol_xtn;
751 } else if (maxBytes < extension_length) { 751 } else if (maxBytes < extension_length) {
752 return 0; 752 return 0;
753 } 753 }
754 754
755 return extension_length; 755 return extension_length;
756 756
757 loser: 757 loser:
758 return -1; 758 return -1;
759 } 759 }
760 760
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 } else if (maxBytes < extension_length) { 2264 } else if (maxBytes < extension_length) {
2265 PORT_Assert(0); 2265 PORT_Assert(0);
2266 return 0; 2266 return 0;
2267 } 2267 }
2268 2268
2269 return extension_length; 2269 return extension_length;
2270 2270
2271 loser: 2271 loser:
2272 return -1; 2272 return -1;
2273 } 2273 }
OLDNEW
« no previous file with comments | « net/third_party/nss/patches/alpn.patch ('k') | net/third_party/nss/ssl/sslt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698