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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 SSL_CacheSessionUnlocked(socket); | 1624 SSL_CacheSessionUnlocked(socket); |
1625 | 1625 |
1626 // Additionally, when False Starting, DoHandshake() will have already | 1626 // Additionally, when False Starting, DoHandshake() will have already |
1627 // called HandshakeSucceeded(), so return now. | 1627 // called HandshakeSucceeded(), so return now. |
1628 return; | 1628 return; |
1629 } | 1629 } |
1630 core->HandshakeSucceeded(); | 1630 core->HandshakeSucceeded(); |
1631 } | 1631 } |
1632 | 1632 |
1633 void SSLClientSocketNSS::Core::HandshakeSucceeded() { | 1633 void SSLClientSocketNSS::Core::HandshakeSucceeded() { |
| 1634 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424386 is fixed. |
| 1635 tracked_objects::ScopedProfile tracking_profile( |
| 1636 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1637 "424386 SSLClientSocketNSS::Core::HandshakeSucceeded")); |
| 1638 |
1634 DCHECK(OnNSSTaskRunner()); | 1639 DCHECK(OnNSSTaskRunner()); |
1635 | 1640 |
1636 PRBool last_handshake_resumed; | 1641 PRBool last_handshake_resumed; |
1637 SECStatus rv = SSL_HandshakeResumedSession(nss_fd_, &last_handshake_resumed); | 1642 SECStatus rv = SSL_HandshakeResumedSession(nss_fd_, &last_handshake_resumed); |
1638 if (rv == SECSuccess && last_handshake_resumed) { | 1643 if (rv == SECSuccess && last_handshake_resumed) { |
1639 nss_handshake_state_.resumed_handshake = true; | 1644 nss_handshake_state_.resumed_handshake = true; |
1640 } else { | 1645 } else { |
1641 nss_handshake_state_.resumed_handshake = false; | 1646 nss_handshake_state_.resumed_handshake = false; |
1642 } | 1647 } |
1643 | 1648 |
1644 RecordChannelIDSupportOnNSSTaskRunner(); | 1649 RecordChannelIDSupportOnNSSTaskRunner(); |
1645 UpdateServerCert(); | 1650 UpdateServerCert(); |
1646 UpdateSignedCertTimestamps(); | 1651 UpdateSignedCertTimestamps(); |
1647 UpdateStapledOCSPResponse(); | 1652 UpdateStapledOCSPResponse(); |
1648 UpdateConnectionStatus(); | 1653 UpdateConnectionStatus(); |
1649 UpdateNextProto(); | 1654 UpdateNextProto(); |
1650 UpdateExtensionUsed(); | 1655 UpdateExtensionUsed(); |
1651 | 1656 |
1652 // Update the network task runners view of the handshake state whenever | 1657 // Update the network task runners view of the handshake state whenever |
1653 // a handshake has completed. | 1658 // a handshake has completed. |
1654 PostOrRunCallback( | 1659 PostOrRunCallback( |
1655 FROM_HERE, base::Bind(&Core::OnHandshakeStateUpdated, this, | 1660 FROM_HERE, base::Bind(&Core::OnHandshakeStateUpdated, this, |
1656 nss_handshake_state_)); | 1661 nss_handshake_state_)); |
1657 } | 1662 } |
1658 | 1663 |
1659 int SSLClientSocketNSS::Core::HandleNSSError(PRErrorCode nss_error) { | 1664 int SSLClientSocketNSS::Core::HandleNSSError(PRErrorCode nss_error) { |
| 1665 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424386 is fixed. |
| 1666 tracked_objects::ScopedProfile tracking_profile( |
| 1667 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1668 "424386 SSLClientSocketNSS::Core::HandleNSSError")); |
| 1669 |
1660 DCHECK(OnNSSTaskRunner()); | 1670 DCHECK(OnNSSTaskRunner()); |
1661 | 1671 |
1662 int net_error = MapNSSClientError(nss_error); | 1672 int net_error = MapNSSClientError(nss_error); |
1663 | 1673 |
1664 #if defined(OS_WIN) | 1674 #if defined(OS_WIN) |
1665 // On Windows, a handle to the HCRYPTPROV is cached in the X509Certificate | 1675 // On Windows, a handle to the HCRYPTPROV is cached in the X509Certificate |
1666 // os_cert_handle() as an optimization. However, if the certificate | 1676 // os_cert_handle() as an optimization. However, if the certificate |
1667 // private key is stored on a smart card, and the smart card is removed, | 1677 // private key is stored on a smart card, and the smart card is removed, |
1668 // the cached HCRYPTPROV will not be able to obtain the HCRYPTKEY again, | 1678 // the cached HCRYPTPROV will not be able to obtain the HCRYPTKEY again, |
1669 // preventing client certificate authentication. Because the | 1679 // preventing client certificate authentication. Because the |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424386 is fixed. | 1807 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424386 is fixed. |
1798 tracked_objects::ScopedProfile tracking_profile( | 1808 tracked_objects::ScopedProfile tracking_profile( |
1799 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1809 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
1800 "424386 SSLClientSocketNSS::Core::DoHandshake")); | 1810 "424386 SSLClientSocketNSS::Core::DoHandshake")); |
1801 | 1811 |
1802 DCHECK(OnNSSTaskRunner()); | 1812 DCHECK(OnNSSTaskRunner()); |
1803 | 1813 |
1804 int net_error = OK; | 1814 int net_error = OK; |
1805 SECStatus rv = SSL_ForceHandshake(nss_fd_); | 1815 SECStatus rv = SSL_ForceHandshake(nss_fd_); |
1806 | 1816 |
| 1817 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424386 is fixed. |
| 1818 tracked_objects::ScopedProfile tracking_profile1( |
| 1819 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1820 "424386 SSLClientSocketNSS::Core::DoHandshake 1")); |
| 1821 |
1807 // Note: this function may be called multiple times during the handshake, so | 1822 // Note: this function may be called multiple times during the handshake, so |
1808 // even though channel id and client auth are separate else cases, they can | 1823 // even though channel id and client auth are separate else cases, they can |
1809 // both be used during a single SSL handshake. | 1824 // both be used during a single SSL handshake. |
1810 if (channel_id_needed_) { | 1825 if (channel_id_needed_) { |
1811 GotoState(STATE_GET_DOMAIN_BOUND_CERT_COMPLETE); | 1826 GotoState(STATE_GET_DOMAIN_BOUND_CERT_COMPLETE); |
1812 net_error = ERR_IO_PENDING; | 1827 net_error = ERR_IO_PENDING; |
1813 } else if (client_auth_cert_needed_) { | 1828 } else if (client_auth_cert_needed_) { |
1814 net_error = ERR_SSL_CLIENT_AUTH_CERT_NEEDED; | 1829 net_error = ERR_SSL_CLIENT_AUTH_CERT_NEEDED; |
1815 PostOrRunCallback( | 1830 PostOrRunCallback( |
1816 FROM_HERE, | 1831 FROM_HERE, |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3622 scoped_refptr<X509Certificate> | 3637 scoped_refptr<X509Certificate> |
3623 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { | 3638 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { |
3624 return core_->state().server_cert.get(); | 3639 return core_->state().server_cert.get(); |
3625 } | 3640 } |
3626 | 3641 |
3627 ChannelIDService* SSLClientSocketNSS::GetChannelIDService() const { | 3642 ChannelIDService* SSLClientSocketNSS::GetChannelIDService() const { |
3628 return channel_id_service_; | 3643 return channel_id_service_; |
3629 } | 3644 } |
3630 | 3645 |
3631 } // namespace net | 3646 } // namespace net |
OLD | NEW |