summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4_crypto.h
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-05-31 19:34:22 +0200
committerTheodore Ts'o <tytso@mit.edu>2015-05-31 19:34:22 +0200
commitc936e1ec2879e43599d801dfa6fe58e7ccfee433 (patch)
treea09688def0b1c75f7e23a9b1c98848f41e043d2e /fs/ext4/ext4_crypto.h
parentext4 crypto: require CONFIG_CRYPTO_CTR if ext4 encryption is enabled (diff)
downloadlinux-c936e1ec2879e43599d801dfa6fe58e7ccfee433.tar.xz
linux-c936e1ec2879e43599d801dfa6fe58e7ccfee433.zip
ext4 crypto: use per-inode tfm structure
As suggested by Herbert Xu, we shouldn't allocate a new tfm each time we read or write a page. Instead we can use a single tfm hanging off the inode's crypt_info structure for all of our encryption needs for that inode, since the tfm can be used by multiple crypto requests in parallel. Also use cmpxchg() to avoid races that could result in crypt_info structure getting doubly allocated or doubly freed. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4_crypto.h')
-rw-r--r--fs/ext4/ext4_crypto.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/fs/ext4/ext4_crypto.h b/fs/ext4/ext4_crypto.h
index c5258f242215..34e0d2455881 100644
--- a/fs/ext4/ext4_crypto.h
+++ b/fs/ext4/ext4_crypto.h
@@ -74,13 +74,11 @@ struct ext4_encryption_key {
} __attribute__((__packed__));
struct ext4_crypt_info {
- unsigned char ci_size;
char ci_data_mode;
char ci_filename_mode;
char ci_flags;
struct crypto_ablkcipher *ci_ctfm;
struct key *ci_keyring_key;
- char ci_raw[EXT4_MAX_KEY_SIZE];
char ci_master_key[EXT4_KEY_DESCRIPTOR_SIZE];
};
@@ -89,7 +87,6 @@ struct ext4_crypt_info {
#define EXT4_WRITE_PATH_FL 0x00000004
struct ext4_crypto_ctx {
- struct crypto_tfm *tfm; /* Crypto API context */
union {
struct {
struct page *bounce_page; /* Ciphertext page */