Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3dca1466 authored by Kholoud Mohamed's avatar Kholoud Mohamed Committed by Android (Google) Code Review
Browse files

Merge "Fix bug in LockSettingsService" into sc-dev

parents 31164bc1 fecd017a
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -932,19 +932,6 @@ public class LockPatternUtils {
        return Long.toHexString(salt);
    }

    /**
     * Generate a hash for the given password. To avoid brute force attacks, we use a salted hash.
     * Not the most secure, but it is at least a second level of protection. First level is that
     * the file is in a location only readable by the system process.
     *
     * @param password the gesture pattern.
     *
     * @return the hash of the pattern in a byte array.
     */
    public String legacyPasswordToHash(byte[] password, int userId) {
        return LockscreenCredential.legacyPasswordToHash(password, getSalt(userId).getBytes());
    }

    /**
     * Returns the credential type of the user, can be one of {@link #CREDENTIAL_TYPE_NONE},
     * {@link #CREDENTIAL_TYPE_PATTERN}, {@link #CREDENTIAL_TYPE_PIN} and
+1 −1
Original line number Diff line number Diff line
@@ -1773,7 +1773,7 @@ public class LockSettingsService extends ILockSettings.Stub {
        } else {
            final byte[] hashFactor = getHashFactor(password, userHandle);
            final byte[] salt = getSalt(userHandle).getBytes();
            String hash = password.passwordToHistoryHash(hashFactor, salt);
            String hash = password.passwordToHistoryHash(salt, hashFactor);
            if (hash == null) {
                Slog.e(TAG, "Compute new style password hash failed, fallback to legacy style");
                hash = password.legacyPasswordToHash(salt);