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

Unified Diff: remoting/protocol/authentication_method.cc

Issue 1768383004: Cleanup AuthenticatorMethod usage. (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
« no previous file with comments | « remoting/protocol/authentication_method.h ('k') | remoting/protocol/me2me_host_authenticator_factory.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
deleted file mode 100644
index f78b0db76ae0a2f3ec15f1940993c3bce7f09e51..0000000000000000000000000000000000000000
--- a/remoting/protocol/authentication_method.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/protocol/authentication_method.h"
-
-#include "base/logging.h"
-#include "crypto/hmac.h"
-#include "remoting/protocol/auth_util.h"
-#include "remoting/protocol/name_value_map.h"
-
-namespace remoting {
-namespace protocol {
-
-const NameMapElement<AuthenticationMethod> kAuthenticationMethodStrings[] = {
- {AuthenticationMethod::SPAKE2_SHARED_SECRET_PLAIN, "spake2_plain"},
- {AuthenticationMethod::SPAKE2_SHARED_SECRET_HMAC, "spake2_hmac"},
- {AuthenticationMethod::SPAKE2_PAIR, "spake2_pair"},
- {AuthenticationMethod::THIRD_PARTY, "third_party"}};
-
-AuthenticationMethod ParseAuthenticationMethodString(const std::string& value) {
- AuthenticationMethod result;
- if (!NameToValue(kAuthenticationMethodStrings, value, &result))
- return AuthenticationMethod::INVALID;
- return result;
-}
-
-const std::string AuthenticationMethodToString(
- AuthenticationMethod method) {
- return ValueToName(kAuthenticationMethodStrings, method);
-}
-
-HashFunction GetHashFunctionForAuthenticationMethod(
- AuthenticationMethod method) {
- switch (method) {
- case AuthenticationMethod::INVALID:
- NOTREACHED();
- return HashFunction::NONE;
-
- case AuthenticationMethod::SPAKE2_SHARED_SECRET_PLAIN:
- case AuthenticationMethod::THIRD_PARTY:
- return HashFunction::NONE;
-
- case AuthenticationMethod::SPAKE2_SHARED_SECRET_HMAC:
- case AuthenticationMethod::SPAKE2_PAIR:
- return HashFunction::HMAC_SHA256;
- }
-
- NOTREACHED();
- return HashFunction::NONE;
-}
-
-std::string ApplySharedSecretHashFunction(HashFunction hash_function,
- const std::string& tag,
- const std::string& shared_secret) {
- switch (hash_function) {
- case HashFunction::NONE:
- return shared_secret;
-
- case HashFunction::HMAC_SHA256: {
- crypto::HMAC response(crypto::HMAC::SHA256);
- if (!response.Init(tag)) {
- LOG(FATAL) << "HMAC::Init failed";
- }
-
- unsigned char out_bytes[kSharedSecretHashLength];
- if (!response.Sign(shared_secret, out_bytes, sizeof(out_bytes))) {
- LOG(FATAL) << "HMAC::Sign failed";
- }
-
- return std::string(out_bytes, out_bytes + sizeof(out_bytes));
- }
- }
-
- NOTREACHED();
- return shared_secret;
-}
-
-} // namespace protocol
-} // namespace remoting
« no previous file with comments | « remoting/protocol/authentication_method.h ('k') | remoting/protocol/me2me_host_authenticator_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698