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 for (std::vector<SHA1Fingerprint>::const_iterator | 2766 // TODO(palmer) TODO(agl): Do side pins need to be in both SHA1 and SHA256 |
2767 i = side_pinned_public_keys_.begin(); | 2767 // forms? If consumers of side pins only care about SHA1, it is OK to put |
2768 i != side_pinned_public_keys_.end(); i++) { | 2768 // them only in the HASH_VALUE_SHA1 vector. |
2769 ssl_info->public_key_hashes.push_back(*i); | 2769 HashValueVector& sha1_hashes = |
| 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); |
2770 } | 2774 } |
2771 ssl_info->is_issued_by_known_root = | 2775 ssl_info->is_issued_by_known_root = |
2772 server_cert_verify_result_.is_issued_by_known_root; | 2776 server_cert_verify_result_.is_issued_by_known_root; |
2773 ssl_info->client_cert_sent = | 2777 ssl_info->client_cert_sent = |
2774 ssl_config_.send_client_cert && ssl_config_.client_cert; | 2778 ssl_config_.send_client_cert && ssl_config_.client_cert; |
2775 ssl_info->channel_id_sent = WasChannelIDSent(); | 2779 ssl_info->channel_id_sent = WasChannelIDSent(); |
2776 | 2780 |
2777 PRUint16 cipher_suite = SSLConnectionStatusToCipherSuite( | 2781 PRUint16 cipher_suite = SSLConnectionStatusToCipherSuite( |
2778 core_->state().ssl_connection_status); | 2782 core_->state().ssl_connection_status); |
2779 SSLCipherSuiteInfo cipher_info; | 2783 SSLCipherSuiteInfo cipher_info; |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3508 EnsureThreadIdAssigned(); | 3512 EnsureThreadIdAssigned(); |
3509 base::AutoLock auto_lock(lock_); | 3513 base::AutoLock auto_lock(lock_); |
3510 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 3514 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
3511 } | 3515 } |
3512 | 3516 |
3513 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { | 3517 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { |
3514 return server_bound_cert_service_; | 3518 return server_bound_cert_service_; |
3515 } | 3519 } |
3516 | 3520 |
3517 } // namespace net | 3521 } // namespace net |
OLD | NEW |