summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/password
diff options
context:
space:
mode:
authorRubin Xu <rubinxu@google.com>2018-03-30 20:51:24 +0100
committerRubin Xu <rubinxu@google.com>2018-04-20 18:09:59 +0100
commitc33e2a1cefa3a91c4e798b25c432ecf02914921a (patch)
tree80c086b683f236dd07f2d9d12111ca16a2151cfb /src/com/android/settings/password
parente848603807e4ee58d70e4f1b81cfb6b210a0a4d4 (diff)
downloadpackages_apps_Settings-c33e2a1cefa3a91c4e798b25c432ecf02914921a.tar.gz
packages_apps_Settings-c33e2a1cefa3a91c4e798b25c432ecf02914921a.tar.bz2
packages_apps_Settings-c33e2a1cefa3a91c4e798b25c432ecf02914921a.zip
Switch to new checkPasswordHistory method
This is part of the fix that upgrades the hashing of password history to a more secure design. Bug: 32826058 Test: manual Change-Id: Ib022c8db1f7b63f75b69d0177fa5f6be528a83c5
Diffstat (limited to 'src/com/android/settings/password')
-rw-r--r--src/com/android/settings/password/ChooseLockPassword.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/com/android/settings/password/ChooseLockPassword.java b/src/com/android/settings/password/ChooseLockPassword.java
index 14f7d6bd6c..e60b4e6d0e 100644
--- a/src/com/android/settings/password/ChooseLockPassword.java
+++ b/src/com/android/settings/password/ChooseLockPassword.java
@@ -193,6 +193,7 @@ public class ChooseLockPassword extends SettingsActivity {
private int mPasswordMinLengthToFulfillAllPolicies = 0;
protected int mUserId;
private boolean mHideDrawer = false;
+ private byte[] mPasswordHistoryHashFactor;
/**
* Password requirements that we need to verify.
*/
@@ -667,7 +668,8 @@ public class ChooseLockPassword extends SettingsActivity {
}
}
// Is the password recently used?
- if (mLockPatternUtils.checkPasswordHistory(password, mUserId)) {
+ if (mLockPatternUtils.checkPasswordHistory(password, getPasswordHistoryHashFactor(),
+ mUserId)) {
errorCode |= RECENTLY_USED;
}
}
@@ -730,6 +732,18 @@ public class ChooseLockPassword extends SettingsActivity {
return errorCode;
}
+ /**
+ * Lazily compute and return the history hash factor of the current user (mUserId), used for
+ * password history check.
+ */
+ private byte[] getPasswordHistoryHashFactor() {
+ if (mPasswordHistoryHashFactor == null) {
+ mPasswordHistoryHashFactor = mLockPatternUtils.getPasswordHistoryHashFactor(
+ mCurrentPassword, mUserId);
+ }
+ return mPasswordHistoryHashFactor;
+ }
+
public void handleNext() {
if (mSaveAndFinishWorker != null) return;
mChosenPassword = mPasswordEntry.getText().toString();