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

Unified Diff: remoting/protocol/authentication_method.cc

Issue 14793021: PairingAuthenticator implementation and plumbing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang errors. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/authentication_method.h ('k') | remoting/protocol/authenticator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/authentication_method.cc
diff --git a/remoting/protocol/authentication_method.cc b/remoting/protocol/authentication_method.cc
index 71ec00880a9a88fecbca5d33c440f5e80572b59e..e584efc4c6e37f8cbf3fc79e37d6bfab82c81d4e 100644
--- a/remoting/protocol/authentication_method.cc
+++ b/remoting/protocol/authentication_method.cc
@@ -23,6 +23,11 @@ AuthenticationMethod AuthenticationMethod::Spake2(HashFunction hash_function) {
}
// static
+AuthenticationMethod AuthenticationMethod::Spake2Pair() {
+ return AuthenticationMethod(SPAKE2_PAIR, HMAC_SHA256);
+}
+
+// static
AuthenticationMethod AuthenticationMethod::ThirdParty() {
return AuthenticationMethod(THIRD_PARTY, NONE);
}
@@ -30,7 +35,9 @@ AuthenticationMethod AuthenticationMethod::ThirdParty() {
// static
AuthenticationMethod AuthenticationMethod::FromString(
const std::string& value) {
- if (value == "spake2_plain") {
+ if (value == "spake2_pair") {
+ return Spake2Pair();
+ } else if (value == "spake2_plain") {
return Spake2(NONE);
} else if (value == "spake2_hmac") {
return Spake2(HMAC_SHA256);
@@ -90,16 +97,25 @@ AuthenticationMethod::HashFunction AuthenticationMethod::hash_function() const {
const std::string AuthenticationMethod::ToString() const {
DCHECK(is_valid());
- if (type_ == THIRD_PARTY)
- return "third_party";
+ switch (type_) {
+ case INVALID:
+ NOTREACHED();
+ break;
+
+ case SPAKE2_PAIR:
+ return "spake2_pair";
- DCHECK_EQ(type_, SPAKE2);
+ case SPAKE2:
+ switch (hash_function_) {
+ case NONE:
+ return "spake2_plain";
+ case HMAC_SHA256:
+ return "spake2_hmac";
+ }
+ break;
- switch (hash_function_) {
- case NONE:
- return "spake2_plain";
- case HMAC_SHA256:
- return "spake2_hmac";
+ case THIRD_PARTY:
+ return "third_party";
}
return "invalid";
« no previous file with comments | « remoting/protocol/authentication_method.h ('k') | remoting/protocol/authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698