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

Unified Diff: remoting/protocol/negotiating_client_authenticator.cc

Issue 1800823002: Add Curve25519 version of pairing authenticators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/negotiating_client_authenticator.cc
diff --git a/remoting/protocol/negotiating_client_authenticator.cc b/remoting/protocol/negotiating_client_authenticator.cc
index 0d6751792e9cd8b1512b6db9075dd8ce215b20ff..d82312e37a627d7e75df475ca530f56bb2e09098 100644
--- a/remoting/protocol/negotiating_client_authenticator.cc
+++ b/remoting/protocol/negotiating_client_authenticator.cc
@@ -36,6 +36,7 @@ NegotiatingClientAuthenticator::NegotiatingClientAuthenticator(
AddMethod(Method::THIRD_PARTY_SPAKE2_P224);
}
+ AddMethod(Method::PAIRED_SPAKE2_CURVE25519);
AddMethod(Method::PAIRED_SPAKE2_P224);
AddMethod(Method::SHARED_SECRET_SPAKE2_CURVE25519);
@@ -124,33 +125,55 @@ void NegotiatingClientAuthenticator::CreateAuthenticatorForCurrentMethod(
const base::Closure& resume_callback) {
DCHECK_EQ(state(), PROCESSING_MESSAGE);
DCHECK(current_method_ != Method::INVALID);
- if (current_method_ == Method::THIRD_PARTY_SPAKE2_P224) {
- current_authenticator_.reset(new ThirdPartyClientAuthenticator(
- base::Bind(&V2Authenticator::CreateForClient),
- config_.fetch_third_party_token_callback));
- resume_callback.Run();
- } else if (current_method_ == Method::THIRD_PARTY_SPAKE2_CURVE25519) {
- current_authenticator_.reset(new ThirdPartyClientAuthenticator(
- base::Bind(&Spake2Authenticator::CreateForClient, local_id_,
- remote_id_),
- config_.fetch_third_party_token_callback));
- resume_callback.Run();
- } else if (current_method_ == Method::PAIRED_SPAKE2_P224) {
- PairingClientAuthenticator* pairing_authenticator =
- new PairingClientAuthenticator(
- config_, base::Bind(&V2Authenticator::CreateForClient));
- current_authenticator_ = make_scoped_ptr(pairing_authenticator);
- pairing_authenticator->Start(preferred_initial_state, resume_callback);
- } else {
- DCHECK(current_method_ == Method::SHARED_SECRET_PLAIN_SPAKE2_P224 ||
- current_method_ == Method::SHARED_SECRET_SPAKE2_P224 ||
- current_method_ == Method::SHARED_SECRET_SPAKE2_CURVE25519);
- config_.fetch_secret_callback.Run(
- false,
- base::Bind(
- &NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator,
- weak_factory_.GetWeakPtr(), preferred_initial_state,
- resume_callback));
+ switch (current_method_) {
+ case Method::INVALID:
+ NOTREACHED();
+ break;
+
+ case Method::THIRD_PARTY_SPAKE2_P224:
+ current_authenticator_.reset(new ThirdPartyClientAuthenticator(
+ base::Bind(&V2Authenticator::CreateForClient),
+ config_.fetch_third_party_token_callback));
+ resume_callback.Run();
+ break;
+
+ case Method::THIRD_PARTY_SPAKE2_CURVE25519:
+ current_authenticator_.reset(new ThirdPartyClientAuthenticator(
+ base::Bind(&Spake2Authenticator::CreateForClient, local_id_,
+ remote_id_),
+ config_.fetch_third_party_token_callback));
+ resume_callback.Run();
+ break;
+
+ case Method::PAIRED_SPAKE2_P224: {
+ PairingClientAuthenticator* pairing_authenticator =
+ new PairingClientAuthenticator(
+ config_, base::Bind(&V2Authenticator::CreateForClient));
+ current_authenticator_ = make_scoped_ptr(pairing_authenticator);
+ pairing_authenticator->Start(preferred_initial_state, resume_callback);
+ break;
+ }
+
+ case Method::PAIRED_SPAKE2_CURVE25519: {
+ PairingClientAuthenticator* pairing_authenticator =
+ new PairingClientAuthenticator(
+ config_, base::Bind(&Spake2Authenticator::CreateForClient,
+ local_id_, remote_id_));
+ current_authenticator_ = make_scoped_ptr(pairing_authenticator);
+ pairing_authenticator->Start(preferred_initial_state, resume_callback);
+ break;
+ }
+
+ case Method::SHARED_SECRET_PLAIN_SPAKE2_P224:
+ case Method::SHARED_SECRET_SPAKE2_P224:
+ case Method::SHARED_SECRET_SPAKE2_CURVE25519:
+ config_.fetch_secret_callback.Run(
+ false,
+ base::Bind(
+ &NegotiatingClientAuthenticator::CreateSharedSecretAuthenticator,
+ weak_factory_.GetWeakPtr(), preferred_initial_state,
+ resume_callback));
+ break;
}
}
« 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