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 "crypto/secure_util.h" | 9 #include "crypto/secure_util.h" |
10 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 return crypto::SecureMemEqual(received_auth_bytes.data(), | 273 return crypto::SecureMemEqual(received_auth_bytes.data(), |
274 &(auth_bytes[0]), kAuthDigestLength); | 274 &(auth_bytes[0]), kAuthDigestLength); |
275 } | 275 } |
276 | 276 |
277 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { | 277 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { |
278 if (auth_write_buf_.get() == NULL && auth_read_buf_.get() == NULL) { | 278 if (auth_write_buf_.get() == NULL && auth_read_buf_.get() == NULL) { |
279 DCHECK(socket_.get() != NULL); | 279 DCHECK(socket_.get() != NULL); |
280 if (callback_called) | 280 if (callback_called) |
281 *callback_called = true; | 281 *callback_called = true; |
282 | 282 done_callback_.Run(net::OK, socket_.PassAs<net::StreamSocket>()); |
283 CallDoneCallback(net::OK, socket_.PassAs<net::StreamSocket>()); | |
284 } | 283 } |
285 } | 284 } |
286 | 285 |
287 void SslHmacChannelAuthenticator::NotifyError(int error) { | 286 void SslHmacChannelAuthenticator::NotifyError(int error) { |
288 CallDoneCallback(error, scoped_ptr<net::StreamSocket>()); | 287 done_callback_.Run(static_cast<net::Error>(error), |
289 } | 288 scoped_ptr<net::StreamSocket>()); |
290 | |
291 void SslHmacChannelAuthenticator::CallDoneCallback( | |
292 int error, | |
293 scoped_ptr<net::StreamSocket> socket) { | |
294 DoneCallback callback = done_callback_; | |
295 done_callback_.Reset(); | |
296 callback.Run(error, socket.Pass()); | |
297 } | 289 } |
298 | 290 |
299 } // namespace protocol | 291 } // namespace protocol |
300 } // namespace remoting | 292 } // namespace remoting |
OLD | NEW |