Skip to content

Commit 0109ce7

Browse files
committed
fscrypt: move v1 policy key setup to keysetup_v1.c
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>
1 parent 3ec4f2a commit 0109ce7

4 files changed

Lines changed: 369 additions & 322 deletions

File tree

‎fs/crypto/Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-$(CONFIG_FS_ENCRYPTION) += fscrypto.o
33

4-
fscrypto-y := crypto.o fname.o hooks.o keyinfo.o policy.o
4+
fscrypto-y := crypto.o \
5+
fname.o \
6+
hooks.o \
7+
keyinfo.o \
8+
keysetup_v1.o \
9+
policy.o
10+
511
fscrypto-$(CONFIG_BLOCK) += bio.o

‎fs/crypto/fscrypt_private.h‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,21 @@ fscrypt_mode_supports_direct_key(const struct fscrypt_mode *mode)
173173
return mode->ivsize >= offsetofend(union fscrypt_iv, nonce);
174174
}
175175

176+
extern struct crypto_skcipher *
177+
fscrypt_allocate_skcipher(struct fscrypt_mode *mode, const u8 *raw_key,
178+
const struct inode *inode);
179+
180+
extern int fscrypt_set_derived_key(struct fscrypt_info *ci,
181+
const u8 *derived_key);
182+
183+
/* keysetup_v1.c */
184+
185+
extern void fscrypt_put_direct_key(struct fscrypt_direct_key *dk);
186+
187+
extern int fscrypt_setup_v1_file_key(struct fscrypt_info *ci,
188+
const u8 *raw_master_key);
189+
190+
extern int fscrypt_setup_v1_file_key_via_subscribed_keyrings(
191+
struct fscrypt_info *ci);
192+
176193
#endif /* _FSCRYPT_PRIVATE_H */

0 commit comments

Comments
 (0)