Chromium Code Reviews| Index: remoting/protocol/authentication_method.cc |
| diff --git a/remoting/protocol/authentication_method.cc b/remoting/protocol/authentication_method.cc |
| index 71ec00880a9a88fecbca5d33c440f5e80572b59e..93f3a493bdf6303e9b1958db77ec6f912794f615 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); |
|
Sergey Ulanov
2013/05/17 01:57:17
Do we really need to hash the secret? I think we c
rmsousa
2013/05/17 20:09:03
There are some cases where this falls back to the
Jamie
2013/05/21 01:24:33
I've left it as HMAC_SHA256, for the reason Renato
|
| +} |
| + |
| +// 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,24 @@ 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: |
|
Sergey Ulanov
2013/05/17 01:57:17
This is not necessary - there is DCHECK on top. Ma
Jamie
2013/05/21 01:24:33
The compiler complains if it's not handled. NOTREA
|
| + 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"; |