alistair23-linux/fs/crypto
Eric Biggers bd0d97b719 fscrypt: switch fscrypt_do_sha256() to use the SHA-256 library
fscrypt_do_sha256() is only used for hashing encrypted filenames to
create no-key tokens, which isn't performance-critical.  Therefore a C
implementation of SHA-256 is sufficient.

Also, the logic to create no-key tokens is always potentially needed.
This differs from fscrypt's other dependencies on crypto API algorithms,
which are conditionally needed depending on what encryption policies
userspace is using.  Therefore, for fscrypt there isn't much benefit to
allowing SHA-256 to be a loadable module.

So, make fscrypt_do_sha256() use the SHA-256 library instead of the
crypto_shash API.  This is much simpler, since it avoids having to
implement one-time-init (which is hard to do correctly, and in fact was
implemented incorrectly) and handle failures to allocate the
crypto_shash object.

Fixes: edc440e3d2 ("fscrypt: improve format of no-key names")
Cc: Daniel Rosenberg <drosen@google.com>
Link: https://lore.kernel.org/r/20200721225920.114347-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
2020-07-21 16:02:13 -07:00
..
bio.c fscrypt: add inline encryption support 2020-07-08 10:29:30 -07:00
crypto.c fscrypt: rename FS_KEY_DERIVATION_NONCE_SIZE 2020-07-20 17:26:33 -07:00
fname.c fscrypt: switch fscrypt_do_sha256() to use the SHA-256 library 2020-07-21 16:02:13 -07:00
fscrypt_private.h fscrypt: rename FS_KEY_DERIVATION_NONCE_SIZE 2020-07-20 17:26:33 -07:00
hkdf.c fscrypt: use crypto_shash_tfm_digest() 2020-05-08 15:32:14 +10:00
hooks.c fscrypt: fix all kerneldoc warnings 2020-05-12 16:37:17 -07:00
inline_crypt.c fscrypt: add inline encryption support 2020-07-08 10:29:30 -07:00
Kconfig fscrypt: switch fscrypt_do_sha256() to use the SHA-256 library 2020-07-21 16:02:13 -07:00
keyring.c fscrypt: add inline encryption support 2020-07-08 10:29:30 -07:00
keysetup.c fscrypt: rename FS_KEY_DERIVATION_NONCE_SIZE 2020-07-20 17:26:33 -07:00
keysetup_v1.c fscrypt: rename FS_KEY_DERIVATION_NONCE_SIZE 2020-07-20 17:26:33 -07:00
Makefile fscrypt: add inline encryption support 2020-07-08 10:29:30 -07:00
policy.c fscrypt: restrict IV_INO_LBLK_* to AES-256-XTS 2020-07-21 11:12:57 -07:00