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

Side by Side Diff: remoting/protocol/ssl_hmac_channel_authenticator.cc

Issue 1518613002: Support for server session cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client_certs
Patch Set: Fixed nit Created 4 years, 9 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
« no previous file with comments | « remoting/protocol/ssl_hmac_channel_authenticator.h ('k') | no next file » | 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) 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 "remoting/protocol/ssl_hmac_channel_authenticator.h" 5 #include "remoting/protocol/ssl_hmac_channel_authenticator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 int result; 211 int result;
212 if (is_ssl_server()) { 212 if (is_ssl_server()) {
213 #if defined(OS_NACL) 213 #if defined(OS_NACL)
214 // Client plugin doesn't use server SSL sockets, and so SSLServerSocket 214 // Client plugin doesn't use server SSL sockets, and so SSLServerSocket
215 // implementation is not compiled for NaCl as part of net_nacl. 215 // implementation is not compiled for NaCl as part of net_nacl.
216 NOTREACHED(); 216 NOTREACHED();
217 result = net::ERR_FAILED; 217 result = net::ERR_FAILED;
218 #else 218 #else
219 scoped_refptr<net::X509Certificate> cert = 219 scoped_refptr<net::X509Certificate> cert =
220 net::X509Certificate::CreateFromBytes( 220 net::X509Certificate::CreateFromBytes(local_cert_.data(),
221 local_cert_.data(), local_cert_.length()); 221 local_cert_.length());
222 if (!cert.get()) { 222 if (!cert.get()) {
223 LOG(ERROR) << "Failed to parse X509Certificate"; 223 LOG(ERROR) << "Failed to parse X509Certificate";
224 NotifyError(net::ERR_FAILED); 224 NotifyError(net::ERR_FAILED);
225 return; 225 return;
226 } 226 }
227 227
228 net::SSLServerConfig ssl_config; 228 net::SSLServerConfig ssl_config;
229 ssl_config.require_ecdhe = true; 229 ssl_config.require_ecdhe = true;
230 230
231 scoped_ptr<net::SSLServerSocket> server_socket = net::CreateSSLServerSocket( 231 server_context_ = net::CreateSSLServerContext(
Sergey Ulanov 2016/03/04 20:37:25 Does server_context_ need to be a class member ins
davidben 2016/03/04 20:56:55 The socket shouldn't outlive the context. (It's no
Sergey Ulanov 2016/03/04 21:35:31 So then this code will not work correctly. SslHmac
davidben 2016/03/04 21:45:53 Oh, that's annoying. Reference-counting is viral
davidben 2016/03/04 21:48:04 Oh, I probably should have elaborated here: you ca
Sergey Ulanov 2016/03/04 22:34:07 We have P2PStreamSocketAdapter that takes ownershi
ryanchung 2016/03/04 23:31:23 Done. I've added server_context_ to P2PStreamSocke
232 make_scoped_ptr(new NetStreamSocketAdapter(std::move(socket))),
233 cert.get(), *local_key_pair_->private_key(), ssl_config); 232 cert.get(), *local_key_pair_->private_key(), ssl_config);
233
234 scoped_ptr<net::SSLServerSocket> server_socket =
235 server_context_->CreateSSLServerSocket(
236 make_scoped_ptr(new NetStreamSocketAdapter(std::move(socket))));
234 net::SSLServerSocket* raw_server_socket = server_socket.get(); 237 net::SSLServerSocket* raw_server_socket = server_socket.get();
235 socket_ = std::move(server_socket); 238 socket_ = std::move(server_socket);
236 result = raw_server_socket->Handshake( 239 result = raw_server_socket->Handshake(
237 base::Bind(&SslHmacChannelAuthenticator::OnConnected, 240 base::Bind(&SslHmacChannelAuthenticator::OnConnected,
238 base::Unretained(this))); 241 base::Unretained(this)));
239 #endif 242 #endif
240 } else { 243 } else {
241 transport_security_state_.reset(new net::TransportSecurityState); 244 transport_security_state_.reset(new net::TransportSecurityState);
242 cert_verifier_.reset(new FailingCertVerifier); 245 cert_verifier_.reset(new FailingCertVerifier);
243 246
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 make_scoped_ptr(new P2PStreamSocketAdapter(std::move(socket_)))); 437 make_scoped_ptr(new P2PStreamSocketAdapter(std::move(socket_))));
435 } 438 }
436 } 439 }
437 440
438 void SslHmacChannelAuthenticator::NotifyError(int error) { 441 void SslHmacChannelAuthenticator::NotifyError(int error) {
439 base::ResetAndReturn(&done_callback_).Run(error, nullptr); 442 base::ResetAndReturn(&done_callback_).Run(error, nullptr);
440 } 443 }
441 444
442 } // namespace protocol 445 } // namespace protocol
443 } // namespace remoting 446 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/ssl_hmac_channel_authenticator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698