Whamcloud - gitweb
LU-16202 build: bio_alloc takes struct block_device
[fs/lustre-release.git] / libcfs / libcfs / crypto / keysetup.c
index 784eacc..67fe888 100644 (file)
 
 #include "llcrypt_private.h"
 
+#ifdef HAVE_CIPHER_H
+#include <crypto/internal/cipher.h>
+
+MODULE_IMPORT_NS(CRYPTO_INTERNAL);
+#endif
+
 static struct crypto_shash *essiv_hash_tfm;
 
 static struct llcrypt_mode available_modes[] = {
@@ -468,7 +474,14 @@ int llcrypt_get_encryption_info(struct inode *inode)
                memset(&ctx, 0, sizeof(ctx));
                ctx.version = LLCRYPT_CONTEXT_V1;
                ctx.v1.contents_encryption_mode = LLCRYPT_MODE_AES_256_XTS;
-               ctx.v1.filenames_encryption_mode = LLCRYPT_MODE_AES_256_CTS;
+               if (lsi->lsi_flags & LSI_FILENAME_ENC) {
+                       ctx.v1.filenames_encryption_mode =
+                               LLCRYPT_MODE_AES_256_CTS;
+               } else {
+                       llcrypt_warn(inode,
+                       "dummy enc: forcing filenames_encryption_mode to null");
+                       ctx.v1.filenames_encryption_mode = LLCRYPT_MODE_NULL;
+               }
                memset(ctx.v1.master_key_descriptor, 0x42,
                       LLCRYPT_KEY_DESCRIPTOR_SIZE);
                res = sizeof(ctx.v1);