]> git.baikalelectronics.ru Git - kernel.git/commit
fscrypt: add new helper functions for test_dummy_encryption
authorEric Biggers <ebiggers@google.com>
Sun, 1 May 2022 05:08:54 +0000 (22:08 -0700)
committerEric Biggers <ebiggers@google.com>
Mon, 9 May 2022 23:18:54 +0000 (16:18 -0700)
commitfa1f246bcce58d5d3fc9673b253b4c42497118f2
tree914ad10422ea5a667c5b1f3968b4639827051384
parentfb0cdd16adf13c5a40ae50529281118101bb011c
fscrypt: add new helper functions for test_dummy_encryption

Unfortunately the design of fscrypt_set_test_dummy_encryption() doesn't
work properly for the new mount API, as it combines too many steps into
one function:

  - Parse the argument to test_dummy_encryption
  - Check the setting against the filesystem instance
  - Apply the setting to the filesystem instance

The new mount API has split these into separate steps.  ext4 partially
worked around this by duplicating some of the logic, but it still had
some bugs.  To address this, add some new helper functions that split up
the steps of fscrypt_set_test_dummy_encryption():

  - fscrypt_parse_test_dummy_encryption()
  - fscrypt_dummy_policies_equal()
  - fscrypt_add_test_dummy_key()

While we're add it, also add a function fscrypt_is_dummy_policy_set()
which will be useful to avoid some #ifdef's.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20220501050857.538984-5-ebiggers@kernel.org
fs/crypto/fscrypt_private.h
fs/crypto/keyring.c
fs/crypto/policy.c
include/linux/fscrypt.h