OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 end_time = base::TimeTicks::Now(); | 1453 end_time = base::TimeTicks::Now(); |
1454 UMA_HISTOGRAM_TIMES("Net.SSLVerificationMergedMsSaved", | 1454 UMA_HISTOGRAM_TIMES("Net.SSLVerificationMergedMsSaved", |
1455 end_time - ssl_host_info_->verification_start_time()); | 1455 end_time - ssl_host_info_->verification_start_time()); |
1456 server_cert_verify_result_ = &ssl_host_info_->cert_verify_result(); | 1456 server_cert_verify_result_ = &ssl_host_info_->cert_verify_result(); |
1457 return ssl_host_info_->WaitForCertVerification(&handshake_io_callback_); | 1457 return ssl_host_info_->WaitForCertVerification(&handshake_io_callback_); |
1458 } else { | 1458 } else { |
1459 UMA_HISTOGRAM_ENUMERATION("Net.SSLVerificationMerged", 0 /* false */, 2); | 1459 UMA_HISTOGRAM_ENUMERATION("Net.SSLVerificationMerged", 0 /* false */, 2); |
1460 } | 1460 } |
1461 | 1461 |
1462 int flags = 0; | 1462 int flags = 0; |
1463 if (ssl_config_.rev_checking_enabled) | 1463 if (ssl_config_.rev_checking_enabled) { |
1464 flags |= X509Certificate::VERIFY_REV_CHECKING_ENABLED; | 1464 const std::string& hostname = host_and_port_.host(); |
| 1465 // is_pinned is an approximation but is currently accurate. Even if more |
| 1466 // pinned sites are added, this errs on the site of caution. |
| 1467 bool is_pinned = hostname == "google.com" || |
| 1468 (hostname.size() > 11 && |
| 1469 hostname.rfind(".google.com") == hostname.size() - 11); |
| 1470 if (!is_pinned || |
| 1471 !SSLConfigService::rev_checking_disabled_for_pinned_sites()) { |
| 1472 flags |= X509Certificate::VERIFY_REV_CHECKING_ENABLED; |
| 1473 } |
| 1474 } |
1465 if (ssl_config_.verify_ev_cert) | 1475 if (ssl_config_.verify_ev_cert) |
1466 flags |= X509Certificate::VERIFY_EV_CERT; | 1476 flags |= X509Certificate::VERIFY_EV_CERT; |
1467 verifier_.reset(new SingleRequestCertVerifier(cert_verifier_)); | 1477 verifier_.reset(new SingleRequestCertVerifier(cert_verifier_)); |
1468 server_cert_verify_result_ = &local_server_cert_verify_result_; | 1478 server_cert_verify_result_ = &local_server_cert_verify_result_; |
1469 return verifier_->Verify(server_cert_, host_and_port_.host(), flags, | 1479 return verifier_->Verify(server_cert_, host_and_port_.host(), flags, |
1470 &local_server_cert_verify_result_, | 1480 &local_server_cert_verify_result_, |
1471 &handshake_io_callback_); | 1481 &handshake_io_callback_); |
1472 } | 1482 } |
1473 | 1483 |
1474 // Derived from AuthCertificateCallback() in | 1484 // Derived from AuthCertificateCallback() in |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2172 valid_thread_id_ = base::PlatformThread::CurrentId(); | 2182 valid_thread_id_ = base::PlatformThread::CurrentId(); |
2173 } | 2183 } |
2174 | 2184 |
2175 bool SSLClientSocketNSS::CalledOnValidThread() const { | 2185 bool SSLClientSocketNSS::CalledOnValidThread() const { |
2176 EnsureThreadIdAssigned(); | 2186 EnsureThreadIdAssigned(); |
2177 base::AutoLock auto_lock(lock_); | 2187 base::AutoLock auto_lock(lock_); |
2178 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 2188 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
2179 } | 2189 } |
2180 | 2190 |
2181 } // namespace net | 2191 } // namespace net |
OLD | NEW |