decrypt: AOSP 10 requires the use of fscrypt

fscrypt aosp doc: https://source.android.com/security/encryption/file-based
kernel fscrypt doc: https://www.kernel.org/doc/html/v4.18/filesystems/fscrypt.html

This commit implements the ability for TWRP to use fscrypt to decrypt
files on the fscrypt implementation. It has been implemented mostly
in a new successor library to e4crypt called libtwrpfscrypt. Most of the
code was ported from AOSP vold.

Notable updates include:
 - updated policy storage by libtar
 - lookup of fbe policies by libtwrpfscrypt
 - threaded keystore operations

Big thanks to Dees_Troy for the initial trailblazing
of encryption in TWRP.

Change-Id: I69cd2eba3693a9914e00213d4943229635d0cdae
diff --git a/twrpTar.cpp b/twrpTar.cpp
old mode 100644
new mode 100755
index b2d0ea6..c4a7156
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -1,6 +1,6 @@
 
 /*
-	Copyright 2013 to 2016 bigbiff/Dees_Troy TeamWin
+	Copyright 2013 to 2020 TeamWin
 	This file is part of TWRP/TeamWin Recovery Project.
 
 	TWRP is free software: you can redistribute it and/or modify
@@ -47,6 +47,7 @@
 #include "twrp-functions.hpp"
 #include "gui/gui.hpp"
 #include "progresstracking.hpp"
+
 #ifndef BUILD_TWRPTAR_MAIN
 #include "data.hpp"
 #include "infomanager.hpp"
@@ -54,8 +55,19 @@
 #endif //ndef BUILD_TWRPTAR_MAIN
 
 #ifdef TW_INCLUDE_FBE
+#ifdef USE_FSCRYPT
+#include "fscrypt_policy.h"
+#else
 #include "crypto/ext4crypt/ext4crypt_tar.h"
-#define TWTAR_FLAGS TAR_GNU | TAR_STORE_SELINUX | TAR_STORE_POSIX_CAP | TAR_STORE_ANDROID_USER_XATTR |TAR_STORE_EXT4_POL
+#endif
+#endif
+
+#ifdef TW_INCLUDE_FBE
+#ifdef USE_FSCRYPT
+#define TWTAR_FLAGS TAR_GNU | TAR_STORE_SELINUX | TAR_STORE_POSIX_CAP | TAR_STORE_ANDROID_USER_XATTR | TAR_STORE_FSCRYPT_POL
+#else
+#define TWTAR_FLAGS TAR_GNU | TAR_STORE_SELINUX | TAR_STORE_POSIX_CAP | TAR_STORE_ANDROID_USER_XATTR | TAR_STORE_EXT4_POL
+#endif
 #else
 #define TWTAR_FLAGS TAR_GNU | TAR_STORE_SELINUX | TAR_STORE_POSIX_CAP | TAR_STORE_ANDROID_USER_XATTR
 #endif
@@ -79,8 +91,12 @@
 	output_fd = -1;
 	backup_exclusions = NULL;
 #ifdef TW_INCLUDE_FBE
+#ifdef USE_FSCRYPT
+	fscrypt_set_mode();
+#else
 	e4crypt_set_mode();
 #endif
+#endif
 }
 
 twrpTar::~twrpTar(void) {