Loading services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java +8 −2 Original line number Diff line number Diff line Loading @@ -1541,8 +1541,14 @@ class SyntheticPasswordManager { */ public @NonNull AuthenticationResult unlockTokenBasedProtector( IGateKeeperService gatekeeper, long protectorId, byte[] token, int userId) { SyntheticPasswordBlob blob = SyntheticPasswordBlob.fromBytes(loadState(SP_BLOB_NAME, protectorId, userId)); byte[] data = loadState(SP_BLOB_NAME, protectorId, userId); if (data == null) { AuthenticationResult result = new AuthenticationResult(); result.gkResponse = VerifyCredentialResponse.ERROR; Slogf.w(TAG, "spblob not found for protector %016x, user %d", protectorId, userId); return result; } SyntheticPasswordBlob blob = SyntheticPasswordBlob.fromBytes(data); return unlockTokenBasedProtectorInternal(gatekeeper, protectorId, blob.mProtectorType, token, userId); } Loading services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java +8 −0 Original line number Diff line number Diff line Loading @@ -505,6 +505,14 @@ public class SyntheticPasswordTests extends BaseLockSettingsServiceTests { assertEquals(CREDENTIAL_TYPE_NONE, mService.getCredentialType(PRIMARY_USER_ID)); } @Test public void testUnlockUserWithTokenWithBadHandleReturnsFalse() { final long badTokenHandle = 123456789; final byte[] token = "some-high-entropy-secure-token".getBytes(); mService.initializeSyntheticPassword(PRIMARY_USER_ID); assertFalse(mLocalService.unlockUserWithToken(badTokenHandle, token, PRIMARY_USER_ID)); } @Test public void testGetHashFactorPrimaryUser() throws RemoteException { LockscreenCredential password = newPassword("password"); Loading Loading
services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java +8 −2 Original line number Diff line number Diff line Loading @@ -1541,8 +1541,14 @@ class SyntheticPasswordManager { */ public @NonNull AuthenticationResult unlockTokenBasedProtector( IGateKeeperService gatekeeper, long protectorId, byte[] token, int userId) { SyntheticPasswordBlob blob = SyntheticPasswordBlob.fromBytes(loadState(SP_BLOB_NAME, protectorId, userId)); byte[] data = loadState(SP_BLOB_NAME, protectorId, userId); if (data == null) { AuthenticationResult result = new AuthenticationResult(); result.gkResponse = VerifyCredentialResponse.ERROR; Slogf.w(TAG, "spblob not found for protector %016x, user %d", protectorId, userId); return result; } SyntheticPasswordBlob blob = SyntheticPasswordBlob.fromBytes(data); return unlockTokenBasedProtectorInternal(gatekeeper, protectorId, blob.mProtectorType, token, userId); } Loading
services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java +8 −0 Original line number Diff line number Diff line Loading @@ -505,6 +505,14 @@ public class SyntheticPasswordTests extends BaseLockSettingsServiceTests { assertEquals(CREDENTIAL_TYPE_NONE, mService.getCredentialType(PRIMARY_USER_ID)); } @Test public void testUnlockUserWithTokenWithBadHandleReturnsFalse() { final long badTokenHandle = 123456789; final byte[] token = "some-high-entropy-secure-token".getBytes(); mService.initializeSyntheticPassword(PRIMARY_USER_ID); assertFalse(mLocalService.unlockUserWithToken(badTokenHandle, token, PRIMARY_USER_ID)); } @Test public void testGetHashFactorPrimaryUser() throws RemoteException { LockscreenCredential password = newPassword("password"); Loading