summaryrefslogtreecommitdiff
path: root/fs/ext4/ext4_crypto.h
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-05-18 20:16:47 +0300
committerTheodore Ts'o <tytso@mit.edu>2015-05-18 20:16:47 +0300
commite2881b1b51d871a72911faf2fc7e090655940506 (patch)
tree07bc66d72cc03479c98b7b63edb53f1fa4069383 /fs/ext4/ext4_crypto.h
parentd229959072eba40e1c2a4f53f8af17f1e770eb66 (diff)
downloadlinux-e2881b1b51d871a72911faf2fc7e090655940506.tar.xz
ext4 crypto: separate kernel and userspace structure for the key
Use struct ext4_encryption_key only for the master key passed via the kernel keyring. For internal kernel space users, we now use struct ext4_crypt_info. This will allow us to put information from the policy structure so we can cache it and avoid needing to constantly looking up the extended attribute. We will do this in a spearate patch. This patch is mostly mechnical to make it easier for patch review. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4_crypto.h')
-rw-r--r--fs/ext4/ext4_crypto.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/ext4/ext4_crypto.h b/fs/ext4/ext4_crypto.h
index 552424ae3ab3..deecbe8968d1 100644
--- a/fs/ext4/ext4_crypto.h
+++ b/fs/ext4/ext4_crypto.h
@@ -66,10 +66,17 @@ struct ext4_encryption_context {
#define EXT4_KEY_DESC_PREFIX "ext4:"
#define EXT4_KEY_DESC_PREFIX_SIZE 5
+/* This is passed in from userspace into the kernel keyring */
struct ext4_encryption_key {
- uint32_t mode;
- char raw[EXT4_MAX_KEY_SIZE];
- uint32_t size;
+ __u32 mode;
+ char raw[EXT4_MAX_KEY_SIZE];
+ __u32 size;
+} __attribute__((__packed__));
+
+struct ext4_crypt_info {
+ unsigned char ci_mode;
+ unsigned char ci_size;
+ char ci_raw[EXT4_MAX_KEY_SIZE];
};
#define EXT4_CTX_REQUIRES_FREE_ENCRYPT_FL 0x00000001
@@ -125,7 +132,7 @@ struct ext4_fname_crypto_ctx {
u32 lim;
struct crypto_ablkcipher *ctfm;
struct crypto_hash *htfm;
- struct ext4_encryption_key key;
+ struct ext4_crypt_info ci;
unsigned flags : 8;
unsigned has_valid_key : 1;
unsigned ctfm_key_is_ready : 1;