diff options
author | Michael Halcrow <mhalcrow@google.com> | 2015-04-12 00:43:56 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2015-04-12 00:43:56 -0400 |
commit | b30ab0e03407d2aa2d9316cba199c757e4bfc8ad (patch) | |
tree | 900754eb3fe069f90bb5ea2c1df1ed88cf701eb5 /fs/ext4/super.c | |
parent | 9bd8212f981ea6375911fe055382ad7529be5b28 (diff) |
ext4 crypto: add ext4 encryption facilities
On encrypt, we will re-assign the buffer_heads to point to a bounce
page rather than the control_page (which is the original page to write
that contains the plaintext). The block I/O occurs against the bounce
page. On write completion, we re-assign the buffer_heads to the
original plaintext page.
On decrypt, we will attach a read completion callback to the bio
struct. This read completion will decrypt the read contents in-place
prior to setting the page up-to-date.
The current encryption mode, AES-256-XTS, lacks cryptographic
integrity. AES-256-GCM is in-plan, but we will need to devise a
mechanism for handling the integrity data.
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index e47a552fea05..1008ca258de4 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -876,6 +876,9 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) | |||
876 | atomic_set(&ei->i_ioend_count, 0); | 876 | atomic_set(&ei->i_ioend_count, 0); |
877 | atomic_set(&ei->i_unwritten, 0); | 877 | atomic_set(&ei->i_unwritten, 0); |
878 | INIT_WORK(&ei->i_rsv_conversion_work, ext4_end_io_rsv_work); | 878 | INIT_WORK(&ei->i_rsv_conversion_work, ext4_end_io_rsv_work); |
879 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | ||
880 | ei->i_encryption_key.mode = EXT4_ENCRYPTION_MODE_INVALID; | ||
881 | #endif | ||
879 | 882 | ||
880 | return &ei->vfs_inode; | 883 | return &ei->vfs_inode; |
881 | } | 884 | } |
@@ -3431,6 +3434,11 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3431 | if (sb->s_bdev->bd_part) | 3434 | if (sb->s_bdev->bd_part) |
3432 | sbi->s_sectors_written_start = | 3435 | sbi->s_sectors_written_start = |
3433 | part_stat_read(sb->s_bdev->bd_part, sectors[1]); | 3436 | part_stat_read(sb->s_bdev->bd_part, sectors[1]); |
3437 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | ||
3438 | /* Modes of operations for file and directory encryption. */ | ||
3439 | sbi->s_file_encryption_mode = EXT4_ENCRYPTION_MODE_AES_256_XTS; | ||
3440 | sbi->s_dir_encryption_mode = EXT4_ENCRYPTION_MODE_INVALID; | ||
3441 | #endif | ||
3434 | 3442 | ||
3435 | /* Cleanup superblock name */ | 3443 | /* Cleanup superblock name */ |
3436 | for (cp = sb->s_id; (cp = strchr(cp, '/'));) | 3444 | for (cp = sb->s_id; (cp = strchr(cp, '/'));) |