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

Side by Side Diff: chrome/browser/chromeos/login/managed/managed_user_authenticator.cc

Issue 14179007: Move cryptohome_library to src/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/managed/managed_user_authenticator.h" 5 #include "chrome/browser/chromeos/login/managed/managed_user_authenticator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/chromeos/boot_times_loader.h" 10 #include "chrome/browser/chromeos/boot_times_loader.h"
11 #include "chrome/browser/chromeos/cros/cros_library.h"
12 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
13 #include "chromeos/cryptohome/async_method_caller.h" 11 #include "chromeos/cryptohome/async_method_caller.h"
12 #include "chromeos/cryptohome/cryptohome_library.h"
14 #include "chromeos/dbus/cryptohome_client.h" 13 #include "chromeos/dbus/cryptohome_client.h"
15 #include "chromeos/dbus/dbus_thread_manager.h" 14 #include "chromeos/dbus/dbus_thread_manager.h"
16 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
17 #include "crypto/sha2.h" 16 #include "crypto/sha2.h"
18 #include "google_apis/gaia/gaia_auth_util.h" 17 #include "google_apis/gaia/gaia_auth_util.h"
19 #include "third_party/cros_system_api/dbus/service_constants.h" 18 #include "third_party/cros_system_api/dbus/service_constants.h"
20 19
21 using content::BrowserThread; 20 using content::BrowserThread;
22 21
23 namespace chromeos { 22 namespace chromeos {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 79
81 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( 80 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername(
82 attempt->username, 81 attempt->username,
83 base::Bind(&TriggerResolveResult, attempt, resolver)); 82 base::Bind(&TriggerResolveResult, attempt, resolver));
84 } 83 }
85 84
86 // Returns hash of |password|, salted with the system salt. 85 // Returns hash of |password|, salted with the system salt.
87 std::string HashPassword(const std::string& password) { 86 std::string HashPassword(const std::string& password) {
88 // Get salt, ascii encode, update sha with that, then update with ascii 87 // Get salt, ascii encode, update sha with that, then update with ascii
89 // of password, then end. 88 // of password, then end.
90 std::string ascii_salt = 89 std::string ascii_salt = CryptohomeLibrary::Get()->GetSystemSalt();
91 CrosLibrary::Get()->GetCryptohomeLibrary()->GetSystemSalt();
92 char passhash_buf[kPasswordHashLength]; 90 char passhash_buf[kPasswordHashLength];
93 91
94 // Hash salt and password 92 // Hash salt and password
95 crypto::SHA256HashString( 93 crypto::SHA256HashString(
96 ascii_salt + password, &passhash_buf, sizeof(passhash_buf)); 94 ascii_salt + password, &passhash_buf, sizeof(passhash_buf));
97 95
98 // Only want the top half for 'weak' hashing so that the passphrase is not 96 // Only want the top half for 'weak' hashing so that the passphrase is not
99 // immediately exposed even if the output is reversed. 97 // immediately exposed even if the output is reversed.
100 const int encoded_length = sizeof(passhash_buf) / 2; 98 const int encoded_length = sizeof(passhash_buf) / 2;
101 99
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
309 return hash_obtained_; 307 return hash_obtained_;
310 } 308 }
311 309
312 std::string ManagedUserAuthenticator::AuthAttempt::hash() { 310 std::string ManagedUserAuthenticator::AuthAttempt::hash() {
313 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 311 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
314 return hash_; 312 return hash_;
315 } 313 }
316 314
317 } // namespace chromeos 315 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698