OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived | 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived |
6 // from AuthCertificateCallback() in | 6 // from AuthCertificateCallback() in |
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. | 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. |
8 | 8 |
9 /* ***** BEGIN LICENSE BLOCK ***** | 9 /* ***** BEGIN LICENSE BLOCK ***** |
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include <secerr.h> | 56 #include <secerr.h> |
57 #include <sechash.h> | 57 #include <sechash.h> |
58 #include <ssl.h> | 58 #include <ssl.h> |
59 #include <sslerr.h> | 59 #include <sslerr.h> |
60 #include <sslproto.h> | 60 #include <sslproto.h> |
61 | 61 |
62 #include <limits> | 62 #include <limits> |
63 | 63 |
64 #include "base/compiler_specific.h" | 64 #include "base/compiler_specific.h" |
65 #include "base/metrics/histogram.h" | 65 #include "base/metrics/histogram.h" |
66 #include "base/lazy_instance.h" | |
67 #include "base/logging.h" | 66 #include "base/logging.h" |
68 #include "base/nss_util.h" | 67 #include "base/nss_util.h" |
69 #include "base/string_number_conversions.h" | 68 #include "base/string_number_conversions.h" |
70 #include "base/string_util.h" | 69 #include "base/string_util.h" |
71 #include "base/stringprintf.h" | 70 #include "base/stringprintf.h" |
72 #include "base/thread_restrictions.h" | 71 #include "base/thread_restrictions.h" |
73 #include "base/values.h" | 72 #include "base/values.h" |
74 #include "net/base/address_list.h" | 73 #include "net/base/address_list.h" |
75 #include "net/base/cert_status_flags.h" | 74 #include "net/base/cert_status_flags.h" |
76 #include "net/base/cert_verifier.h" | 75 #include "net/base/cert_verifier.h" |
77 #include "net/base/connection_type_histograms.h" | 76 #include "net/base/connection_type_histograms.h" |
78 #include "net/base/dns_util.h" | 77 #include "net/base/dns_util.h" |
79 #include "net/base/dnsrr_resolver.h" | 78 #include "net/base/dnsrr_resolver.h" |
80 #include "net/base/dnssec_chain_verifier.h" | 79 #include "net/base/dnssec_chain_verifier.h" |
81 #include "net/base/io_buffer.h" | 80 #include "net/base/io_buffer.h" |
82 #include "net/base/net_errors.h" | 81 #include "net/base/net_errors.h" |
83 #include "net/base/net_log.h" | 82 #include "net/base/net_log.h" |
84 #include "net/base/ssl_cert_request_info.h" | 83 #include "net/base/ssl_cert_request_info.h" |
85 #include "net/base/ssl_connection_status_flags.h" | 84 #include "net/base/ssl_connection_status_flags.h" |
86 #include "net/base/ssl_info.h" | 85 #include "net/base/ssl_info.h" |
87 #include "net/base/sys_addrinfo.h" | 86 #include "net/base/sys_addrinfo.h" |
88 #include "net/ocsp/nss_ocsp.h" | 87 #include "net/ocsp/nss_ocsp.h" |
89 #include "net/socket/client_socket_handle.h" | 88 #include "net/socket/client_socket_handle.h" |
90 #include "net/socket/dns_cert_provenance_checker.h" | 89 #include "net/socket/dns_cert_provenance_checker.h" |
| 90 #include "net/socket/nss_ssl_util.h" |
91 #include "net/socket/ssl_error_params.h" | 91 #include "net/socket/ssl_error_params.h" |
92 #include "net/socket/ssl_host_info.h" | 92 #include "net/socket/ssl_host_info.h" |
93 | 93 |
94 #if defined(USE_SYSTEM_SSL) | 94 #if defined(USE_SYSTEM_SSL) |
95 #include <dlfcn.h> | 95 #include <dlfcn.h> |
96 #endif | 96 #endif |
97 #if defined(OS_WIN) | 97 #if defined(OS_WIN) |
98 #include <windows.h> | 98 #include <windows.h> |
99 #include <wincrypt.h> | 99 #include <wincrypt.h> |
100 #elif defined(OS_MACOSX) | 100 #elif defined(OS_MACOSX) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 VLOG(1) << (void *)this << " " << __FUNCTION__ << " jump to state " << s;\ | 132 VLOG(1) << (void *)this << " " << __FUNCTION__ << " jump to state " << s;\ |
133 next_handshake_state_ = s;\ | 133 next_handshake_state_ = s;\ |
134 } while (0) | 134 } while (0) |
135 #define LogData(s, len)\ | 135 #define LogData(s, len)\ |
136 VLOG(1) << (void *)this << " " << __FUNCTION__\ | 136 VLOG(1) << (void *)this << " " << __FUNCTION__\ |
137 << " data [" << std::string(s, len) << "]" | 137 << " data [" << std::string(s, len) << "]" |
138 #endif | 138 #endif |
139 | 139 |
140 namespace { | 140 namespace { |
141 | 141 |
142 class NSSSSLInitSingleton { | |
143 public: | |
144 NSSSSLInitSingleton() { | |
145 base::EnsureNSSInit(); | |
146 | |
147 NSS_SetDomesticPolicy(); | |
148 | |
149 #if defined(USE_SYSTEM_SSL) | |
150 // Use late binding to avoid scary but benign warning | |
151 // "Symbol `SSL_ImplementedCiphers' has different size in shared object, | |
152 // consider re-linking" | |
153 // TODO(wtc): Use the new SSL_GetImplementedCiphers and | |
154 // SSL_GetNumImplementedCiphers functions when we require NSS 3.12.6. | |
155 // See https://bugzilla.mozilla.org/show_bug.cgi?id=496993. | |
156 const PRUint16* pSSL_ImplementedCiphers = static_cast<const PRUint16*>( | |
157 dlsym(RTLD_DEFAULT, "SSL_ImplementedCiphers")); | |
158 if (pSSL_ImplementedCiphers == NULL) { | |
159 NOTREACHED() << "Can't get list of supported ciphers"; | |
160 return; | |
161 } | |
162 #else | |
163 #define pSSL_ImplementedCiphers SSL_ImplementedCiphers | |
164 #endif | |
165 | |
166 // Explicitly enable exactly those ciphers with keys of at least 80 bits | |
167 for (int i = 0; i < SSL_NumImplementedCiphers; i++) { | |
168 SSLCipherSuiteInfo info; | |
169 if (SSL_GetCipherSuiteInfo(pSSL_ImplementedCiphers[i], &info, | |
170 sizeof(info)) == SECSuccess) { | |
171 SSL_CipherPrefSetDefault(pSSL_ImplementedCiphers[i], | |
172 (info.effectiveKeyBits >= 80)); | |
173 } | |
174 } | |
175 | |
176 // Enable SSL. | |
177 SSL_OptionSetDefault(SSL_SECURITY, PR_TRUE); | |
178 | |
179 // All other SSL options are set per-session by SSLClientSocket. | |
180 } | |
181 | |
182 ~NSSSSLInitSingleton() { | |
183 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY. | |
184 SSL_ClearSessionCache(); | |
185 } | |
186 }; | |
187 | |
188 static base::LazyInstance<NSSSSLInitSingleton> g_nss_ssl_init_singleton( | |
189 base::LINKER_INITIALIZED); | |
190 | |
191 // Initialize the NSS SSL library if it isn't already initialized. This must | |
192 // be called before any other NSS SSL functions. This function is | |
193 // thread-safe, and the NSS SSL library will only ever be initialized once. | |
194 // The NSS SSL library will be properly shut down on program exit. | |
195 void EnsureNSSSSLInit() { | |
196 // Initializing SSL causes us to do blocking IO. | |
197 // Temporarily allow it until we fix | |
198 // http://code.google.com/p/chromium/issues/detail?id=59847 | |
199 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
200 | |
201 g_nss_ssl_init_singleton.Get(); | |
202 } | |
203 | |
204 // The default error mapping function. | |
205 // Maps an NSPR error code to a network error code. | |
206 int MapNSPRError(PRErrorCode err) { | |
207 // TODO(port): fill this out as we learn what's important | |
208 switch (err) { | |
209 case PR_WOULD_BLOCK_ERROR: | |
210 return ERR_IO_PENDING; | |
211 case PR_ADDRESS_NOT_SUPPORTED_ERROR: // For connect. | |
212 case PR_NO_ACCESS_RIGHTS_ERROR: | |
213 return ERR_ACCESS_DENIED; | |
214 case PR_IO_TIMEOUT_ERROR: | |
215 return ERR_TIMED_OUT; | |
216 case PR_CONNECT_RESET_ERROR: | |
217 return ERR_CONNECTION_RESET; | |
218 case PR_CONNECT_ABORTED_ERROR: | |
219 return ERR_CONNECTION_ABORTED; | |
220 case PR_CONNECT_REFUSED_ERROR: | |
221 return ERR_CONNECTION_REFUSED; | |
222 case PR_HOST_UNREACHABLE_ERROR: | |
223 case PR_NETWORK_UNREACHABLE_ERROR: | |
224 return ERR_ADDRESS_UNREACHABLE; | |
225 case PR_ADDRESS_NOT_AVAILABLE_ERROR: | |
226 return ERR_ADDRESS_INVALID; | |
227 case PR_INVALID_ARGUMENT_ERROR: | |
228 return ERR_INVALID_ARGUMENT; | |
229 case PR_END_OF_FILE_ERROR: | |
230 return ERR_CONNECTION_CLOSED; | |
231 case PR_NOT_IMPLEMENTED_ERROR: | |
232 return ERR_NOT_IMPLEMENTED; | |
233 | |
234 case SEC_ERROR_INVALID_ARGS: | |
235 return ERR_INVALID_ARGUMENT; | |
236 | |
237 case SSL_ERROR_SSL_DISABLED: | |
238 return ERR_NO_SSL_VERSIONS_ENABLED; | |
239 case SSL_ERROR_NO_CYPHER_OVERLAP: | |
240 case SSL_ERROR_UNSUPPORTED_VERSION: | |
241 return ERR_SSL_VERSION_OR_CIPHER_MISMATCH; | |
242 case SSL_ERROR_HANDSHAKE_FAILURE_ALERT: | |
243 case SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT: | |
244 case SSL_ERROR_ILLEGAL_PARAMETER_ALERT: | |
245 return ERR_SSL_PROTOCOL_ERROR; | |
246 case SSL_ERROR_DECOMPRESSION_FAILURE_ALERT: | |
247 return ERR_SSL_DECOMPRESSION_FAILURE_ALERT; | |
248 case SSL_ERROR_BAD_MAC_ALERT: | |
249 return ERR_SSL_BAD_RECORD_MAC_ALERT; | |
250 case SSL_ERROR_UNSAFE_NEGOTIATION: | |
251 return ERR_SSL_UNSAFE_NEGOTIATION; | |
252 case SSL_ERROR_WEAK_SERVER_KEY: | |
253 return ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY; | |
254 | |
255 default: { | |
256 if (IS_SSL_ERROR(err)) { | |
257 LOG(WARNING) << "Unknown SSL error " << err << | |
258 " mapped to net::ERR_SSL_PROTOCOL_ERROR"; | |
259 return ERR_SSL_PROTOCOL_ERROR; | |
260 } | |
261 LOG(WARNING) << "Unknown error " << err << | |
262 " mapped to net::ERR_FAILED"; | |
263 return ERR_FAILED; | |
264 } | |
265 } | |
266 } | |
267 | |
268 // Context-sensitive error mapping functions. | |
269 | |
270 int MapHandshakeError(PRErrorCode err) { | |
271 switch (err) { | |
272 // If the server closed on us, it is a protocol error. | |
273 // Some TLS-intolerant servers do this when we request TLS. | |
274 case PR_END_OF_FILE_ERROR: | |
275 // The handshake may fail because some signature (for example, the | |
276 // signature in the ServerKeyExchange message for an ephemeral | |
277 // Diffie-Hellman cipher suite) is invalid. | |
278 case SEC_ERROR_BAD_SIGNATURE: | |
279 return ERR_SSL_PROTOCOL_ERROR; | |
280 default: | |
281 return MapNSPRError(err); | |
282 } | |
283 } | |
284 | |
285 // Extra parameters to attach to the NetLog when we receive an error in response | |
286 // to a call to an NSS function. Used instead of SSLErrorParams with | |
287 // events of type TYPE_SSL_NSS_ERROR. Automatically looks up last PR error. | |
288 class SSLFailedNSSFunctionParams : public NetLog::EventParameters { | |
289 public: | |
290 // |param| is ignored if it has a length of 0. | |
291 SSLFailedNSSFunctionParams(const std::string& function, | |
292 const std::string& param) | |
293 : function_(function), param_(param), ssl_lib_error_(PR_GetError()) { | |
294 } | |
295 | |
296 virtual Value* ToValue() const { | |
297 DictionaryValue* dict = new DictionaryValue(); | |
298 dict->SetString("function", function_); | |
299 if (!param_.empty()) | |
300 dict->SetString("param", param_); | |
301 dict->SetInteger("ssl_lib_error", ssl_lib_error_); | |
302 return dict; | |
303 } | |
304 | |
305 private: | |
306 const std::string function_; | |
307 const std::string param_; | |
308 const PRErrorCode ssl_lib_error_; | |
309 }; | |
310 | |
311 void LogFailedNSSFunction(const BoundNetLog& net_log, | |
312 const char* function, | |
313 const char* param) { | |
314 net_log.AddEvent( | |
315 NetLog::TYPE_SSL_NSS_ERROR, | |
316 make_scoped_refptr(new SSLFailedNSSFunctionParams(function, param))); | |
317 } | |
318 | |
319 #if defined(OS_WIN) | 142 #if defined(OS_WIN) |
320 | 143 |
321 // This callback is intended to be used with CertFindChainInStore. In addition | 144 // This callback is intended to be used with CertFindChainInStore. In addition |
322 // to filtering by extended/enhanced key usage, we do not show expired | 145 // to filtering by extended/enhanced key usage, we do not show expired |
323 // certificates and require digital signature usage in the key usage | 146 // certificates and require digital signature usage in the key usage |
324 // extension. | 147 // extension. |
325 // | 148 // |
326 // This matches our behavior on Mac OS X and that of NSS. It also matches the | 149 // This matches our behavior on Mac OS X and that of NSS. It also matches the |
327 // default behavior of IE8. See http://support.microsoft.com/kb/890326 and | 150 // default behavior of IE8. See http://support.microsoft.com/kb/890326 and |
328 // http://blogs.msdn.com/b/askie/archive/2009/06/09/my-expired-client-certificat
es-no-longer-display-when-connecting-to-my-web-server-using-ie8.aspx | 151 // http://blogs.msdn.com/b/askie/archive/2009/06/09/my-expired-client-certificat
es-no-longer-display-when-connecting-to-my-web-server-using-ie8.aspx |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 // Support RFC 5077 | 550 // Support RFC 5077 |
728 rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_SESSION_TICKETS, PR_TRUE); | 551 rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_SESSION_TICKETS, PR_TRUE); |
729 if (rv != SECSuccess) { | 552 if (rv != SECSuccess) { |
730 LogFailedNSSFunction( | 553 LogFailedNSSFunction( |
731 net_log_, "SSL_OptionSet", "SSL_ENABLE_SESSION_TICKETS"); | 554 net_log_, "SSL_OptionSet", "SSL_ENABLE_SESSION_TICKETS"); |
732 } | 555 } |
733 #else | 556 #else |
734 #error "You need to install NSS-3.12 or later to build chromium" | 557 #error "You need to install NSS-3.12 or later to build chromium" |
735 #endif | 558 #endif |
736 | 559 |
| 560 rv = SSL_OptionSet(nss_fd_, SSL_NO_CACHE, |
| 561 ssl_config_.session_cache_disabled); |
| 562 if (rv != SECSuccess) { |
| 563 LogFailedNSSFunction(net_log_, "SSL_OptionSet", "SSL_NO_CACHE"); |
| 564 return ERR_UNEXPECTED; |
| 565 } |
| 566 |
737 #ifdef SSL_ENABLE_DEFLATE | 567 #ifdef SSL_ENABLE_DEFLATE |
738 // Some web servers have been found to break if TLS is used *or* if DEFLATE | 568 // Some web servers have been found to break if TLS is used *or* if DEFLATE |
739 // is advertised. Thus, if TLS is disabled (probably because we are doing | 569 // is advertised. Thus, if TLS is disabled (probably because we are doing |
740 // SSLv3 fallback), we disable DEFLATE also. | 570 // SSLv3 fallback), we disable DEFLATE also. |
741 // See http://crbug.com/31628 | 571 // See http://crbug.com/31628 |
742 rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_DEFLATE, ssl_config_.tls1_enabled); | 572 rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_DEFLATE, ssl_config_.tls1_enabled); |
743 if (rv != SECSuccess) | 573 if (rv != SECSuccess) |
744 LogFailedNSSFunction(net_log_, "SSL_OptionSet", "SSL_ENABLE_DEFLATE"); | 574 LogFailedNSSFunction(net_log_, "SSL_OptionSet", "SSL_ENABLE_DEFLATE"); |
745 #endif | 575 #endif |
746 | 576 |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 LeaveFunction(""); | 1184 LeaveFunction(""); |
1355 return; | 1185 return; |
1356 } | 1186 } |
1357 | 1187 |
1358 int rv = DoReadLoop(result); | 1188 int rv = DoReadLoop(result); |
1359 if (rv != ERR_IO_PENDING) | 1189 if (rv != ERR_IO_PENDING) |
1360 DoReadCallback(rv); | 1190 DoReadCallback(rv); |
1361 LeaveFunction(""); | 1191 LeaveFunction(""); |
1362 } | 1192 } |
1363 | 1193 |
1364 // Map a Chromium net error code to an NSS error code. | |
1365 // See _MD_unix_map_default_error in the NSS source | |
1366 // tree for inspiration. | |
1367 static PRErrorCode MapErrorToNSS(int result) { | |
1368 if (result >=0) | |
1369 return result; | |
1370 | |
1371 switch (result) { | |
1372 case ERR_IO_PENDING: | |
1373 return PR_WOULD_BLOCK_ERROR; | |
1374 case ERR_ACCESS_DENIED: | |
1375 case ERR_NETWORK_ACCESS_DENIED: | |
1376 // For connect, this could be mapped to PR_ADDRESS_NOT_SUPPORTED_ERROR. | |
1377 return PR_NO_ACCESS_RIGHTS_ERROR; | |
1378 case ERR_NOT_IMPLEMENTED: | |
1379 return PR_NOT_IMPLEMENTED_ERROR; | |
1380 case ERR_INTERNET_DISCONNECTED: // Equivalent to ENETDOWN. | |
1381 return PR_NETWORK_UNREACHABLE_ERROR; // Best approximation. | |
1382 case ERR_CONNECTION_TIMED_OUT: | |
1383 case ERR_TIMED_OUT: | |
1384 return PR_IO_TIMEOUT_ERROR; | |
1385 case ERR_CONNECTION_RESET: | |
1386 return PR_CONNECT_RESET_ERROR; | |
1387 case ERR_CONNECTION_ABORTED: | |
1388 return PR_CONNECT_ABORTED_ERROR; | |
1389 case ERR_CONNECTION_REFUSED: | |
1390 return PR_CONNECT_REFUSED_ERROR; | |
1391 case ERR_ADDRESS_UNREACHABLE: | |
1392 return PR_HOST_UNREACHABLE_ERROR; // Also PR_NETWORK_UNREACHABLE_ERROR. | |
1393 case ERR_ADDRESS_INVALID: | |
1394 return PR_ADDRESS_NOT_AVAILABLE_ERROR; | |
1395 case ERR_NAME_NOT_RESOLVED: | |
1396 return PR_DIRECTORY_LOOKUP_ERROR; | |
1397 default: | |
1398 LOG(WARNING) << "MapErrorToNSS " << result | |
1399 << " mapped to PR_UNKNOWN_ERROR"; | |
1400 return PR_UNKNOWN_ERROR; | |
1401 } | |
1402 } | |
1403 | |
1404 // Do network I/O between the given buffer and the given socket. | 1194 // Do network I/O between the given buffer and the given socket. |
1405 // Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING) | 1195 // Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING) |
1406 bool SSLClientSocketNSS::DoTransportIO() { | 1196 bool SSLClientSocketNSS::DoTransportIO() { |
1407 EnterFunction(""); | 1197 EnterFunction(""); |
1408 bool network_moved = false; | 1198 bool network_moved = false; |
1409 if (nss_bufs_ != NULL) { | 1199 if (nss_bufs_ != NULL) { |
1410 int nsent = BufferSend(); | 1200 int nsent = BufferSend(); |
1411 int nreceived = BufferRecv(); | 1201 int nreceived = BufferRecv(); |
1412 network_moved = (nsent > 0 || nreceived >= 0); | 1202 network_moved = (nsent > 0 || nreceived >= 0); |
1413 } | 1203 } |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 LogData(user_read_buf_->data(), rv); | 2360 LogData(user_read_buf_->data(), rv); |
2571 LeaveFunction(""); | 2361 LeaveFunction(""); |
2572 return rv; | 2362 return rv; |
2573 } | 2363 } |
2574 PRErrorCode prerr = PR_GetError(); | 2364 PRErrorCode prerr = PR_GetError(); |
2575 if (prerr == PR_WOULD_BLOCK_ERROR) { | 2365 if (prerr == PR_WOULD_BLOCK_ERROR) { |
2576 LeaveFunction(""); | 2366 LeaveFunction(""); |
2577 return ERR_IO_PENDING; | 2367 return ERR_IO_PENDING; |
2578 } | 2368 } |
2579 LeaveFunction(""); | 2369 LeaveFunction(""); |
2580 rv = MapNSPRError(prerr); | 2370 rv = MapNSSError(prerr); |
2581 net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, | 2371 net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, |
2582 make_scoped_refptr(new SSLErrorParams(rv, prerr))); | 2372 make_scoped_refptr(new SSLErrorParams(rv, prerr))); |
2583 return rv; | 2373 return rv; |
2584 } | 2374 } |
2585 | 2375 |
2586 int SSLClientSocketNSS::DoPayloadWrite() { | 2376 int SSLClientSocketNSS::DoPayloadWrite() { |
2587 EnterFunction(user_write_buf_len_); | 2377 EnterFunction(user_write_buf_len_); |
2588 DCHECK(user_write_buf_); | 2378 DCHECK(user_write_buf_); |
2589 int rv = PR_Write(nss_fd_, user_write_buf_->data(), user_write_buf_len_); | 2379 int rv = PR_Write(nss_fd_, user_write_buf_->data(), user_write_buf_len_); |
2590 if (rv >= 0) { | 2380 if (rv >= 0) { |
2591 LogData(user_write_buf_->data(), rv); | 2381 LogData(user_write_buf_->data(), rv); |
2592 LeaveFunction(""); | 2382 LeaveFunction(""); |
2593 return rv; | 2383 return rv; |
2594 } | 2384 } |
2595 PRErrorCode prerr = PR_GetError(); | 2385 PRErrorCode prerr = PR_GetError(); |
2596 if (prerr == PR_WOULD_BLOCK_ERROR) { | 2386 if (prerr == PR_WOULD_BLOCK_ERROR) { |
2597 LeaveFunction(""); | 2387 LeaveFunction(""); |
2598 return ERR_IO_PENDING; | 2388 return ERR_IO_PENDING; |
2599 } | 2389 } |
2600 LeaveFunction(""); | 2390 LeaveFunction(""); |
2601 rv = MapNSPRError(prerr); | 2391 rv = MapNSSError(prerr); |
2602 net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, | 2392 net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, |
2603 make_scoped_refptr(new SSLErrorParams(rv, prerr))); | 2393 make_scoped_refptr(new SSLErrorParams(rv, prerr))); |
2604 return rv; | 2394 return rv; |
2605 } | 2395 } |
2606 | 2396 |
2607 void SSLClientSocketNSS::LogConnectionTypeMetrics() const { | 2397 void SSLClientSocketNSS::LogConnectionTypeMetrics() const { |
2608 UpdateConnectionTypeHistograms(CONNECTION_SSL); | 2398 UpdateConnectionTypeHistograms(CONNECTION_SSL); |
2609 if (server_cert_verify_result_->has_md5) | 2399 if (server_cert_verify_result_->has_md5) |
2610 UpdateConnectionTypeHistograms(CONNECTION_SSL_MD5); | 2400 UpdateConnectionTypeHistograms(CONNECTION_SSL_MD5); |
2611 if (server_cert_verify_result_->has_md2) | 2401 if (server_cert_verify_result_->has_md2) |
(...skipping 18 matching lines...) Expand all Loading... |
2630 case SSL_CONNECTION_VERSION_TLS1_1: | 2420 case SSL_CONNECTION_VERSION_TLS1_1: |
2631 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_1); | 2421 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_1); |
2632 break; | 2422 break; |
2633 case SSL_CONNECTION_VERSION_TLS1_2: | 2423 case SSL_CONNECTION_VERSION_TLS1_2: |
2634 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_2); | 2424 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_2); |
2635 break; | 2425 break; |
2636 }; | 2426 }; |
2637 } | 2427 } |
2638 | 2428 |
2639 } // namespace net | 2429 } // namespace net |
OLD | NEW |