Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: net/base/ssl_client_socket_win.h

Issue 14915: Move certificate verification off the IO thread.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/ssl_client_socket_nss.cc ('k') | net/base/ssl_client_socket_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
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/completion_callback.h" 19 #include "net/base/completion_callback.h"
18 #include "net/base/ssl_client_socket.h" 20 #include "net/base/ssl_client_socket.h"
19 #include "net/base/ssl_config_service.h" 21 #include "net/base/ssl_config_service.h"
20 22
21 namespace net { 23 namespace net {
22 24
23 // An SSL client socket implemented with the Windows Schannel. 25 // An SSL client socket implemented with the Windows Schannel.
24 class SSLClientSocketWin : public SSLClientSocket { 26 class SSLClientSocketWin : public SSLClientSocket {
25 public: 27 public:
26 // Takes ownership of the transport_socket, which may already be connected. 28 // Takes ownership of the transport_socket, which may already be connected.
(...skipping 22 matching lines...) Expand all
49 void DoCallback(int result); 51 void DoCallback(int result);
50 void OnIOComplete(int result); 52 void OnIOComplete(int result);
51 53
52 int DoLoop(int last_io_result); 54 int DoLoop(int last_io_result);
53 int DoConnect(); 55 int DoConnect();
54 int DoConnectComplete(int result); 56 int DoConnectComplete(int result);
55 int DoHandshakeRead(); 57 int DoHandshakeRead();
56 int DoHandshakeReadComplete(int result); 58 int DoHandshakeReadComplete(int result);
57 int DoHandshakeWrite(); 59 int DoHandshakeWrite();
58 int DoHandshakeWriteComplete(int result); 60 int DoHandshakeWriteComplete(int result);
61 int DoVerifyCert();
62 int DoVerifyCertComplete(int result);
59 int DoPayloadRead(); 63 int DoPayloadRead();
60 int DoPayloadReadComplete(int result); 64 int DoPayloadReadComplete(int result);
61 int DoPayloadEncrypt(); 65 int DoPayloadEncrypt();
62 int DoPayloadWrite(); 66 int DoPayloadWrite();
63 int DoPayloadWriteComplete(int result); 67 int DoPayloadWriteComplete(int result);
64 68
65 int DidCompleteHandshake(); 69 int DidCompleteHandshake();
66 static void LogConnectionTypeMetrics(PCCERT_CHAIN_CONTEXT chain_context); 70 void LogConnectionTypeMetrics() const;
67 int VerifyServerCert();
68 71
69 CompletionCallbackImpl<SSLClientSocketWin> io_callback_; 72 CompletionCallbackImpl<SSLClientSocketWin> io_callback_;
70 scoped_ptr<ClientSocket> transport_; 73 scoped_ptr<ClientSocket> transport_;
71 std::string hostname_; 74 std::string hostname_;
72 SSLConfig ssl_config_; 75 SSLConfig ssl_config_;
73 76
74 CompletionCallback* user_callback_; 77 CompletionCallback* user_callback_;
75 78
76 // Used by both Read and Write functions. 79 // Used by both Read and Write functions.
77 char* user_buf_; 80 char* user_buf_;
78 int user_buf_len_; 81 int user_buf_len_;
79 82
80 enum State { 83 enum State {
81 STATE_NONE, 84 STATE_NONE,
82 STATE_CONNECT, 85 STATE_CONNECT,
83 STATE_CONNECT_COMPLETE, 86 STATE_CONNECT_COMPLETE,
84 STATE_HANDSHAKE_READ, 87 STATE_HANDSHAKE_READ,
85 STATE_HANDSHAKE_READ_COMPLETE, 88 STATE_HANDSHAKE_READ_COMPLETE,
86 STATE_HANDSHAKE_WRITE, 89 STATE_HANDSHAKE_WRITE,
87 STATE_HANDSHAKE_WRITE_COMPLETE, 90 STATE_HANDSHAKE_WRITE_COMPLETE,
91 STATE_VERIFY_CERT,
92 STATE_VERIFY_CERT_COMPLETE,
88 STATE_PAYLOAD_ENCRYPT, 93 STATE_PAYLOAD_ENCRYPT,
89 STATE_PAYLOAD_WRITE, 94 STATE_PAYLOAD_WRITE,
90 STATE_PAYLOAD_WRITE_COMPLETE, 95 STATE_PAYLOAD_WRITE_COMPLETE,
91 STATE_PAYLOAD_READ, 96 STATE_PAYLOAD_READ,
92 STATE_PAYLOAD_READ_COMPLETE, 97 STATE_PAYLOAD_READ_COMPLETE,
93 }; 98 };
94 State next_state_; 99 State next_state_;
95 100
96 SecPkgContext_StreamSizes stream_sizes_; 101 SecPkgContext_StreamSizes stream_sizes_;
97 PCCERT_CONTEXT server_cert_; 102 PCCERT_CONTEXT server_cert_;
98 int server_cert_status_; 103 CertVerifier verifier_;
104 CertVerifyResult server_cert_verify_result_;
99 105
100 CredHandle* creds_; 106 CredHandle* creds_;
101 CtxtHandle ctxt_; 107 CtxtHandle ctxt_;
102 SecBuffer send_buffer_; 108 SecBuffer send_buffer_;
103 scoped_array<char> payload_send_buffer_; 109 scoped_array<char> payload_send_buffer_;
104 int payload_send_buffer_len_; 110 int payload_send_buffer_len_;
105 int bytes_sent_; 111 int bytes_sent_;
106 112
107 // recv_buffer_ holds the received ciphertext. Since Schannel decrypts 113 // recv_buffer_ holds the received ciphertext. Since Schannel decrypts
108 // data in place, sometimes recv_buffer_ may contain decrypted plaintext and 114 // data in place, sometimes recv_buffer_ may contain decrypted plaintext and
(...skipping 23 matching lines...) Expand all
132 bool ignore_ok_result_; 138 bool ignore_ok_result_;
133 139
134 // True if the user has no client certificate. 140 // True if the user has no client certificate.
135 bool no_client_cert_; 141 bool no_client_cert_;
136 }; 142 };
137 143
138 } // namespace net 144 } // namespace net
139 145
140 #endif // NET_BASE_SSL_CLIENT_SOCKET_WIN_H_ 146 #endif // NET_BASE_SSL_CLIENT_SOCKET_WIN_H_
141 147
OLDNEW
« no previous file with comments | « net/base/ssl_client_socket_nss.cc ('k') | net/base/ssl_client_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698