summaryrefslogtreecommitdiffstats
path: root/partition.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-11-11 21:52:28 +0100
committerDees Troy <dees_troy@teamw.in>2014-11-12 18:07:24 +0100
commit4eca40d7d8ff6968ed68a24686093cfb6f5f6373 (patch)
tree39a211a1f021a98d7ee2c57d939891dccbc96048 /partition.cpp
parentMake TWRP compile for arm64 (diff)
downloadandroid_bootable_recovery-4eca40d7d8ff6968ed68a24686093cfb6f5f6373.tar
android_bootable_recovery-4eca40d7d8ff6968ed68a24686093cfb6f5f6373.tar.gz
android_bootable_recovery-4eca40d7d8ff6968ed68a24686093cfb6f5f6373.tar.bz2
android_bootable_recovery-4eca40d7d8ff6968ed68a24686093cfb6f5f6373.tar.lz
android_bootable_recovery-4eca40d7d8ff6968ed68a24686093cfb6f5f6373.tar.xz
android_bootable_recovery-4eca40d7d8ff6968ed68a24686093cfb6f5f6373.tar.zst
android_bootable_recovery-4eca40d7d8ff6968ed68a24686093cfb6f5f6373.zip
Diffstat (limited to 'partition.cpp')
-rw-r--r--partition.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/partition.cpp b/partition.cpp
index 2195d9d38..642c3dd65 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -55,6 +55,8 @@ extern "C" {
#ifdef TW_INCLUDE_CRYPTO
#ifdef TW_INCLUDE_JB_CRYPTO
#include "crypto/jb/cryptfs.h"
+ #elif defined(TW_INCLUDE_L_CRYPTO)
+ #include "crypto/lollipop/cryptfs.h"
#else
#include "crypto/ics/cryptfs.h"
#endif
@@ -276,6 +278,21 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) {
Setup_Data_Media();
#ifdef TW_INCLUDE_CRYPTO
Can_Be_Encrypted = true;
+#ifdef TW_INCLUDE_L_CRYPTO
+ 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");
+ property_set("ro.crypto.state", "encrypted");
+ if (cryptfs_check_passwd("default_password") == 0) {
+ gui_print("Successfully decrypted with default password.\n");
+ } 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
char crypto_blkdev[255];
property_get("ro.crypto.fs_crypto_blkdev", crypto_blkdev, "error");
if (strcmp(crypto_blkdev, "error") != 0) {
@@ -287,7 +304,7 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) {
LOGINFO("Data already decrypted, new block device: '%s'\n", crypto_blkdev);
} else if (!Mount(false)) {
if (Is_Present) {
-#ifdef TW_INCLUDE_JB_CRYPTO
+#if defined(TW_INCLUDE_JB_CRYPTO) || defined(TW_INCLUDE_L_CRYPTO)
// No extra flags needed
#else
property_set("ro.crypto.fs_type", CRYPTO_FS_TYPE);