set crypto state/type when detected

Change-Id: I4506d3ef11052dbebf974b5c387a3c7d5055f2ea
This commit is contained in:
nebrassy
2020-10-24 21:08:20 +02:00
committed by bigbiff
parent 18aea279ca
commit f74255ea1e
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -738,6 +738,7 @@ bool TWPartition::Decrypt_FBE_DE() {
if (TWFunc::Path_Exists("/data/unencrypted/key/version")) {
DataManager::SetValue(TW_IS_FBE, 1);
DataManager::SetValue(TW_CRYPTO_PWTYPE, "0"); // Set initial value so that recovery will not be confused when using unencrypted data or failed to decrypt data
property_set("ro.crypto.type", "file");
LOGINFO("File Based Encryption is present\n");
#ifdef TW_INCLUDE_FBE
Is_FBE = true;
+2 -1
View File
@@ -398,7 +398,9 @@ void TWPartitionManager::Decrypt_Data() {
#ifdef TW_INCLUDE_CRYPTO
TWPartition* Decrypt_Data = Find_Partition_By_Path("/data");
if (Decrypt_Data && Decrypt_Data->Is_Encrypted && !Decrypt_Data->Is_Decrypted) {
property_set("ro.crypto.state", "encrypted");
if (!Decrypt_Data->Key_Directory.empty() && Mount_By_Path(Decrypt_Data->Key_Directory, false)) {
property_set("ro.crypto.type", "file");
#ifdef TW_INCLUDE_FBE_METADATA_DECRYPT
#ifdef USE_FSCRYPT
if (fscrypt_mount_metadata_encrypted(Decrypt_Data->Actual_Block_Device, Decrypt_Data->Mount_Point, false)) {
@@ -410,7 +412,6 @@ void TWPartitionManager::Decrypt_Data() {
LOGINFO("Successfully decrypted metadata encrypted data partition with new block device: '%s'\n",
Decrypt_Data->Decrypted_Block_Device.c_str());
#endif
property_set("ro.crypto.state", "encrypted");
Decrypt_Data->Is_Decrypted = true; // Needed to make the mount function work correctly
int retry_count = 10;
while (!Decrypt_Data->Mount(false) && --retry_count)