Chromium Code Reviews| Index: remoting/protocol/ssl_hmac_channel_authenticator.cc |
| diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.cc b/remoting/protocol/ssl_hmac_channel_authenticator.cc |
| index 808bd1b85a5ba0d032a7d1f4e9fbe51aca2d1c82..a8407efcc89745b519e16f15f6a0a94f9caf86d0 100644 |
| --- a/remoting/protocol/ssl_hmac_channel_authenticator.cc |
| +++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc |
| @@ -190,6 +190,7 @@ SslHmacChannelAuthenticator::CreateForHost( |
| new SslHmacChannelAuthenticator(auth_key)); |
| result->local_cert_ = local_cert; |
| result->local_key_pair_ = key_pair; |
| + result->InitializeSSLServerContext(); |
| return result; |
| } |
| @@ -201,20 +202,12 @@ SslHmacChannelAuthenticator::SslHmacChannelAuthenticator( |
| SslHmacChannelAuthenticator::~SslHmacChannelAuthenticator() { |
| } |
| -void SslHmacChannelAuthenticator::SecureAndAuthenticate( |
| - scoped_ptr<P2PStreamSocket> socket, |
| - const DoneCallback& done_callback) { |
| - DCHECK(CalledOnValidThread()); |
| - |
| - done_callback_ = done_callback; |
| - |
| - int result; |
| +void SslHmacChannelAuthenticator::InitializeSSLServerContext() { |
| if (is_ssl_server()) { |
| #if defined(OS_NACL) |
| // Client plugin doesn't use server SSL sockets, and so SSLServerSocket |
| // implementation is not compiled for NaCl as part of net_nacl. |
| NOTREACHED(); |
| - result = net::ERR_FAILED; |
| #else |
| scoped_refptr<net::X509Certificate> cert = |
| net::X509Certificate::CreateFromBytes( |
| @@ -228,9 +221,30 @@ void SslHmacChannelAuthenticator::SecureAndAuthenticate( |
| net::SSLServerConfig ssl_config; |
| ssl_config.require_ecdhe = true; |
| - scoped_ptr<net::SSLServerSocket> server_socket = net::CreateSSLServerSocket( |
| - make_scoped_ptr(new NetStreamSocketAdapter(std::move(socket))), |
| + server_context_ = net::CreateSSLServerContext( |
| cert.get(), *local_key_pair_->private_key(), ssl_config); |
| +#endif |
| + } |
| +} |
| + |
| +void SslHmacChannelAuthenticator::SecureAndAuthenticate( |
|
davidben
2016/02/24 21:01:26
It looks like this only gets called once[*] for ea
ryanchung
2016/02/25 00:46:39
Done.
|
| + scoped_ptr<P2PStreamSocket> socket, |
| + const DoneCallback& done_callback) { |
| + DCHECK(CalledOnValidThread()); |
| + |
| + done_callback_ = done_callback; |
| + |
| + int result; |
| + if (is_ssl_server()) { |
| +#if defined(OS_NACL) |
| + // Client plugin doesn't use server SSL sockets, and so SSLServerSocket |
| + // implementation is not compiled for NaCl as part of net_nacl. |
| + NOTREACHED(); |
| + result = net::ERR_FAILED; |
| +#else |
| + scoped_ptr<net::SSLServerSocket> server_socket = |
| + server_context_->CreateSSLServerSocket( |
| + make_scoped_ptr(new NetStreamSocketAdapter(std::move(socket)))); |
| net::SSLServerSocket* raw_server_socket = server_socket.get(); |
| socket_ = std::move(server_socket); |
| result = raw_server_socket->Handshake( |