OLD | NEW |
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/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "chrome/browser/chromeos/boot_times_loader.h" | 14 #include "chrome/browser/chromeos/boot_times_loader.h" |
15 #include "chrome/browser/chromeos/cros/cert_library.h" | 15 #include "chrome/browser/chromeos/cros/cert_library.h" |
16 #include "chrome/browser/chromeos/cros/cros_library.h" | 16 #include "chrome/browser/chromeos/cros/cros_library.h" |
17 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | |
18 #include "chrome/browser/chromeos/login/authentication_notification_details.h" | 17 #include "chrome/browser/chromeos/login/authentication_notification_details.h" |
19 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 18 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
20 #include "chrome/browser/chromeos/login/user.h" | 19 #include "chrome/browser/chromeos/login/user.h" |
21 #include "chrome/browser/chromeos/login/user_manager.h" | 20 #include "chrome/browser/chromeos/login/user_manager.h" |
22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
23 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
25 #include "chromeos/cryptohome/async_method_caller.h" | 24 #include "chromeos/cryptohome/async_method_caller.h" |
| 25 #include "chromeos/cryptohome/cryptohome_library.h" |
26 #include "chromeos/dbus/cryptohome_client.h" | 26 #include "chromeos/dbus/cryptohome_client.h" |
27 #include "chromeos/dbus/dbus_thread_manager.h" | 27 #include "chromeos/dbus/dbus_thread_manager.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
30 #include "crypto/sha2.h" | 30 #include "crypto/sha2.h" |
31 #include "google_apis/gaia/gaia_auth_util.h" | 31 #include "google_apis/gaia/gaia_auth_util.h" |
32 #include "third_party/cros_system_api/dbus/service_constants.h" | 32 #include "third_party/cros_system_api/dbus/service_constants.h" |
33 | 33 |
34 using content::BrowserThread; | 34 using content::BrowserThread; |
35 | 35 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 (online_outcome.error().state() == | 171 (online_outcome.error().state() == |
172 GoogleServiceAuthError::CONNECTION_FAILED) || | 172 GoogleServiceAuthError::CONNECTION_FAILED) || |
173 (online_outcome.error().state() == | 173 (online_outcome.error().state() == |
174 GoogleServiceAuthError::REQUEST_CANCELED)); | 174 GoogleServiceAuthError::REQUEST_CANCELED)); |
175 } | 175 } |
176 | 176 |
177 // Returns hash of |password|, salted with the system salt. | 177 // Returns hash of |password|, salted with the system salt. |
178 std::string HashPassword(const std::string& password) { | 178 std::string HashPassword(const std::string& password) { |
179 // Get salt, ascii encode, update sha with that, then update with ascii | 179 // Get salt, ascii encode, update sha with that, then update with ascii |
180 // of password, then end. | 180 // of password, then end. |
181 std::string ascii_salt = | 181 std::string ascii_salt = CryptohomeLibrary::Get()->GetSystemSalt(); |
182 CrosLibrary::Get()->GetCryptohomeLibrary()->GetSystemSalt(); | |
183 char passhash_buf[kPasswordHashLength]; | 182 char passhash_buf[kPasswordHashLength]; |
184 | 183 |
185 // Hash salt and password | 184 // Hash salt and password |
186 crypto::SHA256HashString(ascii_salt + password, | 185 crypto::SHA256HashString(ascii_salt + password, |
187 &passhash_buf, sizeof(passhash_buf)); | 186 &passhash_buf, sizeof(passhash_buf)); |
188 | 187 |
189 // Only want the top half for 'weak' hashing so that the passphrase is not | 188 // Only want the top half for 'weak' hashing so that the passphrase is not |
190 // immediately exposed even if the output is reversed. | 189 // immediately exposed even if the output is reversed. |
191 const int encoded_length = sizeof(passhash_buf) / 2; | 190 const int encoded_length = sizeof(passhash_buf) / 2; |
192 | 191 |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 Resolve(); | 884 Resolve(); |
886 } | 885 } |
887 | 886 |
888 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, | 887 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, |
889 bool check_result) { | 888 bool check_result) { |
890 owner_is_verified_ = owner_check_finished; | 889 owner_is_verified_ = owner_check_finished; |
891 user_can_login_ = check_result; | 890 user_can_login_ = check_result; |
892 } | 891 } |
893 | 892 |
894 } // namespace chromeos | 893 } // namespace chromeos |
OLD | NEW |