fscrypt: Remove FSCRYPT_MODE_MAX
Subsystems (2)
Eric Biggers
maintainerPATCH 1/1 fscrypt: Remove FSCRYPT_MODE_MAX
Now that the arrays of per-mode keys in struct fscrypt_master_key have been replaced by a linked list, the definition of FSCRYPT_MODE_MAX doesn't do anything useful. (Previously it was used to size these arrays.) Remove it.
--- fs/crypto/fscrypt_private.h | 3 --- fs/crypto/keysetup.c | 5 ----- include/uapi/linux/fscrypt.h | 1 - tools/include/uapi/linux/fscrypt.h | 1 - 4 files changed, 10 deletions(-)
fs/crypto/fscrypt_private.h +0 -3
@@ -64,13 +64,10 @@ CRYPTO_ALG_KERN_DRIVER_ONLY)#define FSCRYPT_CONTEXT_V1 1#define FSCRYPT_CONTEXT_V2 2 -/* Keep this in sync with include/uapi/linux/fscrypt.h */ -#define FSCRYPT_MODE_MAX FSCRYPT_MODE_AES_256_HCTR2 -struct fscrypt_context_v1 {u8 version;/* FSCRYPT_CONTEXT_V1 */ u8 contents_encryption_mode;u8 filenames_encryption_mode;u8 flags;
fs/crypto/keysetup.c +0 -5
@@ -81,12 +81,10 @@ static DEFINE_MUTEX(fscrypt_mode_key_setup_mutex);static struct fscrypt_mode *select_encryption_mode (const union fscrypt_policy *policy,const struct inode *inode) { -BUILD_BUG_ON (ARRAY_SIZE (fscrypt_modes) !=FSCRYPT_MODE_MAX +1 ); -if (S_ISREG (inode->i_mode))return &fscrypt_modes[fscrypt_policy_contents_mode (policy)];if (S_ISDIR (inode->i_mode) ||S_ISLNK (inode->i_mode))return &fscrypt_modes[fscrypt_policy_fnames_mode (policy)];
@@ -227,13 +225,10 @@ static int setup_per_mode_enc_key(struct fscrypt_inode_info *ci,u8 hkdf_info[sizeof (mode_num) +sizeof (sb->s_uuid)];unsigned int hkdf_infolen =0 ;bool use_hw_wrapped_key = false;int err; -if (WARN_ON_ONCE (mode_num >FSCRYPT_MODE_MAX )) -return -EINVAL ; -if (mk->mk_secret.is_hw_wrapped &&S_ISREG (inode->i_mode)) {/* Using a hardware-wrapped key for file contents encryption */ if (!fscrypt_using_inline_encryption (ci)) {if (sb->s_flags &SB_INLINECRYPT ) fscrypt_warn(ci->ci_inode,
include/uapi/linux/fscrypt.h +0 -1
@@ -28,11 +28,10 @@#define FSCRYPT_MODE_AES_128_CTS 6#define FSCRYPT_MODE_SM4_XTS 7#define FSCRYPT_MODE_SM4_CTS 8#define FSCRYPT_MODE_ADIANTUM 9#define FSCRYPT_MODE_AES_256_HCTR2 10 -/* If adding a mode number > 10, update FSCRYPT_MODE_MAX in fscrypt_private.h */ /* * Legacy policy version; ad-hoc KDF and no key verification. * For new encrypted directories, use fscrypt_policy_v2 instead. *
tools/include/uapi/linux/fscrypt.h +0 -1
@@ -28,11 +28,10 @@#define FSCRYPT_MODE_AES_128_CTS 6#define FSCRYPT_MODE_SM4_XTS 7#define FSCRYPT_MODE_SM4_CTS 8#define FSCRYPT_MODE_ADIANTUM 9#define FSCRYPT_MODE_AES_256_HCTR2 10 -/* If adding a mode number > 10, update FSCRYPT_MODE_MAX in fscrypt_private.h */ /* * Legacy policy version; ad-hoc KDF and no key verification. * For new encrypted directories, use fscrypt_policy_v2 instead. *
base-commit: 83f1454877cc292b88baf13c829c16ce6937d120
prerequisite-patch-id: 319d2891e88c7df1ebb5ebf434d18b68f770399f
prerequisite-patch-id: 5330c9e4b65644baae81bd177a46be6223d2b494
prerequisite-patch-id: f6157c86deab0ff5ec953ae3ed6b0e84f37741bf
Signature · 1 line
2.54.0
Quoted 5 lines · Eric Biggers
Now that the arrays of per-mode keys in struct
fscrypt_master_keyhave been replaced by a linked list, the definition ofFSCRYPT_MODE_MAXdoesn't do anything useful. (Previously it was used to size these arrays.) Remove it.
Quoted 7 lines
Signed-off-by Eric Biggers <[email protected]>--- fs/crypto/fscrypt_private.h | 3 --- fs/crypto/keysetup.c | 5 ----- include/uapi/linux/fscrypt.h | 1 - tools/include/uapi/linux/fscrypt.h | 1 - 4 files changed, 10 deletions(-)
Applied to https://git.kernel.org/pub/scm/fs/fscrypt/linux.git/log/?h=for-next
- Eric