| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
| 7 | 7 |
| 8 #define SECURITY_WIN32 // Needs to be defined before including security.h | 8 #define SECURITY_WIN32 // Needs to be defined before including security.h |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| 11 #include <wincrypt.h> | 11 #include <wincrypt.h> |
| 12 #include <security.h> | 12 #include <security.h> |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #include "net/base/cert_verifier.h" | |
| 18 #include "net/base/cert_verify_result.h" | 17 #include "net/base/cert_verify_result.h" |
| 19 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
| 20 #include "net/base/ssl_config_service.h" | 19 #include "net/base/ssl_config_service.h" |
| 21 #include "net/socket/ssl_client_socket.h" | 20 #include "net/socket/ssl_client_socket.h" |
| 22 | 21 |
| 23 namespace net { | 22 namespace net { |
| 24 | 23 |
| 24 class CertVerifier; |
| 25 |
| 25 // An SSL client socket implemented with the Windows Schannel. | 26 // An SSL client socket implemented with the Windows Schannel. |
| 26 class SSLClientSocketWin : public SSLClientSocket { | 27 class SSLClientSocketWin : public SSLClientSocket { |
| 27 public: | 28 public: |
| 28 // Takes ownership of the transport_socket, which may already be connected. | 29 // Takes ownership of the transport_socket, which may already be connected. |
| 29 // The given hostname will be compared with the name(s) in the server's | 30 // The given hostname will be compared with the name(s) in the server's |
| 30 // certificate during the SSL handshake. ssl_config specifies the SSL | 31 // certificate during the SSL handshake. ssl_config specifies the SSL |
| 31 // settings. | 32 // settings. |
| 32 SSLClientSocketWin(ClientSocket* transport_socket, | 33 SSLClientSocketWin(ClientSocket* transport_socket, |
| 33 const std::string& hostname, | 34 const std::string& hostname, |
| 34 const SSLConfig& ssl_config); | 35 const SSLConfig& ssl_config); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 STATE_PAYLOAD_ENCRYPT, | 98 STATE_PAYLOAD_ENCRYPT, |
| 98 STATE_PAYLOAD_WRITE, | 99 STATE_PAYLOAD_WRITE, |
| 99 STATE_PAYLOAD_WRITE_COMPLETE, | 100 STATE_PAYLOAD_WRITE_COMPLETE, |
| 100 STATE_PAYLOAD_READ, | 101 STATE_PAYLOAD_READ, |
| 101 STATE_PAYLOAD_READ_COMPLETE, | 102 STATE_PAYLOAD_READ_COMPLETE, |
| 102 }; | 103 }; |
| 103 State next_state_; | 104 State next_state_; |
| 104 | 105 |
| 105 SecPkgContext_StreamSizes stream_sizes_; | 106 SecPkgContext_StreamSizes stream_sizes_; |
| 106 scoped_refptr<X509Certificate> server_cert_; | 107 scoped_refptr<X509Certificate> server_cert_; |
| 107 CertVerifier verifier_; | 108 scoped_ptr<CertVerifier> verifier_; |
| 108 CertVerifyResult server_cert_verify_result_; | 109 CertVerifyResult server_cert_verify_result_; |
| 109 | 110 |
| 110 CredHandle* creds_; | 111 CredHandle* creds_; |
| 111 CtxtHandle ctxt_; | 112 CtxtHandle ctxt_; |
| 112 SecBuffer in_buffers_[2]; // Input buffers for InitializeSecurityContext. | 113 SecBuffer in_buffers_[2]; // Input buffers for InitializeSecurityContext. |
| 113 SecBuffer send_buffer_; // Output buffer for InitializeSecurityContext. | 114 SecBuffer send_buffer_; // Output buffer for InitializeSecurityContext. |
| 114 SECURITY_STATUS isc_status_; // Return value of InitializeSecurityContext. | 115 SECURITY_STATUS isc_status_; // Return value of InitializeSecurityContext. |
| 115 scoped_array<char> payload_send_buffer_; | 116 scoped_array<char> payload_send_buffer_; |
| 116 int payload_send_buffer_len_; | 117 int payload_send_buffer_len_; |
| 117 int bytes_sent_; | 118 int bytes_sent_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 148 // to be interpreted as EOF. | 149 // to be interpreted as EOF. |
| 149 bool ignore_ok_result_; | 150 bool ignore_ok_result_; |
| 150 | 151 |
| 151 // Renegotiation is in progress. | 152 // Renegotiation is in progress. |
| 152 bool renegotiating_; | 153 bool renegotiating_; |
| 153 }; | 154 }; |
| 154 | 155 |
| 155 } // namespace net | 156 } // namespace net |
| 156 | 157 |
| 157 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ | 158 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
| OLD | NEW |