| 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 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 PR_FALSE); | 1623 PR_FALSE); |
| 1624 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, | 1624 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, |
| 1625 make_scoped_refptr(new NetLogIntegerParameter("cert_count", | 1625 make_scoped_refptr(new NetLogIntegerParameter("cert_count", |
| 1626 cert_chain->len))); | 1626 cert_chain->len))); |
| 1627 SECStatus rv; | 1627 SECStatus rv; |
| 1628 rv = SSL_RestartHandshakeAfterCertReq(nss_fd_, cert, key, cert_chain); | 1628 rv = SSL_RestartHandshakeAfterCertReq(nss_fd_, cert, key, cert_chain); |
| 1629 if (rv != SECSuccess) | 1629 if (rv != SECSuccess) |
| 1630 return MapNSSError(PORT_GetError()); | 1630 return MapNSSError(PORT_GetError()); |
| 1631 | 1631 |
| 1632 GotoState(STATE_HANDSHAKE); | 1632 GotoState(STATE_HANDSHAKE); |
| 1633 set_was_origin_bound_cert_sent(true); |
| 1633 return OK; | 1634 return OK; |
| 1634 } | 1635 } |
| 1635 | 1636 |
| 1636 int SSLClientSocketNSS::DoVerifyDNSSEC(int result) { | 1637 int SSLClientSocketNSS::DoVerifyDNSSEC(int result) { |
| 1637 if (ssl_config_.dns_cert_provenance_checking_enabled && | 1638 if (ssl_config_.dns_cert_provenance_checking_enabled && |
| 1638 dns_cert_checker_) { | 1639 dns_cert_checker_) { |
| 1639 PeerCertificateChain certs(nss_fd_); | 1640 PeerCertificateChain certs(nss_fd_); |
| 1640 dns_cert_checker_->DoAsyncVerification( | 1641 dns_cert_checker_->DoAsyncVerification( |
| 1641 host_and_port_.host(), certs.AsStringPieceVector()); | 1642 host_and_port_.host(), certs.AsStringPieceVector()); |
| 1642 } | 1643 } |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2178 return SECWouldBlock; | 2179 return SECWouldBlock; |
| 2179 } | 2180 } |
| 2180 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_GET_ORIGIN_BOUND_CERT, | 2181 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_GET_ORIGIN_BOUND_CERT, |
| 2181 error); | 2182 error); |
| 2182 | 2183 |
| 2183 SECStatus rv = SECSuccess; | 2184 SECStatus rv = SECSuccess; |
| 2184 if (error == OK) { | 2185 if (error == OK) { |
| 2185 // Synchronous success. | 2186 // Synchronous success. |
| 2186 int result = ImportOBCertAndKey(result_certificate, | 2187 int result = ImportOBCertAndKey(result_certificate, |
| 2187 result_private_key); | 2188 result_private_key); |
| 2188 if (result != OK) | 2189 if (result == OK) |
| 2190 set_was_origin_bound_cert_sent(true); |
| 2191 else |
| 2189 rv = SECFailure; | 2192 rv = SECFailure; |
| 2190 } else { | 2193 } else { |
| 2191 rv = SECFailure; // Synchronous failure. | 2194 rv = SECFailure; // Synchronous failure. |
| 2192 } | 2195 } |
| 2193 | 2196 |
| 2194 int cert_count = (rv == SECSuccess) ? 1 : 0; | 2197 int cert_count = (rv == SECSuccess) ? 1 : 0; |
| 2195 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, | 2198 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, |
| 2196 make_scoped_refptr(new NetLogIntegerParameter("cert_count", | 2199 make_scoped_refptr(new NetLogIntegerParameter("cert_count", |
| 2197 cert_count))); | 2200 cert_count))); |
| 2198 return rv; | 2201 return rv; |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2667 valid_thread_id_ = base::PlatformThread::CurrentId(); | 2670 valid_thread_id_ = base::PlatformThread::CurrentId(); |
| 2668 } | 2671 } |
| 2669 | 2672 |
| 2670 bool SSLClientSocketNSS::CalledOnValidThread() const { | 2673 bool SSLClientSocketNSS::CalledOnValidThread() const { |
| 2671 EnsureThreadIdAssigned(); | 2674 EnsureThreadIdAssigned(); |
| 2672 base::AutoLock auto_lock(lock_); | 2675 base::AutoLock auto_lock(lock_); |
| 2673 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 2676 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
| 2674 } | 2677 } |
| 2675 | 2678 |
| 2676 } // namespace net | 2679 } // namespace net |
| OLD | NEW |