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 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 PR_FALSE); | 1710 PR_FALSE); |
1711 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, | 1711 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, |
1712 make_scoped_refptr(new NetLogIntegerParameter("cert_count", | 1712 make_scoped_refptr(new NetLogIntegerParameter("cert_count", |
1713 cert_chain->len))); | 1713 cert_chain->len))); |
1714 SECStatus rv; | 1714 SECStatus rv; |
1715 rv = SSL_RestartHandshakeAfterCertReq(nss_fd_, cert, key, cert_chain); | 1715 rv = SSL_RestartHandshakeAfterCertReq(nss_fd_, cert, key, cert_chain); |
1716 if (rv != SECSuccess) | 1716 if (rv != SECSuccess) |
1717 return MapNSSError(PORT_GetError()); | 1717 return MapNSSError(PORT_GetError()); |
1718 | 1718 |
1719 GotoState(STATE_HANDSHAKE); | 1719 GotoState(STATE_HANDSHAKE); |
1720 set_was_origin_bound_cert_sent(true); | |
1721 return OK; | 1720 return OK; |
1722 } | 1721 } |
1723 | 1722 |
1724 int SSLClientSocketNSS::DoVerifyDNSSEC(int result) { | 1723 int SSLClientSocketNSS::DoVerifyDNSSEC(int result) { |
1725 if (ssl_config_.dns_cert_provenance_checking_enabled && | 1724 if (ssl_config_.dns_cert_provenance_checking_enabled && |
1726 dns_cert_checker_) { | 1725 dns_cert_checker_) { |
1727 PeerCertificateChain certs(nss_fd_); | 1726 PeerCertificateChain certs(nss_fd_); |
1728 dns_cert_checker_->DoAsyncVerification( | 1727 dns_cert_checker_->DoAsyncVerification( |
1729 host_and_port_.host(), certs.AsStringPieceVector()); | 1728 host_and_port_.host(), certs.AsStringPieceVector()); |
1730 } | 1729 } |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 return SECWouldBlock; | 2265 return SECWouldBlock; |
2267 } | 2266 } |
2268 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_GET_ORIGIN_BOUND_CERT, | 2267 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_GET_ORIGIN_BOUND_CERT, |
2269 error); | 2268 error); |
2270 | 2269 |
2271 SECStatus rv = SECSuccess; | 2270 SECStatus rv = SECSuccess; |
2272 if (error == OK) { | 2271 if (error == OK) { |
2273 // Synchronous success. | 2272 // Synchronous success. |
2274 int result = ImportOBCertAndKey(result_certificate, | 2273 int result = ImportOBCertAndKey(result_certificate, |
2275 result_private_key); | 2274 result_private_key); |
2276 if (result == OK) | 2275 if (result != OK) |
2277 set_was_origin_bound_cert_sent(true); | |
2278 else | |
2279 rv = SECFailure; | 2276 rv = SECFailure; |
2280 } else { | 2277 } else { |
2281 rv = SECFailure; // Synchronous failure. | 2278 rv = SECFailure; // Synchronous failure. |
2282 } | 2279 } |
2283 | 2280 |
2284 int cert_count = (rv == SECSuccess) ? 1 : 0; | 2281 int cert_count = (rv == SECSuccess) ? 1 : 0; |
2285 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, | 2282 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, |
2286 make_scoped_refptr(new NetLogIntegerParameter("cert_count", | 2283 make_scoped_refptr(new NetLogIntegerParameter("cert_count", |
2287 cert_count))); | 2284 cert_count))); |
2288 return rv; | 2285 return rv; |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2757 valid_thread_id_ = base::PlatformThread::CurrentId(); | 2754 valid_thread_id_ = base::PlatformThread::CurrentId(); |
2758 } | 2755 } |
2759 | 2756 |
2760 bool SSLClientSocketNSS::CalledOnValidThread() const { | 2757 bool SSLClientSocketNSS::CalledOnValidThread() const { |
2761 EnsureThreadIdAssigned(); | 2758 EnsureThreadIdAssigned(); |
2762 base::AutoLock auto_lock(lock_); | 2759 base::AutoLock auto_lock(lock_); |
2763 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 2760 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
2764 } | 2761 } |
2765 | 2762 |
2766 } // namespace net | 2763 } // namespace net |
OLD | NEW |