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 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 GotoState(STATE_VERIFY_CERT_COMPLETE); | 1646 GotoState(STATE_VERIFY_CERT_COMPLETE); |
1647 | 1647 |
1648 // If the certificate is expected to be bad we can use the | 1648 // If the certificate is expected to be bad we can use the |
1649 // expectation as the cert status. Don't use |server_cert_| here | 1649 // expectation as the cert status. Don't use |server_cert_| here |
1650 // because it can be set to NULL in case we failed to create | 1650 // because it can be set to NULL in case we failed to create |
1651 // X509Certificate in UpdateServerCert(). This may happen when this | 1651 // X509Certificate in UpdateServerCert(). This may happen when this |
1652 // code is used inside sandbox. | 1652 // code is used inside sandbox. |
1653 base::StringPiece der_cert( | 1653 base::StringPiece der_cert( |
1654 reinterpret_cast<char*>(server_cert_nss_->derCert.data), | 1654 reinterpret_cast<char*>(server_cert_nss_->derCert.data), |
1655 server_cert_nss_->derCert.len); | 1655 server_cert_nss_->derCert.len); |
1656 CertStatus cert_status; | 1656 int cert_status; |
1657 if (ssl_config_.IsAllowedBadCert(der_cert, &cert_status)) { | 1657 if (ssl_config_.IsAllowedBadCert(der_cert, &cert_status)) { |
1658 DCHECK(start_cert_verification_time_.is_null()); | 1658 DCHECK(start_cert_verification_time_.is_null()); |
1659 VLOG(1) << "Received an expected bad cert with status: " << cert_status; | 1659 VLOG(1) << "Received an expected bad cert with status: " << cert_status; |
1660 server_cert_verify_result_ = &local_server_cert_verify_result_; | 1660 server_cert_verify_result_ = &local_server_cert_verify_result_; |
1661 local_server_cert_verify_result_.Reset(); | 1661 local_server_cert_verify_result_.Reset(); |
1662 local_server_cert_verify_result_.cert_status = cert_status; | 1662 local_server_cert_verify_result_.cert_status = cert_status; |
1663 local_server_cert_verify_result_.verified_cert = server_cert_; | 1663 local_server_cert_verify_result_.verified_cert = server_cert_; |
1664 return OK; | 1664 return OK; |
1665 } | 1665 } |
1666 | 1666 |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 valid_thread_id_ = base::PlatformThread::CurrentId(); | 2498 valid_thread_id_ = base::PlatformThread::CurrentId(); |
2499 } | 2499 } |
2500 | 2500 |
2501 bool SSLClientSocketNSS::CalledOnValidThread() const { | 2501 bool SSLClientSocketNSS::CalledOnValidThread() const { |
2502 EnsureThreadIdAssigned(); | 2502 EnsureThreadIdAssigned(); |
2503 base::AutoLock auto_lock(lock_); | 2503 base::AutoLock auto_lock(lock_); |
2504 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 2504 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
2505 } | 2505 } |
2506 | 2506 |
2507 } // namespace net | 2507 } // namespace net |
OLD | NEW |