Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: remoting/protocol/negotiating_client_authenticator.cc

Issue 1944553002: Fix IT2Me protocol error connecting to old hosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer feedback. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/negotiating_client_authenticator.h" 5 #include "remoting/protocol/negotiating_client_authenticator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 24 matching lines...) Expand all
35 if (!config_.fetch_third_party_token_callback.is_null()) { 35 if (!config_.fetch_third_party_token_callback.is_null()) {
36 AddMethod(Method::THIRD_PARTY_SPAKE2_CURVE25519); 36 AddMethod(Method::THIRD_PARTY_SPAKE2_CURVE25519);
37 AddMethod(Method::THIRD_PARTY_SPAKE2_P224); 37 AddMethod(Method::THIRD_PARTY_SPAKE2_P224);
38 } 38 }
39 39
40 AddMethod(Method::PAIRED_SPAKE2_CURVE25519); 40 AddMethod(Method::PAIRED_SPAKE2_CURVE25519);
41 AddMethod(Method::PAIRED_SPAKE2_P224); 41 AddMethod(Method::PAIRED_SPAKE2_P224);
42 42
43 AddMethod(Method::SHARED_SECRET_SPAKE2_CURVE25519); 43 AddMethod(Method::SHARED_SECRET_SPAKE2_CURVE25519);
44 AddMethod(Method::SHARED_SECRET_SPAKE2_P224); 44 AddMethod(Method::SHARED_SECRET_SPAKE2_P224);
45
46 AddMethod(Method::SHARED_SECRET_PLAIN_SPAKE2_P224);
45 } 47 }
46 48
47 NegotiatingClientAuthenticator::~NegotiatingClientAuthenticator() {} 49 NegotiatingClientAuthenticator::~NegotiatingClientAuthenticator() {}
48 50
49 void NegotiatingClientAuthenticator::ProcessMessage( 51 void NegotiatingClientAuthenticator::ProcessMessage(
50 const buzz::XmlElement* message, 52 const buzz::XmlElement* message,
51 const base::Closure& resume_callback) { 53 const base::Closure& resume_callback) {
52 DCHECK_EQ(state(), WAITING_MESSAGE); 54 DCHECK_EQ(state(), WAITING_MESSAGE);
53 state_ = PROCESSING_MESSAGE; 55 state_ = PROCESSING_MESSAGE;
54 56
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 case Method::PAIRED_SPAKE2_CURVE25519: { 159 case Method::PAIRED_SPAKE2_CURVE25519: {
158 PairingClientAuthenticator* pairing_authenticator = 160 PairingClientAuthenticator* pairing_authenticator =
159 new PairingClientAuthenticator( 161 new PairingClientAuthenticator(
160 config_, base::Bind(&Spake2Authenticator::CreateForClient, 162 config_, base::Bind(&Spake2Authenticator::CreateForClient,
161 local_id_, remote_id_)); 163 local_id_, remote_id_));
162 current_authenticator_ = base::WrapUnique(pairing_authenticator); 164 current_authenticator_ = base::WrapUnique(pairing_authenticator);
163 pairing_authenticator->Start(preferred_initial_state, resume_callback); 165 pairing_authenticator->Start(preferred_initial_state, resume_callback);
164 break; 166 break;
165 } 167 }
166 168
169 case Method::SHARED_SECRET_PLAIN_SPAKE2_P224:
167 case Method::SHARED_SECRET_SPAKE2_P224: 170 case Method::SHARED_SECRET_SPAKE2_P224:
168 case Method::SHARED_SECRET_SPAKE2_CURVE25519: 171 case Method::SHARED_SECRET_SPAKE2_CURVE25519:
169 config_.fetch_secret_callback.Run( 172 config_.fetch_secret_callback.Run(
170 false, 173 false,
171 base::Bind( 174 base::Bind(
172 &NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator, 175 &NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator,
173 weak_factory_.GetWeakPtr(), preferred_initial_state, 176 weak_factory_.GetWeakPtr(), preferred_initial_state,
174 resume_callback)); 177 resume_callback));
175 break; 178 break;
176 } 179 }
(...skipping 10 matching lines...) Expand all
187 pairing_authenticator->StartPaired(MESSAGE_READY); 190 pairing_authenticator->StartPaired(MESSAGE_READY);
188 current_method_ = Method::PAIRED_SPAKE2_P224; 191 current_method_ = Method::PAIRED_SPAKE2_P224;
189 } 192 }
190 } 193 }
191 194
192 void NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator( 195 void NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator(
193 Authenticator::State initial_state, 196 Authenticator::State initial_state,
194 const base::Closure& resume_callback, 197 const base::Closure& resume_callback,
195 const std::string& shared_secret) { 198 const std::string& shared_secret) {
196 std::string shared_secret_hash = 199 std::string shared_secret_hash =
197 GetSharedSecretHash(config_.host_id, shared_secret); 200 (current_method_ == Method::SHARED_SECRET_PLAIN_SPAKE2_P224)
201 ? shared_secret
202 : GetSharedSecretHash(config_.host_id, shared_secret);
203
198 if (current_method_ == Method::SHARED_SECRET_SPAKE2_CURVE25519) { 204 if (current_method_ == Method::SHARED_SECRET_SPAKE2_CURVE25519) {
199 current_authenticator_ = Spake2Authenticator::CreateForClient( 205 current_authenticator_ = Spake2Authenticator::CreateForClient(
200 local_id_, remote_id_, shared_secret_hash, initial_state); 206 local_id_, remote_id_, shared_secret_hash, initial_state);
201 } else { 207 } else {
202 current_authenticator_ = 208 current_authenticator_ =
203 V2Authenticator::CreateForClient(shared_secret_hash, initial_state); 209 V2Authenticator::CreateForClient(shared_secret_hash, initial_state);
204 } 210 }
205 resume_callback.Run(); 211 resume_callback.Run();
206 } 212 }
207 213
208 bool NegotiatingClientAuthenticator::is_paired() { 214 bool NegotiatingClientAuthenticator::is_paired() {
209 return !config_.pairing_client_id.empty() && !config_.pairing_secret.empty(); 215 return !config_.pairing_client_id.empty() && !config_.pairing_secret.empty();
210 } 216 }
211 217
212 } // namespace protocol 218 } // namespace protocol
213 } // namespace remoting 219 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/negotiating_authenticator_base.cc ('k') | remoting/protocol/negotiating_host_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698