]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/crypto/fscrypt_private.h
Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
[linux.git] / fs / crypto / fscrypt_private.h
index fea7f55474285080d79d36df8752483786d0932d..9aae851409e55ffecedb9d9b2a7ac656acd25439 100644 (file)
@@ -12,6 +12,7 @@
 #define _FSCRYPT_PRIVATE_H
 
 #include <linux/fscrypt.h>
+#include <linux/siphash.h>
 #include <crypto/hash.h>
 
 #define CONST_STRLEN(str)      (sizeof(str) - 1)
@@ -188,6 +189,14 @@ struct fscrypt_info {
         */
        struct fscrypt_direct_key *ci_direct_key;
 
+       /*
+        * This inode's hash key for filenames.  This is a 128-bit SipHash-2-4
+        * key.  This is only set for directories that use a keyed dirhash over
+        * the plaintext filenames -- currently just casefolded directories.
+        */
+       siphash_key_t ci_dirhash_key;
+       bool ci_dirhash_key_initialized;
+
        /* The encryption policy used by this inode */
        union fscrypt_policy ci_policy;
 
@@ -260,9 +269,10 @@ extern int fscrypt_init_hkdf(struct fscrypt_hkdf *hkdf, const u8 *master_key,
  * output doesn't reveal another.
  */
 #define HKDF_CONTEXT_KEY_IDENTIFIER    1
-#define HKDF_CONTEXT_PER_FILE_KEY      2
+#define HKDF_CONTEXT_PER_FILE_ENC_KEY  2
 #define HKDF_CONTEXT_DIRECT_KEY                3
 #define HKDF_CONTEXT_IV_INO_LBLK_64_KEY        4
+#define HKDF_CONTEXT_DIRHASH_KEY       5
 
 extern int fscrypt_hkdf_expand(const struct fscrypt_hkdf *hkdf, u8 context,
                               const u8 *info, unsigned int infolen,
@@ -431,8 +441,11 @@ extern struct crypto_skcipher *
 fscrypt_allocate_skcipher(struct fscrypt_mode *mode, const u8 *raw_key,
                          const struct inode *inode);
 
-extern int fscrypt_set_derived_key(struct fscrypt_info *ci,
-                                  const u8 *derived_key);
+extern int fscrypt_set_per_file_enc_key(struct fscrypt_info *ci,
+                                       const u8 *raw_key);
+
+extern int fscrypt_derive_dirhash_key(struct fscrypt_info *ci,
+                                     const struct fscrypt_master_key *mk);
 
 /* keysetup_v1.c */