Encryption: try wrapped key if the first time decryption fails
Change-Id: I108b7aeea41c6b85c851f40c1c4a7e25012e2463
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 85dc79d..41d8af2 100755
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -296,7 +296,14 @@
while (!Decrypt_Data->Mount(false) && --retry_count)
usleep(500);
if (Decrypt_Data->Mount(false)) {
- Decrypt_Data->Decrypt_FBE_DE();
+ if (!Decrypt_Data->Decrypt_FBE_DE()) {
+ LOGINFO("Trying wrapped key.\n");
+ property_set("fbe.data.wrappedkey", "true");
+ if (!Decrypt_Data->Decrypt_FBE_DE()) {
+ LOGERR("Unable to decrypt FBE device\n");
+ }
+ }
+
} else {
LOGINFO("Failed to mount data after metadata decrypt\n");
}