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

Skip to content
Commit cdf39de7 authored by Eric Biggers's avatar Eric Biggers
Browse files

Skip creating password metrics file for unsecured users

As another optimization, skip creating the password metrics file in the
LSKF-based protector when the LSKF is empty.  In this case, the password
metrics file is unnecessary and contains no information.

This saves creating one file, which can be somewhat expensive due to the
use of synchronous writes and an fsync of the parent directory.  It also
saves one key derivation operation and one encryption operation.

Note: previously, it seems to have been possible for a PasswordMetrics
object to end up in the LSS.mUserPasswordMetrics map for an unsecured
user, specifically via LSS.unlockUserWithToken().  After this change,
that can no longer happen.  This is fine because the isUserSecure()
check in LSS.getUserPasswordMetrics() meant that any PasswordMetrics
that may have been cached for an unsecured users were never used anyway.

Bug: 232452368
Bug: 251131631
Bug: 251147505
Test: atest com.android.server.locksettings
Change-Id: I93780a20c69b3a1b0ba21d7c38e98923771fc114
parent 3510d130
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment