From a1de1496a936be088f03add87144a8fcbe94d0e3 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Wed, 4 Nov 2015 11:58:27 -0600 Subject: Minor update to decrypt device routine for Nexus 6P decrypt Move property setting of ro.crypto.state to after mounting any needed partitions so that we can use this property as a trigger for running services in init. Check to see if the property is already set so that we do not set it and sleep multiple times if the user enters an incorrect password. Change-Id: I55558c5e227377381101b6305569d9eb31040790 --- partitionmanager.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'partitionmanager.cpp') diff --git a/partitionmanager.cpp b/partitionmanager.cpp index ad17fe4a6..945a96cc2 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -1436,12 +1436,10 @@ void TWPartitionManager::Update_System_Details(void) { int TWPartitionManager::Decrypt_Device(string Password) { #ifdef TW_INCLUDE_CRYPTO int ret_val, password_len; - char crypto_blkdev[255], cPassword[255]; + char crypto_state[PROPERTY_VALUE_MAX], crypto_blkdev[PROPERTY_VALUE_MAX], cPassword[255]; size_t result; std::vector::iterator iter; - property_set("ro.crypto.state", "encrypted"); - // Mount any partitions that need to be mounted for decrypt for (iter = Partitions.begin(); iter != Partitions.end(); iter++) { if ((*iter)->Mount_To_Decrypt) { @@ -1449,6 +1447,13 @@ int TWPartitionManager::Decrypt_Device(string Password) { } } + property_get("ro.crypto.state", crypto_state, "error"); + if (strcmp(crypto_state, "error") == 0) { + property_set("ro.crypto.state", "encrypted"); + // Sleep for a bit so that services can start if needed + sleep(1); + } + strcpy(cPassword, Password.c_str()); int pwret = cryptfs_check_passwd(cPassword); -- cgit v1.2.3