]> git.openpandora.org Git - pandora-kernel.git/commitdiff
ext4 crypto: add symlink encryption
authorTheodore Ts'o <tytso@mit.edu>
Thu, 16 Apr 2015 05:55:00 +0000 (01:55 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 16 Apr 2015 05:55:00 +0000 (01:55 -0400)
Signed-off-by: Uday Savagaonkar <savagaon@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/ext4_crypto.h
fs/ext4/inode.c
fs/ext4/namei.c
fs/ext4/symlink.c

index 5146e67e8d51a26891e9f7abdf077f52c3ff5118..86d15706d27a552184ded0cef192daf2848a8201 100644 (file)
@@ -2233,6 +2233,7 @@ extern int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
 extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
 
 /* inode.c */
+int ext4_inode_is_fast_symlink(struct inode *inode);
 struct buffer_head *ext4_getblk(handle_t *, struct inode *, ext4_lblk_t, int);
 struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int);
 int ext4_get_block_write(struct inode *inode, sector_t iblock,
index f7d46e8dc9d30c5100e579a0fe1ae5380ef8bc35..c2ba35a914b65f5b6ec4497e05ef37bd10b1bea8 100644 (file)
@@ -124,4 +124,24 @@ struct ext4_fname_crypto_ctx {
        unsigned ctfm_key_is_ready : 1;
 };
 
+/**
+ * For encrypted symlinks, the ciphertext length is stored at the beginning
+ * of the string in little-endian format.
+ */
+struct ext4_encrypted_symlink_data {
+       __le16 len;
+       char encrypted_path[1];
+} __attribute__((__packed__));
+
+/**
+ * This function is used to calculate the disk space required to
+ * store a filename of length l in encrypted symlink format.
+ */
+static inline u32 encrypted_symlink_data_len(u32 l)
+{
+       if (l < EXT4_CRYPTO_BLOCK_SIZE)
+               l = EXT4_CRYPTO_BLOCK_SIZE;
+       return (l + sizeof(struct ext4_encrypted_symlink_data) - 1);
+}
+
 #endif /* _EXT4_CRYPTO_H */
diff --cc fs/ext4/inode.c
Simple merge
diff --cc fs/ext4/namei.c
Simple merge
Simple merge