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

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: 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
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..fab7053ba56f078f0e13719ea4979bc568ff7e63 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 (GetPinHash(host_id_, pin) == host_secret_hash_);
Wez 2012/04/30 23:13:57 IsPinValid() in http://codereview.chromium.org/101
simonmorris 2012/05/01 00:25:55 Done.
}
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698