| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_BASE_SSL_CLIENT_SOCKET_WIN_H_ | 5 #ifndef NET_BASE_SSL_CLIENT_SOCKET_WIN_H_ |
| 6 #define NET_BASE_SSL_CLIENT_SOCKET_WIN_H_ | 6 #define NET_BASE_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> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 int DoHandshakeWrite(); | 60 int DoHandshakeWrite(); |
| 61 int DoHandshakeWriteComplete(int result); | 61 int DoHandshakeWriteComplete(int result); |
| 62 int DoVerifyCert(); | 62 int DoVerifyCert(); |
| 63 int DoVerifyCertComplete(int result); | 63 int DoVerifyCertComplete(int result); |
| 64 int DoPayloadRead(); | 64 int DoPayloadRead(); |
| 65 int DoPayloadReadComplete(int result); | 65 int DoPayloadReadComplete(int result); |
| 66 int DoPayloadEncrypt(); | 66 int DoPayloadEncrypt(); |
| 67 int DoPayloadWrite(); | 67 int DoPayloadWrite(); |
| 68 int DoPayloadWriteComplete(int result); | 68 int DoPayloadWriteComplete(int result); |
| 69 | 69 |
| 70 int DidCallInitializeSecurityContext(); |
| 70 int DidCompleteHandshake(); | 71 int DidCompleteHandshake(); |
| 71 void LogConnectionTypeMetrics() const; | 72 void LogConnectionTypeMetrics() const; |
| 73 void SetNextStateForRead(); |
| 74 void FreeSendBuffer(); |
| 72 | 75 |
| 73 CompletionCallbackImpl<SSLClientSocketWin> io_callback_; | 76 CompletionCallbackImpl<SSLClientSocketWin> io_callback_; |
| 74 scoped_ptr<ClientSocket> transport_; | 77 scoped_ptr<ClientSocket> transport_; |
| 75 std::string hostname_; | 78 std::string hostname_; |
| 76 SSLConfig ssl_config_; | 79 SSLConfig ssl_config_; |
| 77 | 80 |
| 78 CompletionCallback* user_callback_; | 81 CompletionCallback* user_callback_; |
| 79 | 82 |
| 80 // Used by both Read and Write functions. | 83 // Used by both Read and Write functions. |
| 81 char* user_buf_; | 84 char* user_buf_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 99 }; | 102 }; |
| 100 State next_state_; | 103 State next_state_; |
| 101 | 104 |
| 102 SecPkgContext_StreamSizes stream_sizes_; | 105 SecPkgContext_StreamSizes stream_sizes_; |
| 103 scoped_refptr<X509Certificate> server_cert_; | 106 scoped_refptr<X509Certificate> server_cert_; |
| 104 CertVerifier verifier_; | 107 CertVerifier verifier_; |
| 105 CertVerifyResult server_cert_verify_result_; | 108 CertVerifyResult server_cert_verify_result_; |
| 106 | 109 |
| 107 CredHandle* creds_; | 110 CredHandle* creds_; |
| 108 CtxtHandle ctxt_; | 111 CtxtHandle ctxt_; |
| 109 SecBuffer send_buffer_; | 112 SecBuffer in_buffers_[2]; // Input buffers for InitializeSecurityContext. |
| 113 SecBuffer send_buffer_; // Output buffer for InitializeSecurityContext. |
| 114 SECURITY_STATUS isc_status_; // Return value of InitializeSecurityContext. |
| 110 scoped_array<char> payload_send_buffer_; | 115 scoped_array<char> payload_send_buffer_; |
| 111 int payload_send_buffer_len_; | 116 int payload_send_buffer_len_; |
| 112 int bytes_sent_; | 117 int bytes_sent_; |
| 113 | 118 |
| 114 // recv_buffer_ holds the received ciphertext. Since Schannel decrypts | 119 // recv_buffer_ holds the received ciphertext. Since Schannel decrypts |
| 115 // data in place, sometimes recv_buffer_ may contain decrypted plaintext and | 120 // data in place, sometimes recv_buffer_ may contain decrypted plaintext and |
| 116 // any undecrypted ciphertext. (Ciphertext is decrypted one full SSL record | 121 // any undecrypted ciphertext. (Ciphertext is decrypted one full SSL record |
| 117 // at a time.) | 122 // at a time.) |
| 118 // | 123 // |
| 119 // If bytes_decrypted_ is 0, the received ciphertext is at the beginning of | 124 // If bytes_decrypted_ is 0, the received ciphertext is at the beginning of |
| 120 // recv_buffer_, ready to be passed to DecryptMessage. | 125 // recv_buffer_, ready to be passed to DecryptMessage. |
| 121 scoped_array<char> recv_buffer_; | 126 scoped_array<char> recv_buffer_; |
| 122 char* decrypted_ptr_; // Points to the decrypted plaintext in recv_buffer_ | 127 char* decrypted_ptr_; // Points to the decrypted plaintext in recv_buffer_ |
| 123 int bytes_decrypted_; // The number of bytes of decrypted plaintext. | 128 int bytes_decrypted_; // The number of bytes of decrypted plaintext. |
| 124 char* received_ptr_; // Points to the received ciphertext in recv_buffer_ | 129 char* received_ptr_; // Points to the received ciphertext in recv_buffer_ |
| 125 int bytes_received_; // The number of bytes of received ciphertext. | 130 int bytes_received_; // The number of bytes of received ciphertext. |
| 126 | 131 |
| 132 // True if we're writing the first token (handshake message) to the server, |
| 133 // false if we're writing a subsequent token. After we have written a token |
| 134 // successfully, DoHandshakeWriteComplete checks this member to set the next |
| 135 // state. |
| 136 bool writing_first_token_; |
| 137 |
| 127 bool completed_handshake_; | 138 bool completed_handshake_; |
| 128 bool complete_handshake_on_write_complete_; | |
| 129 | 139 |
| 130 // Only used in the STATE_HANDSHAKE_READ_COMPLETE and | 140 // Only used in the STATE_HANDSHAKE_READ_COMPLETE and |
| 131 // STATE_PAYLOAD_READ_COMPLETE states. True if a 'result' argument of OK | 141 // STATE_PAYLOAD_READ_COMPLETE states. True if a 'result' argument of OK |
| 132 // should be ignored, to prevent it from being interpreted as EOF. | 142 // should be ignored, to prevent it from being interpreted as EOF. |
| 133 // | 143 // |
| 134 // The reason we need this flag is that OK means not only "0 bytes of data | 144 // The reason we need this flag is that OK means not only "0 bytes of data |
| 135 // were read" but also EOF. We set ignore_ok_result_ to true when we need | 145 // were read" but also EOF. We set ignore_ok_result_ to true when we need |
| 136 // to continue processing previously read data without reading more data. | 146 // to continue processing previously read data without reading more data. |
| 137 // We have to pass a 'result' of OK to the DoLoop method, and don't want it | 147 // We have to pass a 'result' of OK to the DoLoop method, and don't want it |
| 138 // to be interpreted as EOF. | 148 // to be interpreted as EOF. |
| 139 bool ignore_ok_result_; | 149 bool ignore_ok_result_; |
| 140 | 150 |
| 141 // True if the user has no client certificate. | 151 // True if the user has no client certificate. |
| 142 bool no_client_cert_; | 152 bool no_client_cert_; |
| 153 |
| 154 // Renegotiation is in progress. |
| 155 bool renegotiating_; |
| 143 }; | 156 }; |
| 144 | 157 |
| 145 } // namespace net | 158 } // namespace net |
| 146 | 159 |
| 147 #endif // NET_BASE_SSL_CLIENT_SOCKET_WIN_H_ | 160 #endif // NET_BASE_SSL_CLIENT_SOCKET_WIN_H_ |
| OLD | NEW |