Whamcloud - gitweb
LU-15406 sec: fix in-kernel fscrypt support
[fs/lustre-release.git] / lustre / include / lustre_crypto.h
index f71ddf8..b6c1c8a 100644 (file)
@@ -36,6 +36,9 @@ void llcrypt_free_ctx(void *encctx, __u32 size);
 bool ll_sbi_has_test_dummy_encryption(struct ll_sb_info *sbi);
 bool ll_sbi_has_encrypt(struct ll_sb_info *sbi);
 void ll_sbi_set_encrypt(struct ll_sb_info *sbi, bool set);
+/* sizeof(struct fscrypt_context_v2) = 40 */
+#define LLCRYPT_ENC_CTX_SIZE 40
+
 
 /* Encoding/decoding routines inspired from yEnc principles.
  * We just take care of a few critical characters:
@@ -106,10 +109,19 @@ static inline int critical_decode(const u8 *src, int len, char *dst)
 #define __FS_HAS_ENCRYPTION 1
 #include <linux/fscrypt.h>
 
+#define LLCRYPT_FNAME_DIGEST_SIZE      FSCRYPT_FNAME_DIGEST_SIZE
+#define LLCRYPT_FNAME_DIGEST           FSCRYPT_FNAME_DIGEST
+#define llcrypt_name                   fscrypt_name
+#define llcrypt_str                    fscrypt_str
+#define LLTR_INIT                      FSTR_INIT
+#define LLCRYPT_FNAME_MAX_UNDIGESTED_SIZE \
+       FSCRYPT_FNAME_MAX_UNDIGESTED_SIZE
 #define llcrypt_operations     fscrypt_operations
 #define llcrypt_symlink_data   fscrypt_symlink_data
 #define llcrypt_dummy_context_enabled(inode) \
        fscrypt_dummy_context_enabled(inode)
+#define llcrypt_require_key(inode)     \
+       fscrypt_require_key(inode)
 #define llcrypt_has_encryption_key(inode) fscrypt_has_encryption_key(inode)
 #define llcrypt_encrypt_pagecache_blocks(page, len, offs, gfp_flags)   \
        fscrypt_encrypt_pagecache_blocks(page, len, offs, gfp_flags)
@@ -129,6 +141,7 @@ static inline int critical_decode(const u8 *src, int len, char *dst)
 #define llcrypt_ioctl_set_policy(filp, arg)  fscrypt_ioctl_set_policy(filp, arg)
 #define llcrypt_ioctl_get_policy_ex(filp, arg) \
        fscrypt_ioctl_get_policy_ex(filp, arg)
+#define llcrypt_policy_has_filename_enc(inode) true
 #define llcrypt_ioctl_add_key(filp, arg)       fscrypt_ioctl_add_key(filp, arg)
 #define llcrypt_ioctl_remove_key(filp, arg)  fscrypt_ioctl_remove_key(filp, arg)
 #define llcrypt_ioctl_remove_key_all_users(filp, arg)  \
@@ -157,6 +170,8 @@ static inline int critical_decode(const u8 *src, int len, char *dst)
        fscrypt_prepare_lookup(dir, dentry, fname)
 #define llcrypt_encrypt_symlink(inode, target, len, disk_link) \
        fscrypt_encrypt_symlink(inode, target, len, disk_link)
+#define __llcrypt_encrypt_symlink(inode, target, len, disk_link) \
+       __fscrypt_encrypt_symlink(inode, target, len, disk_link)
 #define llcrypt_prepare_symlink(dir, target, len, max_len, disk_link)  \
        fscrypt_prepare_symlink(dir, target, len, max_len, disk_link)
 #define llcrypt_get_symlink(inode, caddr, max_size, done) \