summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2024-01-05 20:29:48 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-01-05 20:29:48 +0000
commitd7b3c40507b4839ba0bf394ff4040e76a88dd4b5 (patch)
tree54f3440e1d2a703daf7e843f8eb5430b7aa63e6f
parent987629c0247d1153da44eb3b7828078e7a56d134 (diff)
parent7730a4944f435f5983f08c56ff4c5c92c9335b52 (diff)
downloadvold-d7b3c40507b4839ba0bf394ff4040e76a88dd4b5.tar.gz
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>
-rw-r--r--FsCrypt.cpp17
-rw-r--r--FsCrypt.h7
-rw-r--r--VoldNativeService.cpp15
-rw-r--r--VoldNativeService.h6
-rw-r--r--binder/android/os/IVold.aidl7
5 files changed, 23 insertions, 29 deletions
diff --git a/FsCrypt.cpp b/FsCrypt.cpp
index 4f1f5b24..7fe8be45 100644
--- a/FsCrypt.cpp
+++ b/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.
diff --git a/FsCrypt.h b/FsCrypt.h
index f5c367cf..afcedfbe 100644
--- a/FsCrypt.h
+++ b/FsCrypt.h
@@ -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);
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index c39604ba..65731af8 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -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,
diff --git a/VoldNativeService.h b/VoldNativeService.h
index e98aea85..d9aee578 100644
--- a/VoldNativeService.h
+++ b/VoldNativeService.h
@@ -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);
diff --git a/binder/android/os/IVold.aidl b/binder/android/os/IVold.aidl
index 852e8af1..229f173d 100644
--- a/binder/android/os/IVold.aidl
+++ b/binder/android/os/IVold.aidl
@@ -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,