| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 #include "net/base/address_list.h" | 87 #include "net/base/address_list.h" |
| 88 #include "net/base/connection_type_histograms.h" | 88 #include "net/base/connection_type_histograms.h" |
| 89 #include "net/base/dns_util.h" | 89 #include "net/base/dns_util.h" |
| 90 #include "net/base/io_buffer.h" | 90 #include "net/base/io_buffer.h" |
| 91 #include "net/base/net_errors.h" | 91 #include "net/base/net_errors.h" |
| 92 #include "net/base/net_log.h" | 92 #include "net/base/net_log.h" |
| 93 #include "net/cert/asn1_util.h" | 93 #include "net/cert/asn1_util.h" |
| 94 #include "net/cert/cert_status_flags.h" | 94 #include "net/cert/cert_status_flags.h" |
| 95 #include "net/cert/cert_verifier.h" | 95 #include "net/cert/cert_verifier.h" |
| 96 #include "net/cert/ct_verifier.h" | 96 #include "net/cert/ct_verifier.h" |
| 97 #include "net/cert/ct_verify_result.h" |
| 97 #include "net/cert/scoped_nss_types.h" | 98 #include "net/cert/scoped_nss_types.h" |
| 99 #include "net/cert/sct_status_flags.h" |
| 98 #include "net/cert/single_request_cert_verifier.h" | 100 #include "net/cert/single_request_cert_verifier.h" |
| 99 #include "net/cert/x509_certificate_net_log_param.h" | 101 #include "net/cert/x509_certificate_net_log_param.h" |
| 100 #include "net/cert/x509_util.h" | 102 #include "net/cert/x509_util.h" |
| 101 #include "net/http/transport_security_state.h" | 103 #include "net/http/transport_security_state.h" |
| 102 #include "net/ocsp/nss_ocsp.h" | 104 #include "net/ocsp/nss_ocsp.h" |
| 103 #include "net/socket/client_socket_handle.h" | 105 #include "net/socket/client_socket_handle.h" |
| 104 #include "net/socket/nss_ssl_util.h" | 106 #include "net/socket/nss_ssl_util.h" |
| 105 #include "net/socket/ssl_error_params.h" | 107 #include "net/socket/ssl_error_params.h" |
| 106 #include "net/ssl/ssl_cert_request_info.h" | 108 #include "net/ssl/ssl_cert_request_info.h" |
| 107 #include "net/ssl/ssl_connection_status_flags.h" | 109 #include "net/ssl/ssl_connection_status_flags.h" |
| (...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2786 // static | 2788 // static |
| 2787 void SSLClientSocket::ClearSessionCache() { | 2789 void SSLClientSocket::ClearSessionCache() { |
| 2788 // SSL_ClearSessionCache can't be called before NSS is initialized. Don't | 2790 // SSL_ClearSessionCache can't be called before NSS is initialized. Don't |
| 2789 // bother initializing NSS just to clear an empty SSL session cache. | 2791 // bother initializing NSS just to clear an empty SSL session cache. |
| 2790 if (!NSS_IsInitialized()) | 2792 if (!NSS_IsInitialized()) |
| 2791 return; | 2793 return; |
| 2792 | 2794 |
| 2793 SSL_ClearSessionCache(); | 2795 SSL_ClearSessionCache(); |
| 2794 } | 2796 } |
| 2795 | 2797 |
| 2798 void SSLClientSocketNSS::AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const { |
| 2799 for (ct::SCTList::const_iterator iter = |
| 2800 ct_verify_result_.verified_scts.begin(); |
| 2801 iter != ct_verify_result_.verified_scts.end(); ++iter) { |
| 2802 ssl_info->signed_certificate_timestamps.push_back( |
| 2803 net::SignedCertificateTimestampAndStatus(*iter, net::SCT_STATUS_OK)); |
| 2804 } |
| 2805 for (ct::SCTList::const_iterator iter = |
| 2806 ct_verify_result_.unverified_scts.begin(); |
| 2807 iter != ct_verify_result_.unverified_scts.end(); ++iter) { |
| 2808 ssl_info->signed_certificate_timestamps.push_back( |
| 2809 net::SignedCertificateTimestampAndStatus(*iter, |
| 2810 net::SCT_STATUS_INVALID)); |
| 2811 } |
| 2812 for (ct::SCTList::const_iterator iter = |
| 2813 ct_verify_result_.unknown_logs_scts.begin(); |
| 2814 iter != ct_verify_result_.unknown_logs_scts.end(); ++iter) { |
| 2815 ssl_info->signed_certificate_timestamps.push_back( |
| 2816 net::SignedCertificateTimestampAndStatus(*iter, |
| 2817 net::SCT_STATUS_LOG_UNKNOWN)); |
| 2818 } |
| 2819 } |
| 2820 |
| 2796 bool SSLClientSocketNSS::GetSSLInfo(SSLInfo* ssl_info) { | 2821 bool SSLClientSocketNSS::GetSSLInfo(SSLInfo* ssl_info) { |
| 2797 EnterFunction(""); | 2822 EnterFunction(""); |
| 2798 ssl_info->Reset(); | 2823 ssl_info->Reset(); |
| 2799 if (core_->state().server_cert_chain.empty() || | 2824 if (core_->state().server_cert_chain.empty() || |
| 2800 !core_->state().server_cert_chain[0]) { | 2825 !core_->state().server_cert_chain[0]) { |
| 2801 return false; | 2826 return false; |
| 2802 } | 2827 } |
| 2803 | 2828 |
| 2804 ssl_info->cert_status = server_cert_verify_result_.cert_status; | 2829 ssl_info->cert_status = server_cert_verify_result_.cert_status; |
| 2805 ssl_info->cert = server_cert_verify_result_.verified_cert; | 2830 ssl_info->cert = server_cert_verify_result_.verified_cert; |
| 2831 |
| 2832 AddSCTInfoToSSLInfo(ssl_info); |
| 2833 |
| 2806 ssl_info->connection_status = | 2834 ssl_info->connection_status = |
| 2807 core_->state().ssl_connection_status; | 2835 core_->state().ssl_connection_status; |
| 2808 ssl_info->public_key_hashes = server_cert_verify_result_.public_key_hashes; | 2836 ssl_info->public_key_hashes = server_cert_verify_result_.public_key_hashes; |
| 2809 for (HashValueVector::const_iterator i = side_pinned_public_keys_.begin(); | 2837 for (HashValueVector::const_iterator i = side_pinned_public_keys_.begin(); |
| 2810 i != side_pinned_public_keys_.end(); ++i) { | 2838 i != side_pinned_public_keys_.end(); ++i) { |
| 2811 ssl_info->public_key_hashes.push_back(*i); | 2839 ssl_info->public_key_hashes.push_back(*i); |
| 2812 } | 2840 } |
| 2813 ssl_info->is_issued_by_known_root = | 2841 ssl_info->is_issued_by_known_root = |
| 2814 server_cert_verify_result_.is_issued_by_known_root; | 2842 server_cert_verify_result_.is_issued_by_known_root; |
| 2815 ssl_info->client_cert_sent = | 2843 ssl_info->client_cert_sent = |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3567 EnsureThreadIdAssigned(); | 3595 EnsureThreadIdAssigned(); |
| 3568 base::AutoLock auto_lock(lock_); | 3596 base::AutoLock auto_lock(lock_); |
| 3569 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 3597 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
| 3570 } | 3598 } |
| 3571 | 3599 |
| 3572 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { | 3600 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { |
| 3573 return server_bound_cert_service_; | 3601 return server_bound_cert_service_; |
| 3574 } | 3602 } |
| 3575 | 3603 |
| 3576 } // namespace net | 3604 } // namespace net |
| OLD | NEW |