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
This commit is contained in:
bigbiff
2021-05-18 20:35:51 -04:00
parent 9c1709b963
commit a957f078be
89 changed files with 6057 additions and 9395 deletions
+8 -1
View File
@@ -391,6 +391,8 @@ static int cryptfs_enable_inplace_f2fs(const char* crypto_blkdev, const char* re
struct encryptGroupsData data;
struct f2fs_info* f2fs_info = NULL;
int rc = ENABLE_INPLACE_ERR_OTHER;
struct timespec time_started = {0};
if (previously_encrypted_upto > *size_already_done) {
LOG(DEBUG) << "Not fast encrypting since resuming part way through";
return ENABLE_INPLACE_ERR_OTHER;
@@ -423,9 +425,14 @@ static int cryptfs_enable_inplace_f2fs(const char* crypto_blkdev, const char* re
data.one_pct = data.tot_used_blocks / 100;
data.cur_pct = 0;
data.time_started = time(NULL);
if (clock_gettime(CLOCK_MONOTONIC, &time_started)) {
LOG(WARNING) << "Error getting time at start";
// Note - continue anyway - we'll run with 0
}
data.time_started = time_started.tv_sec;
data.remaining_time = -1;
data.buffer = (char*)malloc(f2fs_info->block_size);
if (!data.buffer) {
LOG(ERROR) << "Failed to allocate crypto buffer";