Revert "Add support for multi-user decryption"

This reverts commit 0b25b1d79b.

Reason for revert: Changes need to be made to libtwrpfscrypt to include this patchset. Will cherry-pick this patch later and make necessary modifications.

Change-Id: I7601d7b820129709b05d9b4368573b6f1048de02
This commit is contained in:
bigbiff
2020-05-28 19:36:30 +00:00
parent 0b25b1d79b
commit adc599e005
18 changed files with 655 additions and 640 deletions
+14 -17
View File
@@ -549,16 +549,13 @@ std::string unwrapSyntheticPasswordBlob(const std::string& spblob_path, const st
std::string disk_decryption_secret_key = "";
std::string keystore_alias_subid;
// Can be stored in user 0, so check for both.
if (!Find_Keystore_Alias_SubID_And_Prep_Files(user_id, keystore_alias_subid, handle_str) &&
!Find_Keystore_Alias_SubID_And_Prep_Files(0, keystore_alias_subid, handle_str))
{
printf("failed to scan keystore alias subid and prep keystore files\n");
return disk_decryption_secret_key;
}
if (!Find_Keystore_Alias_SubID_And_Prep_Files(user_id, keystore_alias_subid, handle_str)) {
printf("failed to scan keystore alias subid and prep keystore files\n");
return disk_decryption_secret_key;
}
// First get the keystore service
sp<IBinder> binder = getKeystoreBinderRetry();
sp<IBinder> binder = getKeystoreBinderRetry();
#ifdef USE_KEYSTORAGE_4
sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder);
#else
@@ -1168,15 +1165,15 @@ bool Decrypt_User_Synth_Pass(const userid_t user_id, const std::string& Password
printf("e4crypt_unlock_user_key returned fail\n");
return Free_Return(retval, weaver_key, &pwd);
}
/*#ifdef USE_KEYSTORAGE_4
#ifdef USE_KEYSTORAGE_4
if (!e4crypt_prepare_user_storage("", user_id, 0, flags)) {
#else
if (!e4crypt_prepare_user_storage(nullptr, user_id, 0, flags)) {
#endif
printf("failed to e4crypt_prepare_user_storage\n");
return Free_Return(retval, weaver_key, &pwd);
}*/
printf("User %i Decrypted Successfully!\n", user_id);
}
printf("Decrypted Successfully!\n");
retval = true;
return Free_Return(retval, weaver_key, &pwd);
}
@@ -1258,15 +1255,15 @@ bool Decrypt_User(const userid_t user_id, const std::string& Password) {
printf("e4crypt_unlock_user_key returned fail\n");
return false;
}
/*#ifdef USE_KEYSTORAGE_4
#ifdef USE_KEYSTORAGE_4
if (!e4crypt_prepare_user_storage("", user_id, 0, flags)) {
#else
if (!e4crypt_prepare_user_storage(nullptr, user_id, 0, flags)) {
#endif
printf("failed to e4crypt_prepare_user_storage\n");
return false;
}*/
printf("User %i Decrypted Successfully!\n", user_id);
}
printf("Decrypted Successfully!\n");
return true;
}
if (stat("/data/system_de/0/spblob", &st) == 0) {
@@ -1346,14 +1343,14 @@ bool Decrypt_User(const userid_t user_id, const std::string& Password) {
printf("e4crypt_unlock_user_key returned fail\n");
return false;
}
/*#ifdef USE_KEYSTORAGE_4
#ifdef USE_KEYSTORAGE_4
if (!e4crypt_prepare_user_storage("", user_id, 0, flags)) {
#else
if (!e4crypt_prepare_user_storage(nullptr, user_id, 0, flags)) {
#endif
printf("failed to e4crypt_prepare_user_storage\n");
return false;
}*/
printf("User %i Decrypted Successfully!\n", user_id);
}
printf("Decrypted Successfully!\n");
return true;
}