diff options
author | Richard Weinberger <richard@nod.at> | 2016-09-29 22:20:19 +0200 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-12-12 23:07:38 +0100 |
commit | 7799953b34d1838b30e3d69fd36aa3288ac1e89d (patch) | |
tree | 30866ef1ac8df56932411a29f3d13159a0bd042d /fs/ubifs/ubifs.h | |
parent | ubifs: Constify struct inode pointer in ubifs_crypt_is_encrypted() (diff) | |
download | linux-7799953b34d1838b30e3d69fd36aa3288ac1e89d.tar.xz linux-7799953b34d1838b30e3d69fd36aa3288ac1e89d.zip |
ubifs: Implement encrypt/decrypt for all IO
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/ubifs.h')
-rw-r--r-- | fs/ubifs/ubifs.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 74a8def1f7b7..2df3c0d21020 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -135,6 +135,12 @@ */ #define WORST_COMPR_FACTOR 2 +#ifdef CONFIG_UBIFS_FS_ENCRYPTION +#define UBIFS_CIPHER_BLOCK_SIZE FS_CRYPTO_BLOCK_SIZE +#else +#define UBIFS_CIPHER_BLOCK_SIZE 0 +#endif + /* * How much memory is needed for a buffer where we compress a data node. */ @@ -1774,8 +1780,6 @@ void ubifs_compress(const struct ubifs_info *c, const void *in_buf, int in_len, int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len, void *out, int *out_len, int compr_type); -extern struct fscrypt_operations ubifs_crypt_operations; - #include "debug.h" #include "misc.h" #include "key.h" @@ -1803,8 +1807,31 @@ extern struct fscrypt_operations ubifs_crypt_operations; #define fscrypt_fname_free_buffer fscrypt_notsupp_fname_free_buffer #define fscrypt_fname_disk_to_usr fscrypt_notsupp_fname_disk_to_usr #define fscrypt_fname_usr_to_disk fscrypt_notsupp_fname_usr_to_disk +static inline int ubifs_encrypt(const struct inode *inode, + struct ubifs_data_node *dn, + unsigned int in_len, unsigned int *out_len, + int block) +{ + ubifs_assert(0); + return -EOPNOTSUPP; +} +static inline int ubifs_decrypt(const struct inode *inode, + struct ubifs_data_node *dn, + unsigned int *out_len, int block) +{ + ubifs_assert(0); + return -EOPNOTSUPP; +} +#else +/* crypto.c */ +int ubifs_encrypt(const struct inode *inode, struct ubifs_data_node *dn, + unsigned int in_len, unsigned int *out_len, int block); +int ubifs_decrypt(const struct inode *inode, struct ubifs_data_node *dn, + unsigned int *out_len, int block); #endif +extern struct fscrypt_operations ubifs_crypt_operations; + static inline bool __ubifs_crypt_is_encrypted(struct inode *inode) { struct ubifs_inode *ui = ubifs_inode(inode); |