Skip to content

Commit

Permalink
fscrypt: move v1 policy key setup to keysetup_v1.c
Browse files Browse the repository at this point in the history
In preparation for introducing v2 encryption policies which will find
and derive encryption keys differently from the current v1 encryption
policies, move the v1 policy-specific key setup code from keyinfo.c into
keysetup_v1.c.

Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eric Biggers <ebiggers@google.com>
  • Loading branch information
Eric Biggers committed Aug 13, 2019
1 parent 3ec4f2a commit 0109ce7
Show file tree
Hide file tree
Showing 4 changed files with 369 additions and 322 deletions.
8 changes: 7 additions & 1 deletion fs/crypto/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_FS_ENCRYPTION) += fscrypto.o

fscrypto-y := crypto.o fname.o hooks.o keyinfo.o policy.o
fscrypto-y := crypto.o \
fname.o \
hooks.o \
keyinfo.o \
keysetup_v1.o \
policy.o

fscrypto-$(CONFIG_BLOCK) += bio.o
17 changes: 17 additions & 0 deletions fs/crypto/fscrypt_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,21 @@ fscrypt_mode_supports_direct_key(const struct fscrypt_mode *mode)
return mode->ivsize >= offsetofend(union fscrypt_iv, nonce);
}

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);

/* keysetup_v1.c */

extern void fscrypt_put_direct_key(struct fscrypt_direct_key *dk);

extern int fscrypt_setup_v1_file_key(struct fscrypt_info *ci,
const u8 *raw_master_key);

extern int fscrypt_setup_v1_file_key_via_subscribed_keyrings(
struct fscrypt_info *ci);

#endif /* _FSCRYPT_PRIVATE_H */
Loading

0 comments on commit 0109ce7

Please sign in to comment.