| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/quick_unlock/pin_storage.h" | 5 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 #include "chromeos/login/auth/key.h" | 10 #include "chromeos/login/auth/key.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 std::string PinStorage::PinSalt() const { | 98 std::string PinStorage::PinSalt() const { |
| 99 return pref_service_->GetString(prefs::kQuickUnlockPinSalt); | 99 return pref_service_->GetString(prefs::kQuickUnlockPinSalt); |
| 100 } | 100 } |
| 101 | 101 |
| 102 std::string PinStorage::PinSecret() const { | 102 std::string PinStorage::PinSecret() const { |
| 103 return pref_service_->GetString(prefs::kQuickUnlockPinSecret); | 103 return pref_service_->GetString(prefs::kQuickUnlockPinSecret); |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool PinStorage::IsPinAuthenticationAvailable() const { | 106 bool PinStorage::IsPinAuthenticationAvailable() const { |
| 107 return IsPinSet() && unlock_attempt_count() < kMaximumUnlockAttempts && | 107 return false; |
| 108 HasStrongAuth() && TimeSinceLastStrongAuth() < kStrongAuthTimeout; | |
| 109 } | 108 } |
| 110 | 109 |
| 111 bool PinStorage::TryAuthenticatePin(const std::string& pin) { | 110 bool PinStorage::TryAuthenticatePin(const std::string& pin) { |
| 112 if (!IsPinAuthenticationAvailable()) | 111 if (!IsPinAuthenticationAvailable()) |
| 113 return false; | 112 return false; |
| 114 | 113 |
| 115 AddUnlockAttempt(); | 114 AddUnlockAttempt(); |
| 116 return ComputeSecret(pin, PinSalt()) == PinSecret(); | 115 return ComputeSecret(pin, PinSalt()) == PinSecret(); |
| 117 } | 116 } |
| 118 | 117 |
| 119 } // namespace chromeos | 118 } // namespace chromeos |
| OLD | NEW |