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 #include "net/socket/ssl_server_socket_openssl.h" | 5 #include "net/socket/ssl_server_socket_openssl.h" |
6 | 6 |
7 #include <openssl/err.h> | 7 #include <openssl/err.h> |
8 #include <openssl/ssl.h> | 8 #include <openssl/ssl.h> |
9 | 9 |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 user_write_buf_len_(0), | 47 user_write_buf_len_(0), |
48 transport_write_error_(OK), | 48 transport_write_error_(OK), |
49 ssl_(NULL), | 49 ssl_(NULL), |
50 transport_bio_(NULL), | 50 transport_bio_(NULL), |
51 transport_socket_(transport_socket.Pass()), | 51 transport_socket_(transport_socket.Pass()), |
52 ssl_config_(ssl_config), | 52 ssl_config_(ssl_config), |
53 cert_(certificate), | 53 cert_(certificate), |
54 next_handshake_state_(STATE_NONE), | 54 next_handshake_state_(STATE_NONE), |
55 completed_handshake_(false) { | 55 completed_handshake_(false) { |
56 // TODO(byungchul): Need a better way to clone a key. | 56 // TODO(byungchul): Need a better way to clone a key. |
57 std::vector<uint8> key_bytes; | 57 std::vector<uint8_t> key_bytes; |
58 CHECK(key->ExportPrivateKey(&key_bytes)); | 58 CHECK(key->ExportPrivateKey(&key_bytes)); |
59 key_.reset(crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes)); | 59 key_.reset(crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes)); |
60 CHECK(key_.get()); | 60 CHECK(key_.get()); |
61 } | 61 } |
62 | 62 |
63 SSLServerSocketOpenSSL::~SSLServerSocketOpenSSL() { | 63 SSLServerSocketOpenSSL::~SSLServerSocketOpenSSL() { |
64 if (ssl_) { | 64 if (ssl_) { |
65 // Calling SSL_shutdown prevents the session from being marked as | 65 // Calling SSL_shutdown prevents the session from being marked as |
66 // unresumable. | 66 // unresumable. |
67 SSL_shutdown(ssl_); | 67 SSL_shutdown(ssl_); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 if (rv == ERR_IO_PENDING) { | 168 if (rv == ERR_IO_PENDING) { |
169 user_write_callback_ = callback; | 169 user_write_callback_ = callback; |
170 } else { | 170 } else { |
171 user_write_buf_ = NULL; | 171 user_write_buf_ = NULL; |
172 user_write_buf_len_ = 0; | 172 user_write_buf_len_ = 0; |
173 } | 173 } |
174 return rv; | 174 return rv; |
175 } | 175 } |
176 | 176 |
177 int SSLServerSocketOpenSSL::SetReceiveBufferSize(int32 size) { | 177 int SSLServerSocketOpenSSL::SetReceiveBufferSize(int32_t size) { |
178 return transport_socket_->SetReceiveBufferSize(size); | 178 return transport_socket_->SetReceiveBufferSize(size); |
179 } | 179 } |
180 | 180 |
181 int SSLServerSocketOpenSSL::SetSendBufferSize(int32 size) { | 181 int SSLServerSocketOpenSSL::SetSendBufferSize(int32_t size) { |
182 return transport_socket_->SetSendBufferSize(size); | 182 return transport_socket_->SetSendBufferSize(size); |
183 } | 183 } |
184 | 184 |
185 int SSLServerSocketOpenSSL::Connect(const CompletionCallback& callback) { | 185 int SSLServerSocketOpenSSL::Connect(const CompletionCallback& callback) { |
186 NOTIMPLEMENTED(); | 186 NOTIMPLEMENTED(); |
187 return ERR_NOT_IMPLEMENTED; | 187 return ERR_NOT_IMPLEMENTED; |
188 } | 188 } |
189 | 189 |
190 void SSLServerSocketOpenSSL::Disconnect() { | 190 void SSLServerSocketOpenSSL::Disconnect() { |
191 transport_socket_->Disconnect(); | 191 transport_socket_->Disconnect(); |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 // If this fails (rv = 0) it means there are no ciphers enabled on this SSL. | 711 // If this fails (rv = 0) it means there are no ciphers enabled on this SSL. |
712 // This will almost certainly result in the socket failing to complete the | 712 // This will almost certainly result in the socket failing to complete the |
713 // handshake at which point the appropriate error is bubbled up to the client. | 713 // handshake at which point the appropriate error is bubbled up to the client. |
714 LOG_IF(WARNING, rv != 1) << "SSL_set_cipher_list('" << command | 714 LOG_IF(WARNING, rv != 1) << "SSL_set_cipher_list('" << command |
715 << "') returned " << rv; | 715 << "') returned " << rv; |
716 | 716 |
717 return OK; | 717 return OK; |
718 } | 718 } |
719 | 719 |
720 } // namespace net | 720 } // namespace net |
OLD | NEW |