From af02e8aa9164f723a0c2a421a97c227c5adff4c2 Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Fri, 1 May 2015 05:24:04 -0700 Subject: [PATCH] DO NOT MERGE New faster file open kernel (chery-picked from commit b01dc1c52ec0a4ec5e07a18ffb5b105a997cc329) Bug: 18151196 Change-Id: Icdb3d9afa1db125102d01cd06f45dbc99ca78021 --- ext4_utils/ext4_crypt.cpp | 5 ++++- ext4_utils/ext4_crypt_init_extensions.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ext4_utils/ext4_crypt.cpp b/ext4_utils/ext4_crypt.cpp index 69358ba8..886d17a1 100644 --- a/ext4_utils/ext4_crypt.cpp +++ b/ext4_utils/ext4_crypt.cpp @@ -31,6 +31,7 @@ struct ext4_encryption_policy { char version; char contents_encryption_mode; char filenames_encryption_mode; + char flags; char master_key_descriptor[EXT4_KEY_DESCRIPTOR_SIZE]; } __attribute__((__packed__)); @@ -106,6 +107,7 @@ int do_policy_set(const char *directory, const char *policy, int policy_length) eep.version = 0; eep.contents_encryption_mode = EXT4_ENCRYPTION_MODE_AES_256_XTS; eep.filenames_encryption_mode = EXT4_ENCRYPTION_MODE_AES_256_CTS; + eep.flags = 0; memcpy(eep.master_key_descriptor, policy, EXT4_KEY_DESCRIPTOR_SIZE); ret = ioctl(fd, EXT4_IOC_SET_ENCRYPTION_POLICY, &eep); auto preserve_errno = errno; @@ -117,7 +119,8 @@ int do_policy_set(const char *directory, const char *policy, int policy_length) return -EINVAL; } - KLOG_INFO(TAG, "Encryption policy for %s is set to %s\n", directory, policy); + KLOG_INFO(TAG, "Encryption policy for %s is set to %02x%02x%02x%02x\n", + directory, policy[0], policy[1], policy[2], policy[3]); return 0; } diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp index 92445e68..cae1f7f6 100644 --- a/ext4_utils/ext4_crypt_init_extensions.cpp +++ b/ext4_utils/ext4_crypt_init_extensions.cpp @@ -148,7 +148,7 @@ int e4crypt_set_directory_policy(const char* dir) return 0; } - KLOG_INFO(TAG, "Setting policy %s\n", policy.c_str()); + KLOG_INFO(TAG, "Setting policy on %s\n", dir); int result = do_policy_set(dir, policy.c_str(), policy.size()); if (result) { KLOG_ERROR(TAG, "Setting %s policy on %s failed!\n", -- 2.11.0