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

Unified Diff: chrome/browser/chromeos/login/managed/managed_user_authenticator.cc

Issue 296773002: Add a Key class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 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
Index: chrome/browser/chromeos/login/managed/managed_user_authenticator.cc
diff --git a/chrome/browser/chromeos/login/managed/managed_user_authenticator.cc b/chrome/browser/chromeos/login/managed/managed_user_authenticator.cc
index 130999d6b590cee4baa4ec0e9e4d58c454b86543..515479f4ab1e9ab1501fca0138ce57ada865a6aa 100644
--- a/chrome/browser/chromeos/login/managed/managed_user_authenticator.cc
+++ b/chrome/browser/chromeos/login/managed/managed_user_authenticator.cc
@@ -8,7 +8,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "chrome/browser/chromeos/boot_times_loader.h"
-#include "chrome/browser/chromeos/login/auth/parallel_authenticator.h"
+#include "chrome/browser/chromeos/login/auth/key.h"
#include "chromeos/cryptohome/async_method_caller.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
#include "chromeos/cryptohome/system_salt_getter.h"
@@ -64,9 +64,12 @@ void Mount(ManagedUserAuthenticator::AuthAttempt* attempt,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
"CryptohomeMount-LMU-Start", false);
+
+ Key key(attempt->password);
+ key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
cryptohome::AsyncMethodCaller::GetInstance()->AsyncMount(
attempt->username,
- ParallelAuthenticator::HashPassword(attempt->password, system_salt),
+ key.GetSecret(),
flags,
base::Bind(&TriggerResolveWithLoginTimeMarker,
"CryptohomeMount-LMU-End",
@@ -81,15 +84,20 @@ void Mount(ManagedUserAuthenticator::AuthAttempt* attempt,
// Calls cryptohome's addKey method.
void AddKey(ManagedUserAuthenticator::AuthAttempt* attempt,
scoped_refptr<ManagedUserAuthenticator> resolver,
- const std::string& master_key,
+ const std::string& plain_text_master_key,
const std::string& system_salt) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
"CryptohomeAddKey-LMU-Start", false);
+
+ Key user_key(attempt->password);
+ user_key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
+ Key master_key(plain_text_master_key);
+ master_key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
cryptohome::AsyncMethodCaller::GetInstance()->AsyncAddKey(
attempt->username,
- ParallelAuthenticator::HashPassword(attempt->password, system_salt),
- ParallelAuthenticator::HashPassword(master_key, system_salt),
+ user_key.GetSecret(),
+ master_key.GetSecret(),
base::Bind(&TriggerResolveWithLoginTimeMarker,
"CryptohomeAddKey-LMU-End",
attempt,

Powered by Google App Engine
This is Rietveld 408576698