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 7e45acd281152d4bc443be5a7d149ebf65f01fe3..d85ad5f17ed99db39f6e5c9755e35fdf114bacd2 100644 |
--- a/remoting/protocol/ssl_hmac_channel_authenticator.cc |
+++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc |
@@ -15,6 +15,7 @@ |
#include "net/socket/client_socket_factory.h" |
#include "net/socket/client_socket_handle.h" |
#include "net/socket/ssl_client_socket.h" |
+#include "net/socket/ssl_client_socket_openssl.h" |
#include "net/socket/ssl_server_socket.h" |
#include "net/ssl/ssl_config_service.h" |
#include "remoting/base/rsa_key_pair.h" |
@@ -63,6 +64,12 @@ void SslHmacChannelAuthenticator::SecureAndAuthenticate( |
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_refptr<net::X509Certificate> cert = |
net::X509Certificate::CreateFromBytes( |
local_cert_.data(), local_cert_.length()); |
@@ -85,6 +92,7 @@ void SslHmacChannelAuthenticator::SecureAndAuthenticate( |
result = raw_server_socket->Handshake( |
base::Bind(&SslHmacChannelAuthenticator::OnConnected, |
base::Unretained(this))); |
+#endif |
} else { |
transport_security_state_.reset(new net::TransportSecurityState); |
@@ -104,11 +112,19 @@ void SslHmacChannelAuthenticator::SecureAndAuthenticate( |
net::HostPortPair host_and_port(kSslFakeHostName, 0); |
net::SSLClientSocketContext context; |
context.transport_security_state = transport_security_state_.get(); |
- scoped_ptr<net::ClientSocketHandle> connection(new net::ClientSocketHandle); |
- connection->SetSocket(socket.Pass()); |
+ scoped_ptr<net::ClientSocketHandle> socket_handle( |
+ new net::ClientSocketHandle); |
+ socket_handle->SetSocket(socket.Pass()); |
+ |
+#if defined(OS_NACL) |
+ // net_nacl doesn't include ClientSocketFactory. |
+ socket_.reset(new net::SSLClientSocketOpenSSL( |
+ socket_handle.Pass(), host_and_port, ssl_config, context)); |
+#else |
socket_ = |
net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( |
- connection.Pass(), host_and_port, ssl_config, context); |
+ socket_handle.Pass(), host_and_port, ssl_config, context); |
+#endif |
result = socket_->Connect( |
base::Bind(&SslHmacChannelAuthenticator::OnConnected, |