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

Commit fecd017a authored by kholoud mohamed's avatar kholoud mohamed
Browse files

Fix bug in LockSettingsService

Params for passwordToHistoryHash were
passed in the wrong order.
Also removed an used method.

Bug: 183716601
Test: N/A
Change-Id: I370f30ba2ad8fa0eba311c5219b8185dccda8e5e
parent bcc5b4c1
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);