Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / remoting / protocol / v2_authenticator.cc
index ee5c9d1..37652a2 100644 (file)
@@ -9,7 +9,7 @@
 #include "remoting/base/constants.h"
 #include "remoting/base/rsa_key_pair.h"
 #include "remoting/protocol/ssl_hmac_channel_authenticator.h"
-#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
+#include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
 
 using crypto::P224EncryptedKeyExchange;
 
@@ -38,7 +38,7 @@ bool V2Authenticator::IsEkeMessage(const buzz::XmlElement* message) {
 scoped_ptr<Authenticator> V2Authenticator::CreateForClient(
     const std::string& shared_secret,
     Authenticator::State initial_state) {
-  return scoped_ptr<Authenticator>(new V2Authenticator(
+  return make_scoped_ptr(new V2Authenticator(
       P224EncryptedKeyExchange::kPeerTypeClient, shared_secret, initial_state));
 }
 
@@ -52,7 +52,7 @@ scoped_ptr<Authenticator> V2Authenticator::CreateForHost(
       P224EncryptedKeyExchange::kPeerTypeServer, shared_secret, initial_state));
   result->local_cert_ = local_cert;
   result->local_key_pair_ = key_pair;
-  return scoped_ptr<Authenticator>(result.Pass());
+  return result.Pass();
 }
 
 V2Authenticator::V2Authenticator(
@@ -62,6 +62,7 @@ V2Authenticator::V2Authenticator(
     : certificate_sent_(false),
       key_exchange_impl_(type, shared_secret),
       state_(initial_state),
+      started_(false),
       rejection_reason_(INVALID_CREDENTIALS) {
   pending_messages_.push(key_exchange_impl_.GetMessage());
 }
@@ -75,6 +76,10 @@ Authenticator::State V2Authenticator::state() const {
   return state_;
 }
 
+bool V2Authenticator::started() const {
+  return started_;
+}
+
 Authenticator::RejectionReason V2Authenticator::rejection_reason() const {
   DCHECK_EQ(state(), REJECTED);
   return rejection_reason_;
@@ -127,6 +132,7 @@ void V2Authenticator::ProcessMessageInternal(const buzz::XmlElement* message) {
 
     P224EncryptedKeyExchange::Result result =
         key_exchange_impl_.ProcessMessage(spake_message);
+    started_ = true;
     switch (result) {
       case P224EncryptedKeyExchange::kResultPending:
         pending_messages_.push(key_exchange_impl_.GetMessage());
@@ -143,7 +149,6 @@ void V2Authenticator::ProcessMessageInternal(const buzz::XmlElement* message) {
         return;
     }
   }
-
   state_ = MESSAGE_READY;
 }
 
@@ -186,13 +191,11 @@ V2Authenticator::CreateChannelAuthenticator() const {
   CHECK(!auth_key_.empty());
 
   if (is_host_side()) {
-    return scoped_ptr<ChannelAuthenticator>(
-        SslHmacChannelAuthenticator::CreateForHost(
-            local_cert_, local_key_pair_, auth_key_).Pass());
+    return SslHmacChannelAuthenticator::CreateForHost(
+        local_cert_, local_key_pair_, auth_key_);
   } else {
-    return scoped_ptr<ChannelAuthenticator>(
-        SslHmacChannelAuthenticator::CreateForClient(
-            remote_cert_, auth_key_).Pass());
+    return SslHmacChannelAuthenticator::CreateForClient(
+        remote_cert_, auth_key_);
   }
 }