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); | |
1720 return OK; | 1721 return OK; |
1721 } | 1722 } |
1722 | 1723 |
1723 int SSLClientSocketNSS::DoVerifyDNSSEC(int result) { | 1724 int SSLClientSocketNSS::DoVerifyDNSSEC(int result) { |
1724 if (ssl_config_.dns_cert_provenance_checking_enabled && | 1725 if (ssl_config_.dns_cert_provenance_checking_enabled && |
1725 dns_cert_checker_) { | 1726 dns_cert_checker_) { |
1726 PeerCertificateChain certs(nss_fd_); | 1727 PeerCertificateChain certs(nss_fd_); |
1727 dns_cert_checker_->DoAsyncVerification( | 1728 dns_cert_checker_->DoAsyncVerification( |
1728 host_and_port_.host(), certs.AsStringPieceVector()); | 1729 host_and_port_.host(), certs.AsStringPieceVector()); |
1729 } | 1730 } |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2265 return SECWouldBlock; | 2266 return SECWouldBlock; |
2266 } | 2267 } |
2267 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_GET_ORIGIN_BOUND_CERT, | 2268 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_GET_ORIGIN_BOUND_CERT, |
2268 error); | 2269 error); |
2269 | 2270 |
2270 SECStatus rv = SECSuccess; | 2271 SECStatus rv = SECSuccess; |
2271 if (error == OK) { | 2272 if (error == OK) { |
2272 // Synchronous success. | 2273 // Synchronous success. |
2273 int result = ImportOBCertAndKey(result_certificate, | 2274 int result = ImportOBCertAndKey(result_certificate, |
2274 result_private_key); | 2275 result_private_key); |
2275 if (result != OK) | 2276 if (result == OK) |
2277 set_was_origin_bound_cert_sent(true); | |
2278 else | |
2276 rv = SECFailure; | 2279 rv = SECFailure; |
wtc
2011/12/07 22:59:59
Nit: let's take the opportunity to add curly brace
Ryan Hamilton
2011/12/07 23:02:31
Done.
| |
2277 } else { | 2280 } else { |
2278 rv = SECFailure; // Synchronous failure. | 2281 rv = SECFailure; // Synchronous failure. |
2279 } | 2282 } |
2280 | 2283 |
2281 int cert_count = (rv == SECSuccess) ? 1 : 0; | 2284 int cert_count = (rv == SECSuccess) ? 1 : 0; |
2282 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, | 2285 net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, |
2283 make_scoped_refptr(new NetLogIntegerParameter("cert_count", | 2286 make_scoped_refptr(new NetLogIntegerParameter("cert_count", |
2284 cert_count))); | 2287 cert_count))); |
2285 return rv; | 2288 return rv; |
2286 } | 2289 } |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2754 valid_thread_id_ = base::PlatformThread::CurrentId(); | 2757 valid_thread_id_ = base::PlatformThread::CurrentId(); |
2755 } | 2758 } |
2756 | 2759 |
2757 bool SSLClientSocketNSS::CalledOnValidThread() const { | 2760 bool SSLClientSocketNSS::CalledOnValidThread() const { |
2758 EnsureThreadIdAssigned(); | 2761 EnsureThreadIdAssigned(); |
2759 base::AutoLock auto_lock(lock_); | 2762 base::AutoLock auto_lock(lock_); |
2760 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 2763 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
2761 } | 2764 } |
2762 | 2765 |
2763 } // namespace net | 2766 } // namespace net |
OLD | NEW |