| 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 // OpenSSL binding for SSLClientSocket. The class layout and general principle | 5 // OpenSSL binding for SSLClientSocket. The class layout and general principle |
| 6 // of operation is derived from SSLClientSocketNSS. | 6 // of operation is derived from SSLClientSocketNSS. |
| 7 | 7 |
| 8 #include "net/socket/ssl_client_socket_openssl.h" | 8 #include "net/socket/ssl_client_socket_openssl.h" |
| 9 | 9 |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 } | 935 } |
| 936 | 936 |
| 937 // SSL handshake is completed. If NPN wasn't negotiated, see if ALPN was. | 937 // SSL handshake is completed. If NPN wasn't negotiated, see if ALPN was. |
| 938 if (npn_status_ == kNextProtoUnsupported) { | 938 if (npn_status_ == kNextProtoUnsupported) { |
| 939 const uint8_t* alpn_proto = NULL; | 939 const uint8_t* alpn_proto = NULL; |
| 940 unsigned alpn_len = 0; | 940 unsigned alpn_len = 0; |
| 941 SSL_get0_alpn_selected(ssl_, &alpn_proto, &alpn_len); | 941 SSL_get0_alpn_selected(ssl_, &alpn_proto, &alpn_len); |
| 942 if (alpn_len > 0) { | 942 if (alpn_len > 0) { |
| 943 npn_proto_.assign(reinterpret_cast<const char*>(alpn_proto), alpn_len); | 943 npn_proto_.assign(reinterpret_cast<const char*>(alpn_proto), alpn_len); |
| 944 npn_status_ = kNextProtoNegotiated; | 944 npn_status_ = kNextProtoNegotiated; |
| 945 set_protocol_negotiation(PN_ALPN); |
| 945 } | 946 } |
| 946 } | 947 } |
| 947 | 948 |
| 948 RecordChannelIDSupport(channel_id_service_, | 949 RecordChannelIDSupport(channel_id_service_, |
| 949 channel_id_xtn_negotiated_, | 950 channel_id_xtn_negotiated_, |
| 950 ssl_config_.channel_id_enabled, | 951 ssl_config_.channel_id_enabled, |
| 951 crypto::ECPrivateKey::IsSupported()); | 952 crypto::ECPrivateKey::IsSupported()); |
| 952 | 953 |
| 953 uint8_t* ocsp_response; | 954 uint8_t* ocsp_response; |
| 954 size_t ocsp_response_len; | 955 size_t ocsp_response_len; |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 | 1672 |
| 1672 // If we didn't find a protocol, we select the first one from our list. | 1673 // If we didn't find a protocol, we select the first one from our list. |
| 1673 if (npn_status_ == kNextProtoNoOverlap) { | 1674 if (npn_status_ == kNextProtoNoOverlap) { |
| 1674 *out = reinterpret_cast<uint8*>(const_cast<char*>( | 1675 *out = reinterpret_cast<uint8*>(const_cast<char*>( |
| 1675 ssl_config_.next_protos[0].data())); | 1676 ssl_config_.next_protos[0].data())); |
| 1676 *outlen = ssl_config_.next_protos[0].size(); | 1677 *outlen = ssl_config_.next_protos[0].size(); |
| 1677 } | 1678 } |
| 1678 | 1679 |
| 1679 npn_proto_.assign(reinterpret_cast<const char*>(*out), *outlen); | 1680 npn_proto_.assign(reinterpret_cast<const char*>(*out), *outlen); |
| 1680 DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; | 1681 DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; |
| 1682 set_protocol_negotiation(PN_NPN); |
| 1681 return SSL_TLSEXT_ERR_OK; | 1683 return SSL_TLSEXT_ERR_OK; |
| 1682 } | 1684 } |
| 1683 | 1685 |
| 1684 long SSLClientSocketOpenSSL::MaybeReplayTransportError( | 1686 long SSLClientSocketOpenSSL::MaybeReplayTransportError( |
| 1685 BIO *bio, | 1687 BIO *bio, |
| 1686 int cmd, | 1688 int cmd, |
| 1687 const char *argp, int argi, long argl, | 1689 const char *argp, int argi, long argl, |
| 1688 long retvalue) { | 1690 long retvalue) { |
| 1689 if (cmd == (BIO_CB_READ|BIO_CB_RETURN) && retvalue <= 0) { | 1691 if (cmd == (BIO_CB_READ|BIO_CB_RETURN) && retvalue <= 0) { |
| 1690 // If there is no more data in the buffer, report any pending errors that | 1692 // If there is no more data in the buffer, report any pending errors that |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 ct::SCT_STATUS_LOG_UNKNOWN)); | 1775 ct::SCT_STATUS_LOG_UNKNOWN)); |
| 1774 } | 1776 } |
| 1775 } | 1777 } |
| 1776 | 1778 |
| 1777 scoped_refptr<X509Certificate> | 1779 scoped_refptr<X509Certificate> |
| 1778 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { | 1780 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { |
| 1779 return server_cert_; | 1781 return server_cert_; |
| 1780 } | 1782 } |
| 1781 | 1783 |
| 1782 } // namespace net | 1784 } // namespace net |
| OLD | NEW |