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

Unified Diff: remoting/host/verify_config_window_win.cc

Issue 10243011: [Chromoting] Factor out common code for pin hashing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 8 years, 8 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/host/plugin/host_script_object.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/verify_config_window_win.cc
diff --git a/remoting/host/verify_config_window_win.cc b/remoting/host/verify_config_window_win.cc
index d2e695ff1c40868c1275608550a553040bf06433..39c6a4a28c2befb30b7795bae82bad9c12758bb7 100644
--- a/remoting/host/verify_config_window_win.cc
+++ b/remoting/host/verify_config_window_win.cc
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/utf_string_conversions.h"
#include "remoting/host/elevated_controller_resource.h"
+#include "remoting/host/pin_hash.h"
#include "remoting/protocol/authentication_method.h"
namespace remoting {
@@ -117,21 +118,8 @@ bool VerifyConfigWindowWin::VerifyHostSecretHash() {
HWND hwndPin = GetDlgItem(hwnd_, IDC_PIN);
CHECK(hwndPin);
GetWindowText(hwndPin, pinWSTR.get(), kMaxPinLength);
-
- // TODO(simonmorris): This code was copied from host_script_object.cc.
- // Refactor to use PinIsValid(), from CL 10008092.
std::string pin(UTF16ToUTF8(pinWSTR.get()));
- std::string hash = protocol::AuthenticationMethod::ApplyHashFunction(
- protocol::AuthenticationMethod::HMAC_SHA256, host_id_, pin);
- std::string hash_base64;
- bool base64_result = base::Base64Encode(hash, &hash_base64);
- if (!base64_result) {
- LOG(FATAL) << "Base64Encode failed";
- return false;
- }
- hash_base64 = "hmac:" + hash_base64;
-
- return (hash_base64 == host_secret_hash_);
+ return VerifyHostPinHash(host_secret_hash_, host_id_, pin);
}
} // namespace remoting
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698