fscrypt updates for 5.19
Some cleanups for fs/crypto/:
- Split up the misleadingly-named FS_CRYPTO_BLOCK_SIZE constant.
- Consistently report the encryption implementation that is being used.
- Add helper functions for the test_dummy_encryption mount option that
work properly with the new mount API. ext4 and f2fs will use these.
-----BEGIN PGP SIGNATURE-----
iIoEABYIADIWIQSacvsUNc7UX4ntmEPzXCl4vpKOKwUCYosv0xQcZWJpZ2dlcnNA
Z29vZ2xlLmNvbQAKCRDzXCl4vpKOK17XAP0bsA+vaVC/r408kPVZKdbN/aekFJa6
u81cTj2Yn1qylAEA4/3BXmjZerHF496lfFZCk7VpnN/3l5YOig2k1TECqQ8=
=Glr9
-----END PGP SIGNATURE-----
Merge tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt
Pull fscrypt updates from Eric Biggers:
"Some cleanups for fs/crypto/:
- Split up the misleadingly-named FS_CRYPTO_BLOCK_SIZE constant.
- Consistently report the encryption implementation that is being
used.
- Add helper functions for the test_dummy_encryption mount option
that work properly with the new mount API. ext4 and f2fs will use
these"
* tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
fscrypt: add new helper functions for test_dummy_encryption
fscrypt: factor out fscrypt_policy_to_key_spec()
fscrypt: log when starting to use inline encryption
fscrypt: split up FS_CRYPTO_BLOCK_SIZE
This commit is contained in:
commit
c1f4cfdbef
9 changed files with 239 additions and 98 deletions
|
|
@ -18,10 +18,21 @@
|
|||
#include <linux/slab.h>
|
||||
#include <uapi/linux/fscrypt.h>
|
||||
|
||||
#define FS_CRYPTO_BLOCK_SIZE 16
|
||||
/*
|
||||
* The lengths of all file contents blocks must be divisible by this value.
|
||||
* This is needed to ensure that all contents encryption modes will work, as
|
||||
* some of the supported modes don't support arbitrarily byte-aligned messages.
|
||||
*
|
||||
* Since the needed alignment is 16 bytes, most filesystems will meet this
|
||||
* requirement naturally, as typical block sizes are powers of 2. However, if a
|
||||
* filesystem can generate arbitrarily byte-aligned block lengths (e.g., via
|
||||
* compression), then it will need to pad to this alignment before encryption.
|
||||
*/
|
||||
#define FSCRYPT_CONTENTS_ALIGNMENT 16
|
||||
|
||||
union fscrypt_policy;
|
||||
struct fscrypt_info;
|
||||
struct fs_parameter;
|
||||
struct seq_file;
|
||||
|
||||
struct fscrypt_str {
|
||||
|
|
@ -279,10 +290,19 @@ struct fscrypt_dummy_policy {
|
|||
const union fscrypt_policy *policy;
|
||||
};
|
||||
|
||||
int fscrypt_parse_test_dummy_encryption(const struct fs_parameter *param,
|
||||
struct fscrypt_dummy_policy *dummy_policy);
|
||||
bool fscrypt_dummy_policies_equal(const struct fscrypt_dummy_policy *p1,
|
||||
const struct fscrypt_dummy_policy *p2);
|
||||
int fscrypt_set_test_dummy_encryption(struct super_block *sb, const char *arg,
|
||||
struct fscrypt_dummy_policy *dummy_policy);
|
||||
void fscrypt_show_test_dummy_encryption(struct seq_file *seq, char sep,
|
||||
struct super_block *sb);
|
||||
static inline bool
|
||||
fscrypt_is_dummy_policy_set(const struct fscrypt_dummy_policy *dummy_policy)
|
||||
{
|
||||
return dummy_policy->policy != NULL;
|
||||
}
|
||||
static inline void
|
||||
fscrypt_free_dummy_policy(struct fscrypt_dummy_policy *dummy_policy)
|
||||
{
|
||||
|
|
@ -293,6 +313,8 @@ fscrypt_free_dummy_policy(struct fscrypt_dummy_policy *dummy_policy)
|
|||
/* keyring.c */
|
||||
void fscrypt_sb_free(struct super_block *sb);
|
||||
int fscrypt_ioctl_add_key(struct file *filp, void __user *arg);
|
||||
int fscrypt_add_test_dummy_key(struct super_block *sb,
|
||||
const struct fscrypt_dummy_policy *dummy_policy);
|
||||
int fscrypt_ioctl_remove_key(struct file *filp, void __user *arg);
|
||||
int fscrypt_ioctl_remove_key_all_users(struct file *filp, void __user *arg);
|
||||
int fscrypt_ioctl_get_key_status(struct file *filp, void __user *arg);
|
||||
|
|
@ -467,12 +489,32 @@ static inline int fscrypt_set_context(struct inode *inode, void *fs_data)
|
|||
struct fscrypt_dummy_policy {
|
||||
};
|
||||
|
||||
static inline int
|
||||
fscrypt_parse_test_dummy_encryption(const struct fs_parameter *param,
|
||||
struct fscrypt_dummy_policy *dummy_policy)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
fscrypt_dummy_policies_equal(const struct fscrypt_dummy_policy *p1,
|
||||
const struct fscrypt_dummy_policy *p2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void fscrypt_show_test_dummy_encryption(struct seq_file *seq,
|
||||
char sep,
|
||||
struct super_block *sb)
|
||||
{
|
||||
}
|
||||
|
||||
static inline bool
|
||||
fscrypt_is_dummy_policy_set(const struct fscrypt_dummy_policy *dummy_policy)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void
|
||||
fscrypt_free_dummy_policy(struct fscrypt_dummy_policy *dummy_policy)
|
||||
{
|
||||
|
|
@ -488,6 +530,13 @@ static inline int fscrypt_ioctl_add_key(struct file *filp, void __user *arg)
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fscrypt_add_test_dummy_key(struct super_block *sb,
|
||||
const struct fscrypt_dummy_policy *dummy_policy)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int fscrypt_ioctl_remove_key(struct file *filp, void __user *arg)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue