| 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 <openssl/ssl.h> | 10 #include <openssl/ssl.h> |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 << SSLConnectionStatusToCompression(ssl_info->connection_status) | 644 << SSLConnectionStatusToCompression(ssl_info->connection_status) |
| 645 << " version = " | 645 << " version = " |
| 646 << SSLConnectionStatusToVersion(ssl_info->connection_status); | 646 << SSLConnectionStatusToVersion(ssl_info->connection_status); |
| 647 return true; | 647 return true; |
| 648 } | 648 } |
| 649 | 649 |
| 650 void SSLClientSocketOpenSSL::GetSSLCertRequestInfo( | 650 void SSLClientSocketOpenSSL::GetSSLCertRequestInfo( |
| 651 SSLCertRequestInfo* cert_request_info) { | 651 SSLCertRequestInfo* cert_request_info) { |
| 652 cert_request_info->host_and_port = host_and_port_.ToString(); | 652 cert_request_info->host_and_port = host_and_port_.ToString(); |
| 653 cert_request_info->cert_authorities = cert_authorities_; | 653 cert_request_info->cert_authorities = cert_authorities_; |
| 654 cert_request_info->client_certs = client_certs_; | |
| 655 } | 654 } |
| 656 | 655 |
| 657 int SSLClientSocketOpenSSL::ExportKeyingMaterial( | 656 int SSLClientSocketOpenSSL::ExportKeyingMaterial( |
| 658 const base::StringPiece& label, | 657 const base::StringPiece& label, |
| 659 bool has_context, const base::StringPiece& context, | 658 bool has_context, const base::StringPiece& context, |
| 660 unsigned char* out, unsigned int outlen) { | 659 unsigned char* out, unsigned int outlen) { |
| 661 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 660 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
| 662 | 661 |
| 663 int rv = SSL_export_keying_material( | 662 int rv = SSL_export_keying_material( |
| 664 ssl_, out, outlen, const_cast<char*>(label.data()), | 663 ssl_, out, outlen, const_cast<char*>(label.data()), |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 user_write_callback_.Reset(); | 766 user_write_callback_.Reset(); |
| 768 user_read_buf_ = NULL; | 767 user_read_buf_ = NULL; |
| 769 user_read_buf_len_ = 0; | 768 user_read_buf_len_ = 0; |
| 770 user_write_buf_ = NULL; | 769 user_write_buf_ = NULL; |
| 771 user_write_buf_len_ = 0; | 770 user_write_buf_len_ = 0; |
| 772 | 771 |
| 773 server_cert_verify_result_.Reset(); | 772 server_cert_verify_result_.Reset(); |
| 774 completed_handshake_ = false; | 773 completed_handshake_ = false; |
| 775 | 774 |
| 776 cert_authorities_.clear(); | 775 cert_authorities_.clear(); |
| 777 client_certs_.clear(); | |
| 778 client_auth_cert_needed_ = false; | 776 client_auth_cert_needed_ = false; |
| 779 } | 777 } |
| 780 | 778 |
| 781 int SSLClientSocketOpenSSL::DoHandshakeLoop(int last_io_result) { | 779 int SSLClientSocketOpenSSL::DoHandshakeLoop(int last_io_result) { |
| 782 int rv = last_io_result; | 780 int rv = last_io_result; |
| 783 do { | 781 do { |
| 784 // Default to STATE_NONE for next state. | 782 // Default to STATE_NONE for next state. |
| 785 // (This is a quirk carried over from the windows | 783 // (This is a quirk carried over from the windows |
| 786 // implementation. It makes reading the logs a bit harder.) | 784 // implementation. It makes reading the logs a bit harder.) |
| 787 // State handlers can and often do call GotoState just | 785 // State handlers can and often do call GotoState just |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_SENT, rv, | 1349 net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_SENT, rv, |
| 1352 user_write_buf_->data()); | 1350 user_write_buf_->data()); |
| 1353 return rv; | 1351 return rv; |
| 1354 } | 1352 } |
| 1355 | 1353 |
| 1356 int err = SSL_get_error(ssl_, rv); | 1354 int err = SSL_get_error(ssl_, rv); |
| 1357 return MapOpenSSLError(err, err_tracer); | 1355 return MapOpenSSLError(err, err_tracer); |
| 1358 } | 1356 } |
| 1359 | 1357 |
| 1360 } // namespace net | 1358 } // namespace net |
| OLD | NEW |