Merge "Remove userSerial param from vold methods that don't use it" into main am: 7730a4944f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2871777 Change-Id: I7ed86185213bec08b4e626df05b356c4fc1358f8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
d7b3c40507
5 changed files with 23 additions and 29 deletions
17
FsCrypt.cpp
17
FsCrypt.cpp
|
@ -603,7 +603,7 @@ bool fscrypt_init_user0() {
|
|||
// only prepare DE storage here, since user 0's CE key won't be installed
|
||||
// yet unless it was just created. The framework will prepare the user's CE
|
||||
// storage later, once their CE key is installed.
|
||||
if (!fscrypt_prepare_user_storage("", 0, 0, android::os::IVold::STORAGE_FLAG_DE)) {
|
||||
if (!fscrypt_prepare_user_storage("", 0, android::os::IVold::STORAGE_FLAG_DE)) {
|
||||
LOG(ERROR) << "Failed to prepare user 0 storage";
|
||||
return false;
|
||||
}
|
||||
|
@ -613,14 +613,14 @@ bool fscrypt_init_user0() {
|
|||
}
|
||||
|
||||
// Creates the CE and DE keys for a new user.
|
||||
bool fscrypt_create_user_keys(userid_t user_id, int serial, bool ephemeral) {
|
||||
LOG(DEBUG) << "fscrypt_create_user_keys for " << user_id << " serial " << serial;
|
||||
bool fscrypt_create_user_keys(userid_t user_id, bool ephemeral) {
|
||||
LOG(DEBUG) << "fscrypt_create_user_keys for " << user_id;
|
||||
if (!IsFbeEnabled()) {
|
||||
return true;
|
||||
}
|
||||
// FIXME test for existence of key that is not loaded yet
|
||||
if (s_ce_policies.count(user_id) != 0) {
|
||||
LOG(ERROR) << "Already exists, can't create keys for " << user_id << " serial " << serial;
|
||||
LOG(ERROR) << "Already exists, can't create keys for " << user_id;
|
||||
// FIXME should we fail the command?
|
||||
return true;
|
||||
}
|
||||
|
@ -847,8 +847,8 @@ std::vector<int> fscrypt_get_unlocked_users() {
|
|||
// Unlocks internal CE storage for the given user. This only unlocks internal storage, since
|
||||
// fscrypt_prepare_user_storage() has to be called for each adoptable storage volume anyway (since
|
||||
// the volume might have been absent when the user was created), and that handles the unlocking.
|
||||
bool fscrypt_unlock_ce_storage(userid_t user_id, int serial, const std::string& secret_hex) {
|
||||
LOG(DEBUG) << "fscrypt_unlock_ce_storage " << user_id << " serial=" << serial;
|
||||
bool fscrypt_unlock_ce_storage(userid_t user_id, const std::string& secret_hex) {
|
||||
LOG(DEBUG) << "fscrypt_unlock_ce_storage " << user_id;
|
||||
if (!IsFbeEnabled()) return true;
|
||||
if (s_ce_policies.count(user_id) != 0) {
|
||||
LOG(WARNING) << "CE storage for user " << user_id << " is already unlocked";
|
||||
|
@ -883,10 +883,9 @@ static bool prepare_subdirs(const std::string& action, const std::string& volume
|
|||
return true;
|
||||
}
|
||||
|
||||
bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_id, int serial,
|
||||
int flags) {
|
||||
bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_id, int flags) {
|
||||
LOG(DEBUG) << "fscrypt_prepare_user_storage for volume " << escape_empty(volume_uuid)
|
||||
<< ", user " << user_id << ", serial " << serial << ", flags " << flags;
|
||||
<< ", user " << user_id << ", flags " << flags;
|
||||
|
||||
// Internal storage must be prepared before adoptable storage, since the
|
||||
// user's volume keys are stored in their internal storage.
|
||||
|
|
|
@ -23,17 +23,16 @@ bool fscrypt_initialize_systemwide_keys();
|
|||
|
||||
bool fscrypt_init_user0();
|
||||
extern bool fscrypt_init_user0_done;
|
||||
bool fscrypt_create_user_keys(userid_t user_id, int serial, bool ephemeral);
|
||||
bool fscrypt_create_user_keys(userid_t user_id, bool ephemeral);
|
||||
bool fscrypt_destroy_user_keys(userid_t user_id);
|
||||
bool fscrypt_set_ce_key_protection(userid_t user_id, const std::string& secret);
|
||||
void fscrypt_deferred_fixate_ce_keys();
|
||||
|
||||
std::vector<int> fscrypt_get_unlocked_users();
|
||||
bool fscrypt_unlock_ce_storage(userid_t user_id, int serial, const std::string& secret);
|
||||
bool fscrypt_unlock_ce_storage(userid_t user_id, const std::string& secret);
|
||||
bool fscrypt_lock_ce_storage(userid_t user_id);
|
||||
|
||||
bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_id, int serial,
|
||||
int flags);
|
||||
bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_id, int flags);
|
||||
bool fscrypt_destroy_user_storage(const std::string& volume_uuid, userid_t user_id, int flags);
|
||||
|
||||
bool fscrypt_destroy_volume_keys(const std::string& volume_uuid);
|
||||
|
|
|
@ -607,12 +607,11 @@ binder::Status VoldNativeService::setStorageBindingSeed(const std::vector<uint8_
|
|||
return translateBool(setKeyStorageBindingSeed(seed));
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::createUserStorageKeys(int32_t userId, int32_t userSerial,
|
||||
bool ephemeral) {
|
||||
binder::Status VoldNativeService::createUserStorageKeys(int32_t userId, bool ephemeral) {
|
||||
ENFORCE_SYSTEM_OR_ROOT;
|
||||
ACQUIRE_CRYPT_LOCK;
|
||||
|
||||
return translateBool(fscrypt_create_user_keys(userId, userSerial, ephemeral));
|
||||
return translateBool(fscrypt_create_user_keys(userId, ephemeral));
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::destroyUserStorageKeys(int32_t userId) {
|
||||
|
@ -638,12 +637,11 @@ binder::Status VoldNativeService::getUnlockedUsers(std::vector<int>* _aidl_retur
|
|||
return Ok();
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::unlockCeStorage(int32_t userId, int32_t userSerial,
|
||||
const std::string& secret) {
|
||||
binder::Status VoldNativeService::unlockCeStorage(int32_t userId, const std::string& secret) {
|
||||
ENFORCE_SYSTEM_OR_ROOT;
|
||||
ACQUIRE_CRYPT_LOCK;
|
||||
|
||||
return translateBool(fscrypt_unlock_ce_storage(userId, userSerial, secret));
|
||||
return translateBool(fscrypt_unlock_ce_storage(userId, secret));
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::lockCeStorage(int32_t userId) {
|
||||
|
@ -654,15 +652,14 @@ binder::Status VoldNativeService::lockCeStorage(int32_t userId) {
|
|||
}
|
||||
|
||||
binder::Status VoldNativeService::prepareUserStorage(const std::optional<std::string>& uuid,
|
||||
int32_t userId, int32_t userSerial,
|
||||
int32_t flags) {
|
||||
int32_t userId, int32_t flags) {
|
||||
ENFORCE_SYSTEM_OR_ROOT;
|
||||
std::string empty_string = "";
|
||||
auto uuid_ = uuid ? *uuid : empty_string;
|
||||
CHECK_ARGUMENT_HEX(uuid_);
|
||||
|
||||
ACQUIRE_CRYPT_LOCK;
|
||||
return translateBool(fscrypt_prepare_user_storage(uuid_, userId, userSerial, flags));
|
||||
return translateBool(fscrypt_prepare_user_storage(uuid_, userId, flags));
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::destroyUserStorage(const std::optional<std::string>& uuid,
|
||||
|
|
|
@ -112,17 +112,17 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn
|
|||
|
||||
binder::Status setStorageBindingSeed(const std::vector<uint8_t>& seed);
|
||||
|
||||
binder::Status createUserStorageKeys(int32_t userId, int32_t userSerial, bool ephemeral);
|
||||
binder::Status createUserStorageKeys(int32_t userId, bool ephemeral);
|
||||
binder::Status destroyUserStorageKeys(int32_t userId);
|
||||
|
||||
binder::Status setCeStorageProtection(int32_t userId, const std::string& secret);
|
||||
|
||||
binder::Status getUnlockedUsers(std::vector<int>* _aidl_return);
|
||||
binder::Status unlockCeStorage(int32_t userId, int32_t userSerial, const std::string& secret);
|
||||
binder::Status unlockCeStorage(int32_t userId, const std::string& secret);
|
||||
binder::Status lockCeStorage(int32_t userId);
|
||||
|
||||
binder::Status prepareUserStorage(const std::optional<std::string>& uuid, int32_t userId,
|
||||
int32_t userSerial, int32_t flags);
|
||||
int32_t flags);
|
||||
binder::Status destroyUserStorage(const std::optional<std::string>& uuid, int32_t userId,
|
||||
int32_t flags);
|
||||
|
||||
|
|
|
@ -85,17 +85,16 @@ interface IVold {
|
|||
|
||||
void setStorageBindingSeed(in byte[] seed);
|
||||
|
||||
void createUserStorageKeys(int userId, int userSerial, boolean ephemeral);
|
||||
void createUserStorageKeys(int userId, boolean ephemeral);
|
||||
void destroyUserStorageKeys(int userId);
|
||||
|
||||
void setCeStorageProtection(int userId, @utf8InCpp String secret);
|
||||
|
||||
int[] getUnlockedUsers();
|
||||
void unlockCeStorage(int userId, int userSerial, @utf8InCpp String secret);
|
||||
void unlockCeStorage(int userId, @utf8InCpp String secret);
|
||||
void lockCeStorage(int userId);
|
||||
|
||||
void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial,
|
||||
int storageFlags);
|
||||
void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
|
||||
void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
|
||||
|
||||
void prepareSandboxForApp(in @utf8InCpp String packageName, int appId,
|
||||
|
|
Loading…
Reference in a new issue