| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 MaybeLogSSLError(); | 56 MaybeLogSSLError(); |
| 57 return ERR_SSL_PROTOCOL_ERROR; | 57 return ERR_SSL_PROTOCOL_ERROR; |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 SSLClientSocketOpenSSL::SSLClientSocketOpenSSL( | 63 SSLClientSocketOpenSSL::SSLClientSocketOpenSSL( |
| 64 ClientSocketHandle* transport_socket, | 64 ClientSocketHandle* transport_socket, |
| 65 const std::string& hostname, | 65 const std::string& hostname, |
| 66 uint16 port, |
| 66 const SSLConfig& ssl_config) | 67 const SSLConfig& ssl_config) |
| 67 : ALLOW_THIS_IN_INITIALIZER_LIST(buffer_send_callback_( | 68 : ALLOW_THIS_IN_INITIALIZER_LIST(buffer_send_callback_( |
| 68 this, &SSLClientSocketOpenSSL::BufferSendComplete)), | 69 this, &SSLClientSocketOpenSSL::BufferSendComplete)), |
| 69 ALLOW_THIS_IN_INITIALIZER_LIST(buffer_recv_callback_( | 70 ALLOW_THIS_IN_INITIALIZER_LIST(buffer_recv_callback_( |
| 70 this, &SSLClientSocketOpenSSL::BufferRecvComplete)), | 71 this, &SSLClientSocketOpenSSL::BufferRecvComplete)), |
| 71 transport_send_busy_(false), | 72 transport_send_busy_(false), |
| 72 transport_recv_busy_(false), | 73 transport_recv_busy_(false), |
| 73 user_connect_callback_(NULL), | 74 user_connect_callback_(NULL), |
| 74 user_read_callback_(NULL), | 75 user_read_callback_(NULL), |
| 75 user_write_callback_(NULL), | 76 user_write_callback_(NULL), |
| 76 client_auth_cert_needed_(false), | 77 client_auth_cert_needed_(false), |
| 77 ALLOW_THIS_IN_INITIALIZER_LIST(handshake_io_callback_( | 78 ALLOW_THIS_IN_INITIALIZER_LIST(handshake_io_callback_( |
| 78 this, &SSLClientSocketOpenSSL::OnHandshakeIOComplete)), | 79 this, &SSLClientSocketOpenSSL::OnHandshakeIOComplete)), |
| 79 ssl_(NULL), | 80 ssl_(NULL), |
| 80 transport_bio_(NULL), | 81 transport_bio_(NULL), |
| 81 transport_(transport_socket), | 82 transport_(transport_socket), |
| 82 hostname_(hostname), | 83 hostname_(hostname), |
| 84 port_(port), |
| 83 ssl_config_(ssl_config), | 85 ssl_config_(ssl_config), |
| 84 completed_handshake_(false), | 86 completed_handshake_(false), |
| 85 net_log_(transport_socket->socket()->NetLog()) { | 87 net_log_(transport_socket->socket()->NetLog()) { |
| 86 } | 88 } |
| 87 | 89 |
| 88 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { | 90 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { |
| 89 Disconnect(); | 91 Disconnect(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 bool SSLClientSocketOpenSSL::Init() { | 94 bool SSLClientSocketOpenSSL::Init() { |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 int rv = SSL_write(ssl_, user_write_buf_->data(), user_write_buf_len_); | 733 int rv = SSL_write(ssl_, user_write_buf_->data(), user_write_buf_len_); |
| 732 | 734 |
| 733 if (rv >= 0) | 735 if (rv >= 0) |
| 734 return rv; | 736 return rv; |
| 735 | 737 |
| 736 int err = SSL_get_error(ssl_, rv); | 738 int err = SSL_get_error(ssl_, rv); |
| 737 return MapOpenSSLError(err); | 739 return MapOpenSSLError(err); |
| 738 } | 740 } |
| 739 | 741 |
| 740 } // namespace net | 742 } // namespace net |
| OLD | NEW |