From fefe5915b06a1121d885fba3680dd1b90027fd5d Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Sat, 30 Sep 2017 22:22:13 -0500 Subject: FBE for Pixel 2 Includes various minor fixes for building in Android 8 trees with r23+ tag Update FBE extended header in libtar to version 2 and include the entire ext4_encryption_policy structure now after translating the policy. See this post for more details: https://plus.google.com/u/1/+DeesTroy/posts/i33ygUi7tiu Change-Id: I2af981e51f459b17fcd895fb8c2d3f6c8200e24b --- crypto/ext4crypt/ext4crypt_tar.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'crypto/ext4crypt/ext4crypt_tar.h') diff --git a/crypto/ext4crypt/ext4crypt_tar.h b/crypto/ext4crypt/ext4crypt_tar.h index 1c9cef0a5..c35d11571 100644 --- a/crypto/ext4crypt/ext4crypt_tar.h +++ b/crypto/ext4crypt/ext4crypt_tar.h @@ -21,8 +21,25 @@ #include #include +// ext4enc:TODO Include structure from somewhere sensible +// MUST be in sync with ext4_crypto.c in kernel +#define EXT4_KEY_DESCRIPTOR_SIZE 8 +#define EXT4_KEY_DESCRIPTOR_SIZE_HEX 17 + +// ext4enc:TODO Get value from somewhere sensible +#define EXT4_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct ext4_encryption_policy) +#define EXT4_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct ext4_encryption_policy) + __BEGIN_DECLS +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__)); + bool lookup_ref_key(const char* policy, char* policy_type); bool lookup_ref_tar(const char* policy_type, char* policy); @@ -31,6 +48,9 @@ bool e4crypt_policy_set(const char *directory, const char *policy, size_t policy_length, int contents_encryption_mode); bool e4crypt_policy_get(const char *directory, char *policy, size_t policy_length, int contents_encryption_mode); +void e4crypt_policy_fill_default_struct(struct ext4_encryption_policy *eep); +bool e4crypt_policy_set_struct(const char *directory, const struct ext4_encryption_policy *eep); +bool e4crypt_policy_get_struct(const char *directory, struct ext4_encryption_policy *eep); bool e4crypt_set_mode(); __END_DECLS -- cgit v1.2.3