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

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

Issue 1799293002: Remove spake2_plain authentication method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pair_spake
Patch Set: Created 4 years, 9 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 23 matching lines...) Expand all
34 if (!config_.fetch_third_party_token_callback.is_null()) { 34 if (!config_.fetch_third_party_token_callback.is_null()) {
35 AddMethod(Method::THIRD_PARTY_SPAKE2_CURVE25519); 35 AddMethod(Method::THIRD_PARTY_SPAKE2_CURVE25519);
36 AddMethod(Method::THIRD_PARTY_SPAKE2_P224); 36 AddMethod(Method::THIRD_PARTY_SPAKE2_P224);
37 } 37 }
38 38
39 AddMethod(Method::PAIRED_SPAKE2_CURVE25519); 39 AddMethod(Method::PAIRED_SPAKE2_CURVE25519);
40 AddMethod(Method::PAIRED_SPAKE2_P224); 40 AddMethod(Method::PAIRED_SPAKE2_P224);
41 41
42 AddMethod(Method::SHARED_SECRET_SPAKE2_CURVE25519); 42 AddMethod(Method::SHARED_SECRET_SPAKE2_CURVE25519);
43 AddMethod(Method::SHARED_SECRET_SPAKE2_P224); 43 AddMethod(Method::SHARED_SECRET_SPAKE2_P224);
44
45 AddMethod(Method::SHARED_SECRET_PLAIN_SPAKE2_P224);
46 } 44 }
47 45
48 NegotiatingClientAuthenticator::~NegotiatingClientAuthenticator() {} 46 NegotiatingClientAuthenticator::~NegotiatingClientAuthenticator() {}
49 47
50 void NegotiatingClientAuthenticator::ProcessMessage( 48 void NegotiatingClientAuthenticator::ProcessMessage(
51 const buzz::XmlElement* message, 49 const buzz::XmlElement* message,
52 const base::Closure& resume_callback) { 50 const base::Closure& resume_callback) {
53 DCHECK_EQ(state(), WAITING_MESSAGE); 51 DCHECK_EQ(state(), WAITING_MESSAGE);
54 state_ = PROCESSING_MESSAGE; 52 state_ = PROCESSING_MESSAGE;
55 53
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 case Method::PAIRED_SPAKE2_CURVE25519: { 155 case Method::PAIRED_SPAKE2_CURVE25519: {
158 PairingClientAuthenticator* pairing_authenticator = 156 PairingClientAuthenticator* pairing_authenticator =
159 new PairingClientAuthenticator( 157 new PairingClientAuthenticator(
160 config_, base::Bind(&Spake2Authenticator::CreateForClient, 158 config_, base::Bind(&Spake2Authenticator::CreateForClient,
161 local_id_, remote_id_)); 159 local_id_, remote_id_));
162 current_authenticator_ = make_scoped_ptr(pairing_authenticator); 160 current_authenticator_ = make_scoped_ptr(pairing_authenticator);
163 pairing_authenticator->Start(preferred_initial_state, resume_callback); 161 pairing_authenticator->Start(preferred_initial_state, resume_callback);
164 break; 162 break;
165 } 163 }
166 164
167 case Method::SHARED_SECRET_PLAIN_SPAKE2_P224:
168 case Method::SHARED_SECRET_SPAKE2_P224: 165 case Method::SHARED_SECRET_SPAKE2_P224:
169 case Method::SHARED_SECRET_SPAKE2_CURVE25519: 166 case Method::SHARED_SECRET_SPAKE2_CURVE25519:
170 config_.fetch_secret_callback.Run( 167 config_.fetch_secret_callback.Run(
171 false, 168 false,
172 base::Bind( 169 base::Bind(
173 &NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator, 170 &NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator,
174 weak_factory_.GetWeakPtr(), preferred_initial_state, 171 weak_factory_.GetWeakPtr(), preferred_initial_state,
175 resume_callback)); 172 resume_callback));
176 break; 173 break;
177 } 174 }
(...skipping 10 matching lines...) Expand all
188 pairing_authenticator->StartPaired(MESSAGE_READY); 185 pairing_authenticator->StartPaired(MESSAGE_READY);
189 current_method_ = Method::PAIRED_SPAKE2_P224; 186 current_method_ = Method::PAIRED_SPAKE2_P224;
190 } 187 }
191 } 188 }
192 189
193 void NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator( 190 void NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator(
194 Authenticator::State initial_state, 191 Authenticator::State initial_state,
195 const base::Closure& resume_callback, 192 const base::Closure& resume_callback,
196 const std::string& shared_secret) { 193 const std::string& shared_secret) {
197 std::string shared_secret_hash = 194 std::string shared_secret_hash =
198 (current_method_ == Method::SHARED_SECRET_PLAIN_SPAKE2_P224) 195 GetSharedSecretHash(config_.host_id, shared_secret);
199 ? shared_secret
200 : GetSharedSecretHash(config_.host_id, shared_secret);
201
202 if (current_method_ == Method::SHARED_SECRET_SPAKE2_CURVE25519) { 196 if (current_method_ == Method::SHARED_SECRET_SPAKE2_CURVE25519) {
203 current_authenticator_ = Spake2Authenticator::CreateForClient( 197 current_authenticator_ = Spake2Authenticator::CreateForClient(
204 local_id_, remote_id_, shared_secret_hash, initial_state); 198 local_id_, remote_id_, shared_secret_hash, initial_state);
205 } else { 199 } else {
206 current_authenticator_ = 200 current_authenticator_ =
207 V2Authenticator::CreateForClient(shared_secret_hash, initial_state); 201 V2Authenticator::CreateForClient(shared_secret_hash, initial_state);
208 } 202 }
209 resume_callback.Run(); 203 resume_callback.Run();
210 } 204 }
211 205
212 bool NegotiatingClientAuthenticator::is_paired() { 206 bool NegotiatingClientAuthenticator::is_paired() {
213 return !config_.pairing_client_id.empty() && !config_.pairing_secret.empty(); 207 return !config_.pairing_client_id.empty() && !config_.pairing_secret.empty();
214 } 208 }
215 209
216 } // namespace protocol 210 } // namespace protocol
217 } // namespace remoting 211 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/negotiating_authenticator_unittest.cc ('k') | remoting/protocol/negotiating_host_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698