OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 // set on Windows XP without error. There is some overhead from the server | 124 // set on Windows XP without error. There is some overhead from the server |
125 // sending the OCSP response if it supports the extension, for the subset of | 125 // sending the OCSP response if it supports the extension, for the subset of |
126 // XP clients who will request it but be unable to use it, but this is an | 126 // XP clients who will request it but be unable to use it, but this is an |
127 // acceptable trade-off for simplicity of implementation. | 127 // acceptable trade-off for simplicity of implementation. |
128 static bool IsOCSPStaplingSupported() { | 128 static bool IsOCSPStaplingSupported() { |
129 return true; | 129 return true; |
130 } | 130 } |
131 #elif defined(USE_NSS) | 131 #elif defined(USE_NSS) |
132 typedef SECStatus | 132 typedef SECStatus |
133 (*CacheOCSPResponseFromSideChannelFunction)( | 133 (*CacheOCSPResponseFromSideChannelFunction)( |
134 CERTCertDBHandle* handle, CERTCertificate* cert, PRTime time, | 134 CERTCertDBHandle *handle, CERTCertificate *cert, PRTime time, |
135 SECItem* encodedResponse, void* pwArg); | 135 SECItem *encodedResponse, void *pwArg); |
136 | 136 |
137 // On Linux, we dynamically link against the system version of libnss3.so. In | 137 // On Linux, we dynamically link against the system version of libnss3.so. In |
138 // order to continue working on systems without up-to-date versions of NSS we | 138 // order to continue working on systems without up-to-date versions of NSS we |
139 // lookup CERT_CacheOCSPResponseFromSideChannel with dlsym. | 139 // lookup CERT_CacheOCSPResponseFromSideChannel with dlsym. |
140 | 140 |
141 // RuntimeLibNSSFunctionPointers is a singleton which caches the results of any | 141 // RuntimeLibNSSFunctionPointers is a singleton which caches the results of any |
142 // runtime symbol resolution that we need. | 142 // runtime symbol resolution that we need. |
143 class RuntimeLibNSSFunctionPointers { | 143 class RuntimeLibNSSFunctionPointers { |
144 public: | 144 public: |
145 CacheOCSPResponseFromSideChannelFunction | 145 CacheOCSPResponseFromSideChannelFunction |
(...skipping 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2756 if (core_->state().server_cert_chain.empty() || | 2756 if (core_->state().server_cert_chain.empty() || |
2757 !core_->state().server_cert_chain[0]) { | 2757 !core_->state().server_cert_chain[0]) { |
2758 return false; | 2758 return false; |
2759 } | 2759 } |
2760 | 2760 |
2761 ssl_info->cert_status = server_cert_verify_result_.cert_status; | 2761 ssl_info->cert_status = server_cert_verify_result_.cert_status; |
2762 ssl_info->cert = server_cert_verify_result_.verified_cert; | 2762 ssl_info->cert = server_cert_verify_result_.verified_cert; |
2763 ssl_info->connection_status = | 2763 ssl_info->connection_status = |
2764 core_->state().ssl_connection_status; | 2764 core_->state().ssl_connection_status; |
2765 ssl_info->public_key_hashes = server_cert_verify_result_.public_key_hashes; | 2765 ssl_info->public_key_hashes = server_cert_verify_result_.public_key_hashes; |
2766 // TODO(palmer) TODO(agl): Do side pins need to be in both SHA1 and SHA256 | 2766 for (std::vector<SHA1Fingerprint>::const_iterator |
2767 // forms? If consumers of side pins only care about SHA1, it is OK to put | 2767 i = side_pinned_public_keys_.begin(); |
2768 // them only in the HASH_VALUE_SHA1 vector. | 2768 i != side_pinned_public_keys_.end(); i++) { |
2769 HashValueVector& sha1_hashes = | 2769 ssl_info->public_key_hashes.push_back(*i); |
2770 ssl_info->public_key_hashes[HASH_VALUE_SHA1]; | |
2771 for (HashValueVector::const_iterator i = side_pinned_public_keys_.begin(); | |
2772 i != side_pinned_public_keys_.end(); ++i) { | |
2773 sha1_hashes.push_back(*i); | |
2774 } | 2770 } |
2775 ssl_info->is_issued_by_known_root = | 2771 ssl_info->is_issued_by_known_root = |
2776 server_cert_verify_result_.is_issued_by_known_root; | 2772 server_cert_verify_result_.is_issued_by_known_root; |
2777 ssl_info->client_cert_sent = | 2773 ssl_info->client_cert_sent = |
2778 ssl_config_.send_client_cert && ssl_config_.client_cert; | 2774 ssl_config_.send_client_cert && ssl_config_.client_cert; |
2779 ssl_info->channel_id_sent = WasChannelIDSent(); | 2775 ssl_info->channel_id_sent = WasChannelIDSent(); |
2780 | 2776 |
2781 PRUint16 cipher_suite = SSLConnectionStatusToCipherSuite( | 2777 PRUint16 cipher_suite = SSLConnectionStatusToCipherSuite( |
2782 core_->state().ssl_connection_status); | 2778 core_->state().ssl_connection_status); |
2783 SSLCipherSuiteInfo cipher_info; | 2779 SSLCipherSuiteInfo cipher_info; |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3448 bool sni_available = | 3444 bool sni_available = |
3449 ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 || | 3445 ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 || |
3450 ssl_config_.version_fallback; | 3446 ssl_config_.version_fallback; |
3451 const std::string& host = host_and_port_.host(); | 3447 const std::string& host = host_and_port_.host(); |
3452 | 3448 |
3453 TransportSecurityState::DomainState domain_state; | 3449 TransportSecurityState::DomainState domain_state; |
3454 if (transport_security_state_->GetDomainState(host, sni_available, | 3450 if (transport_security_state_->GetDomainState(host, sni_available, |
3455 &domain_state) && | 3451 &domain_state) && |
3456 domain_state.HasPins()) { | 3452 domain_state.HasPins()) { |
3457 if (!domain_state.IsChainOfPublicKeysPermitted( | 3453 if (!domain_state.IsChainOfPublicKeysPermitted( |
3458 server_cert_verify_result_.public_key_hashes)) { | 3454 server_cert_verify_result_.public_key_hashes)) { |
wtc
2012/08/01 22:06:33
server_cert_verify_result_.public_key_hashes is a
| |
3459 const base::Time build_time = base::GetBuildTime(); | 3455 const base::Time build_time = base::GetBuildTime(); |
3460 // Pins are not enforced if the build is sufficiently old. Chrome | 3456 // Pins are not enforced if the build is sufficiently old. Chrome |
3461 // users should get updates every six weeks or so, but it's possible | 3457 // users should get updates every six weeks or so, but it's possible |
3462 // that some users will stop getting updates for some reason. We | 3458 // that some users will stop getting updates for some reason. We |
3463 // don't want those users building up as a pool of people with bad | 3459 // don't want those users building up as a pool of people with bad |
3464 // pins. | 3460 // pins. |
3465 if ((base::Time::Now() - build_time).InDays() < 70 /* 10 weeks */) { | 3461 if ((base::Time::Now() - build_time).InDays() < 70 /* 10 weeks */) { |
3466 result = ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; | 3462 result = ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; |
3467 UMA_HISTOGRAM_BOOLEAN("Net.PublicKeyPinSuccess", false); | 3463 UMA_HISTOGRAM_BOOLEAN("Net.PublicKeyPinSuccess", false); |
3468 TransportSecurityState::ReportUMAOnPinFailure(host); | 3464 TransportSecurityState::ReportUMAOnPinFailure(host); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3523 EnsureThreadIdAssigned(); | 3519 EnsureThreadIdAssigned(); |
3524 base::AutoLock auto_lock(lock_); | 3520 base::AutoLock auto_lock(lock_); |
3525 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 3521 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
3526 } | 3522 } |
3527 | 3523 |
3528 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { | 3524 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { |
3529 return server_bound_cert_service_; | 3525 return server_bound_cert_service_; |
3530 } | 3526 } |
3531 | 3527 |
3532 } // namespace net | 3528 } // namespace net |
OLD | NEW |