summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crypto/lollipop/cryptfs.c14
-rw-r--r--partition.cpp15
-rw-r--r--partitionmanager.cpp21
3 files changed, 28 insertions, 22 deletions
diff --git a/crypto/lollipop/cryptfs.c b/crypto/lollipop/cryptfs.c
index 630fb0ee3..0277c78ef 100644
--- a/crypto/lollipop/cryptfs.c
+++ b/crypto/lollipop/cryptfs.c
@@ -1224,7 +1224,7 @@ static int scrypt_keymaster(const char *passwd, const unsigned char *salt,
unsigned char* master_key = convert_hex_ascii_to_key(passwd, &key_size);
if (!master_key) {
- printf("Failed to convert passwd from hex");
+ printf("Failed to convert passwd from hex\n");
return -1;
}
@@ -1234,13 +1234,13 @@ static int scrypt_keymaster(const char *passwd, const unsigned char *salt,
free(master_key);
if (rc) {
- printf("scrypt failed");
+ printf("scrypt failed\n");
return -1;
}
if (keymaster_sign_object(ftr, ikey, KEY_LEN_BYTES + IV_LEN_BYTES,
&signature, &signature_size)) {
- printf("Signing failed");
+ printf("Signing failed\n");
return -1;
}
@@ -1249,7 +1249,7 @@ static int scrypt_keymaster(const char *passwd, const unsigned char *salt,
free(signature);
if (rc) {
- printf("scrypt failed");
+ printf("scrypt failed\n");
return -1;
}
@@ -1929,12 +1929,12 @@ int check_unmounted_and_get_ftr(struct crypt_mnt_ftr* crypt_ftr)
property_get("ro.crypto.state", encrypted_state, "");
if ( master_key_saved || strcmp(encrypted_state, "encrypted") ) {
printf("encrypted fs already validated or not running with encryption,"
- " aborting");
- return -1;
+ " aborting\n");
+ //return -1;
}
if (get_crypt_ftr_and_key(crypt_ftr)) {
- printf("Error getting crypt footer and key");
+ printf("Error getting crypt footer and key\n");
return -1;
}
diff --git a/partition.cpp b/partition.cpp
index 642c3dd65..4bd545b17 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -278,21 +278,6 @@ 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) {
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) {