diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-04-20 18:19:06 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-05-28 18:41:48 -0400 |
commit | f424f664f0e8949361d268e2e91c7acc8cf63eb2 (patch) | |
tree | 985ed29a13fcd37b48f261e0db3df134079df176 /fs/f2fs/f2fs.h | |
parent | b93531dd7b9b39faace22abde2d5296e87b50499 (diff) |
f2fs crypto: add encryption policy and password salt support
This patch adds encryption policy and password salt support through ioctl
implementation.
It adds three ioctls:
F2FS_IOC_SET_ENCRYPTION_POLICY,
F2FS_IOC_GET_ENCRYPTION_POLICY,
F2FS_IOC_GET_ENCRYPTION_PWSALT, which use xattr operations.
Note that, these definition and codes are taken from ext4 crypto support.
For f2fs, xattr operations and on-disk flags for superblock and inode were
changed.
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ildar Muslukhov <muslukhovi@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 2c2948fbc35f..709660bd926a 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -229,6 +229,13 @@ static inline bool __has_cursum_space(struct f2fs_summary_block *sum, int size, | |||
229 | #define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) | 229 | #define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) |
230 | #define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) | 230 | #define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) |
231 | 231 | ||
232 | #define F2FS_IOC_SET_ENCRYPTION_POLICY \ | ||
233 | _IOR('f', 19, struct f2fs_encryption_policy) | ||
234 | #define F2FS_IOC_GET_ENCRYPTION_PWSALT \ | ||
235 | _IOW('f', 20, __u8[16]) | ||
236 | #define F2FS_IOC_GET_ENCRYPTION_POLICY \ | ||
237 | _IOW('f', 21, struct f2fs_encryption_policy) | ||
238 | |||
232 | /* | 239 | /* |
233 | * should be same as XFS_IOC_GOINGDOWN. | 240 | * should be same as XFS_IOC_GOINGDOWN. |
234 | * Flags for going down operation used by FS_IOC_GOINGDOWN | 241 | * Flags for going down operation used by FS_IOC_GOINGDOWN |
@@ -367,6 +374,8 @@ struct f2fs_map_blocks { | |||
367 | #define F2FS_ENCRYPTION_MODE_AES_256_CBC 3 | 374 | #define F2FS_ENCRYPTION_MODE_AES_256_CBC 3 |
368 | #define F2FS_ENCRYPTION_MODE_AES_256_CTS 4 | 375 | #define F2FS_ENCRYPTION_MODE_AES_256_CTS 4 |
369 | 376 | ||
377 | #include "f2fs_crypto.h" | ||
378 | |||
370 | #define DEF_DIR_LEVEL 0 | 379 | #define DEF_DIR_LEVEL 0 |
371 | 380 | ||
372 | struct f2fs_inode_info { | 381 | struct f2fs_inode_info { |
@@ -1946,4 +1955,11 @@ static inline int f2fs_sb_has_crypto(struct super_block *sb) | |||
1946 | return 0; | 1955 | return 0; |
1947 | #endif | 1956 | #endif |
1948 | } | 1957 | } |
1958 | |||
1959 | /* crypto_policy.c */ | ||
1960 | int f2fs_is_child_context_consistent_with_parent(struct inode *, | ||
1961 | struct inode *); | ||
1962 | int f2fs_inherit_context(struct inode *, struct inode *, struct page *); | ||
1963 | int f2fs_process_policy(const struct f2fs_encryption_policy *, struct inode *); | ||
1964 | int f2fs_get_policy(struct inode *, struct f2fs_encryption_policy *); | ||
1949 | #endif | 1965 | #endif |