summaryrefslogtreecommitdiffstats
path: root/partitionmanager.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-11-18 17:17:59 +0100
committerEthan Yonker <dees_troy@teamw.in>2014-11-18 17:18:14 +0100
commitcceebb8189788457ef3bdee408e285aa8912121a (patch)
tree7eea76e08b6f1e55cd292720d3b54776d55082a5 /partitionmanager.cpp
parentMake libmincrypttwrp a shared library (diff)
downloadandroid_bootable_recovery-cceebb8189788457ef3bdee408e285aa8912121a.tar
android_bootable_recovery-cceebb8189788457ef3bdee408e285aa8912121a.tar.gz
android_bootable_recovery-cceebb8189788457ef3bdee408e285aa8912121a.tar.bz2
android_bootable_recovery-cceebb8189788457ef3bdee408e285aa8912121a.tar.lz
android_bootable_recovery-cceebb8189788457ef3bdee408e285aa8912121a.tar.xz
android_bootable_recovery-cceebb8189788457ef3bdee408e285aa8912121a.tar.zst
android_bootable_recovery-cceebb8189788457ef3bdee408e285aa8912121a.zip
Diffstat (limited to 'partitionmanager.cpp')
-rw-r--r--partitionmanager.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index d2c91be7a..f75fcbc51 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -139,6 +139,24 @@ int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error)
if (settings_partition) {
Setup_Settings_Storage_Partition(settings_partition);
}
+#ifdef TW_INCLUDE_L_CRYPTO
+ TWPartition* Decrypt_Data = Find_Partition_By_Path("/data");
+ if (Decrypt_Data && Decrypt_Data->Is_Encrypted && !Decrypt_Data->Is_Decrypted) {
+ int password_type = cryptfs_get_password_type();
+ if (password_type == CRYPT_TYPE_DEFAULT) {
+ LOGINFO("Device is encrypted with the default password, attempting to decrypt.\n");
+ if (Decrypt_Device("default_password") == 0) {
+ gui_print("Successfully decrypted with default password.\n");
+ DataManager::SetValue(TW_IS_ENCRYPTED, 0);
+ } else {
+ LOGERR("Unable to decrypt with default password.");
+ LOGERR("You may need to perform a Format Data.\n");
+ }
+ } else {
+ DataManager::SetValue("TW_CRYPTO_TYPE", password_type);
+ }
+ }
+#endif
Update_System_Details();
UnMount_Main_Partitions();
return true;
@@ -1375,6 +1393,9 @@ int TWPartitionManager::Decrypt_Device(string Password) {
#endif
strcpy(cPassword, Password.c_str());
+#ifdef TW_INCLUDE_L_CRYPTO
+ Mount_By_Path("/vendor", false); // if exists, mount vendor partition as we may need some proprietary files
+#endif
int pwret = cryptfs_check_passwd(cPassword);
if (pwret != 0) {