FsCrypt update: support fscrypt policies v1 and v2
This patchset introduces support decryption for Android 11.
In this update we deprecate ext4crypt. To specify the
policy version to use, use TW_USE_FSCRYPT_POLICY := 1 or
TW_USE_FSCRYPT_POLICY := 2. By default policy version will
be set to 2 if this variable is omitted.
Change-Id: I62a29c1bef36c259ec4b11259f71be613d20a112
diff --git a/twrp-functions.hpp b/twrp-functions.hpp
index 1b9c694..8979a66 100755
--- a/twrp-functions.hpp
+++ b/twrp-functions.hpp
@@ -115,8 +115,15 @@
static bool Is_TWRP_App_In_System(); // Check if the TWRP app is installed in the system partition
static void checkforapp();
static int Property_Override(string Prop_Name, string Prop_Value); // Override properties (including ro. properties)
- static bool Get_Encryption_Policy(fscrypt_encryption_policy &policy, std::string path); // return encryption policy for path
- static bool Set_Encryption_Policy(std::string path, const fscrypt_encryption_policy &policy); // set encryption policy for path
+#ifdef TW_INCLUDE_CRYPTO
+#ifdef USE_FSCRYPT_POLICY_V1
+ static bool Get_Encryption_Policy(struct fscrypt_policy_v1 &policy, std::string path); // return encryption policy for path
+ static bool Set_Encryption_Policy(std::string path, struct fscrypt_policy_v1 &policy); // set encryption policy for path
+#else
+ static bool Get_Encryption_Policy(struct fscrypt_policy_v2 &policy, std::string path); // return encryption policy for path
+ static bool Set_Encryption_Policy(std::string path, struct fscrypt_policy_v2 &policy); // set encryption policy for path
+#endif
+#endif
static void List_Mounts();
static void Clear_Bootloader_Message();
static string Check_For_TwrpFolder();