diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-07-10 14:01:03 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-07-10 14:01:03 -0400 |
commit | a7550b30ab709ffb9bbe48669adf7d8556f3698f (patch) | |
tree | 5ed986d93b2df41cad68bdfa0851604bb039d1d1 /fs/ext4/ioctl.c | |
parent | ff0031d848a0cd7002606f9feef958de8d5edf19 (diff) |
ext4 crypto: migrate into vfs's crypto engine
This patch removes the most parts of internal crypto codes.
And then, it modifies and adds some ext4-specific crypt codes to use the generic
facility.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index b5a39b00265e..10686fd67fb4 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -770,19 +770,13 @@ resizefs_out: | |||
770 | return ext4_ext_precache(inode); | 770 | return ext4_ext_precache(inode); |
771 | case EXT4_IOC_SET_ENCRYPTION_POLICY: { | 771 | case EXT4_IOC_SET_ENCRYPTION_POLICY: { |
772 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 772 | #ifdef CONFIG_EXT4_FS_ENCRYPTION |
773 | struct ext4_encryption_policy policy; | 773 | struct fscrypt_policy policy; |
774 | int err = 0; | ||
775 | 774 | ||
776 | if (copy_from_user(&policy, | 775 | if (copy_from_user(&policy, |
777 | (struct ext4_encryption_policy __user *)arg, | 776 | (struct fscrypt_policy __user *)arg, |
778 | sizeof(policy))) { | 777 | sizeof(policy))) |
779 | err = -EFAULT; | 778 | return -EFAULT; |
780 | goto encryption_policy_out; | 779 | return fscrypt_process_policy(inode, &policy); |
781 | } | ||
782 | |||
783 | err = ext4_process_policy(&policy, inode); | ||
784 | encryption_policy_out: | ||
785 | return err; | ||
786 | #else | 780 | #else |
787 | return -EOPNOTSUPP; | 781 | return -EOPNOTSUPP; |
788 | #endif | 782 | #endif |
@@ -825,12 +819,12 @@ encryption_policy_out: | |||
825 | } | 819 | } |
826 | case EXT4_IOC_GET_ENCRYPTION_POLICY: { | 820 | case EXT4_IOC_GET_ENCRYPTION_POLICY: { |
827 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 821 | #ifdef CONFIG_EXT4_FS_ENCRYPTION |
828 | struct ext4_encryption_policy policy; | 822 | struct fscrypt_policy policy; |
829 | int err = 0; | 823 | int err = 0; |
830 | 824 | ||
831 | if (!ext4_encrypted_inode(inode)) | 825 | if (!ext4_encrypted_inode(inode)) |
832 | return -ENOENT; | 826 | return -ENOENT; |
833 | err = ext4_get_policy(inode, &policy); | 827 | err = fscrypt_get_policy(inode, &policy); |
834 | if (err) | 828 | if (err) |
835 | return err; | 829 | return err; |
836 | if (copy_to_user((void __user *)arg, &policy, sizeof(policy))) | 830 | if (copy_to_user((void __user *)arg, &policy, sizeof(policy))) |