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

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

Issue 5611005: Workaround a bug in NSS when using DHE+client authentication. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback from wtc Created 10 years 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 | « no previous file | no next file » | 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 * ***** 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 5004 matching lines...) Expand 10 before | Expand all | Expand 10 after
5015 rv = ssl3_InitState(ss); 5015 rv = ssl3_InitState(ss);
5016 if (rv != SECSuccess) { 5016 if (rv != SECSuccess) {
5017 errCode = PORT_GetError(); /* ssl3_InitState has set the error code. */ 5017 errCode = PORT_GetError(); /* ssl3_InitState has set the error code. */
5018 goto alert_loser; 5018 goto alert_loser;
5019 } 5019 }
5020 if (ss->ssl3.hs.ws != wait_server_hello) { 5020 if (ss->ssl3.hs.ws != wait_server_hello) {
5021 errCode = SSL_ERROR_RX_UNEXPECTED_SERVER_HELLO; 5021 errCode = SSL_ERROR_RX_UNEXPECTED_SERVER_HELLO;
5022 desc = unexpected_message; 5022 desc = unexpected_message;
5023 goto alert_loser; 5023 goto alert_loser;
5024 } 5024 }
5025
5026 /* clean up anything left from previous handshake. */
5027 if (ss->ssl3.clientCertChain != NULL) {
5028 CERT_DestroyCertificateList(ss->ssl3.clientCertChain);
5029 ss->ssl3.clientCertChain = NULL;
5030 }
5031 if (ss->ssl3.clientCertificate != NULL) {
5032 CERT_DestroyCertificate(ss->ssl3.clientCertificate);
5033 ss->ssl3.clientCertificate = NULL;
5034 }
5035 if (ss->ssl3.clientPrivateKey != NULL) {
5036 SECKEY_DestroyPrivateKey(ss->ssl3.clientPrivateKey);
5037 ss->ssl3.clientPrivateKey = NULL;
5038 }
5039 #ifdef NSS_PLATFORM_CLIENT_AUTH
5040 if (ss->ssl3.platformClientKey) {
5041 ssl_FreePlatformKey(ss->ssl3.platformClientKey);
5042 ss->ssl3.platformClientKey = (PlatformKey)NULL;
5043 }
5044 #endif /* NSS_PLATFORM_CLIENT_AUTH */
5025 5045
5026 if (ss->ssl3.serverHelloPredictionData.data) 5046 if (ss->ssl3.serverHelloPredictionData.data)
5027 SECITEM_FreeItem(&ss->ssl3.serverHelloPredictionData, PR_FALSE); 5047 SECITEM_FreeItem(&ss->ssl3.serverHelloPredictionData, PR_FALSE);
5028 5048
5029 /* If this allocation fails it will only stop the application from 5049 /* If this allocation fails it will only stop the application from
5030 * recording the ServerHello information and performing future Snap 5050 * recording the ServerHello information and performing future Snap
5031 * Starts. */ 5051 * Starts. */
5032 if (SECITEM_AllocItem(NULL, &ss->ssl3.serverHelloPredictionData, length)) 5052 if (SECITEM_AllocItem(NULL, &ss->ssl3.serverHelloPredictionData, length))
5033 memcpy(ss->ssl3.serverHelloPredictionData.data, b, length); 5053 memcpy(ss->ssl3.serverHelloPredictionData.data, b, length);
5034 /* ss->ssl3.serverHelloPredictionDataValid is still false at this 5054 /* ss->ssl3.serverHelloPredictionDataValid is still false at this
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
5513 PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) ); 5533 PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) );
5514 PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss) ); 5534 PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss) );
5515 5535
5516 if (ss->ssl3.hs.ws != wait_cert_request && 5536 if (ss->ssl3.hs.ws != wait_cert_request &&
5517 ss->ssl3.hs.ws != wait_server_key) { 5537 ss->ssl3.hs.ws != wait_server_key) {
5518 desc = unexpected_message; 5538 desc = unexpected_message;
5519 errCode = SSL_ERROR_RX_UNEXPECTED_CERT_REQUEST; 5539 errCode = SSL_ERROR_RX_UNEXPECTED_CERT_REQUEST;
5520 goto alert_loser; 5540 goto alert_loser;
5521 } 5541 }
5522 5542
5523 /* clean up anything left from previous handshake. */
wtc 2010/12/08 03:04:14 You can replace these with PORT_Assert assertions
5524 if (ss->ssl3.clientCertChain != NULL) {
5525 CERT_DestroyCertificateList(ss->ssl3.clientCertChain);
5526 ss->ssl3.clientCertChain = NULL;
5527 }
5528 if (ss->ssl3.clientCertificate != NULL) {
5529 CERT_DestroyCertificate(ss->ssl3.clientCertificate);
5530 ss->ssl3.clientCertificate = NULL;
5531 }
5532 if (ss->ssl3.clientPrivateKey != NULL) {
5533 SECKEY_DestroyPrivateKey(ss->ssl3.clientPrivateKey);
5534 ss->ssl3.clientPrivateKey = NULL;
5535 }
5536 #ifdef NSS_PLATFORM_CLIENT_AUTH
5537 if (ss->ssl3.platformClientKey) {
5538 ssl_FreePlatformKey(ss->ssl3.platformClientKey);
5539 ss->ssl3.platformClientKey = (PlatformKey)NULL;
5540 }
5541 #endif /* NSS_PLATFORM_CLIENT_AUTH */
5542
5543 isTLS = (PRBool)(ss->ssl3.prSpec->version > SSL_LIBRARY_VERSION_3_0); 5543 isTLS = (PRBool)(ss->ssl3.prSpec->version > SSL_LIBRARY_VERSION_3_0);
5544 rv = ssl3_ConsumeHandshakeVariable(ss, &cert_types, 1, &b, &length); 5544 rv = ssl3_ConsumeHandshakeVariable(ss, &cert_types, 1, &b, &length);
5545 if (rv != SECSuccess) 5545 if (rv != SECSuccess)
5546 goto loser; /* malformed, alert has been sent */ 5546 goto loser; /* malformed, alert has been sent */
5547 5547
5548 arena = ca_list.arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); 5548 arena = ca_list.arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
5549 if (arena == NULL) 5549 if (arena == NULL)
5550 goto no_mem; 5550 goto no_mem;
5551 5551
5552 remaining = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length); 5552 remaining = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length);
(...skipping 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after
9888 9888
9889 ss->ssl3.initialized = PR_FALSE; 9889 ss->ssl3.initialized = PR_FALSE;
9890 9890
9891 if (ss->ssl3.nextProto.data) { 9891 if (ss->ssl3.nextProto.data) {
9892 PORT_Free(ss->ssl3.nextProto.data); 9892 PORT_Free(ss->ssl3.nextProto.data);
9893 ss->ssl3.nextProto.data = NULL; 9893 ss->ssl3.nextProto.data = NULL;
9894 } 9894 }
9895 } 9895 }
9896 9896
9897 /* End of ssl3con.c */ 9897 /* End of ssl3con.c */
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698