| OLD | NEW |
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "crypto/secure_util.h" | 11 #include "crypto/secure_util.h" |
| 11 #include "net/base/host_port_pair.h" | 12 #include "net/base/host_port_pair.h" |
| 12 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 14 #include "net/cert/cert_status_flags.h" | 15 #include "net/cert/cert_status_flags.h" |
| 15 #include "net/cert/cert_verifier.h" | 16 #include "net/cert/cert_verifier.h" |
| 16 #include "net/cert/x509_certificate.h" | 17 #include "net/cert/x509_certificate.h" |
| 17 #include "net/http/transport_security_state.h" | 18 #include "net/http/transport_security_state.h" |
| 18 #include "net/socket/client_socket_factory.h" | 19 #include "net/socket/client_socket_factory.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 return crypto::SecureMemEqual(received_auth_bytes.data(), | 307 return crypto::SecureMemEqual(received_auth_bytes.data(), |
| 307 &(auth_bytes[0]), kAuthDigestLength); | 308 &(auth_bytes[0]), kAuthDigestLength); |
| 308 } | 309 } |
| 309 | 310 |
| 310 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { | 311 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { |
| 311 if (auth_write_buf_.get() == nullptr && auth_read_buf_.get() == nullptr) { | 312 if (auth_write_buf_.get() == nullptr && auth_read_buf_.get() == nullptr) { |
| 312 DCHECK(socket_.get() != nullptr); | 313 DCHECK(socket_.get() != nullptr); |
| 313 if (callback_called) | 314 if (callback_called) |
| 314 *callback_called = true; | 315 *callback_called = true; |
| 315 | 316 |
| 316 CallDoneCallback(net::OK, socket_.Pass()); | 317 base::ResetAndReturn(&done_callback_).Run(net::OK, socket_.Pass()); |
| 317 } | 318 } |
| 318 } | 319 } |
| 319 | 320 |
| 320 void SslHmacChannelAuthenticator::NotifyError(int error) { | 321 void SslHmacChannelAuthenticator::NotifyError(int error) { |
| 321 CallDoneCallback(error, nullptr); | 322 base::ResetAndReturn(&done_callback_).Run(error, nullptr); |
| 322 } | |
| 323 | |
| 324 void SslHmacChannelAuthenticator::CallDoneCallback( | |
| 325 int error, | |
| 326 scoped_ptr<net::StreamSocket> socket) { | |
| 327 DoneCallback callback = done_callback_; | |
| 328 done_callback_.Reset(); | |
| 329 callback.Run(error, socket.Pass()); | |
| 330 } | 323 } |
| 331 | 324 |
| 332 } // namespace protocol | 325 } // namespace protocol |
| 333 } // namespace remoting | 326 } // namespace remoting |
| OLD | NEW |