]> git.baikalelectronics.ru Git - kernel.git/commit
fscrypt: export fscrypt_fname_encrypt and fscrypt_fname_encrypted_size
authorJeff Layton <jlayton@kernel.org>
Fri, 8 Jan 2021 20:34:38 +0000 (15:34 -0500)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 2 Aug 2022 22:54:11 +0000 (00:54 +0200)
commit08490bf5c7977b18e714871c1d248ecb4759801a
treea546f8826c77eb4a0ae6a26577aa8aa1883b9843
parentb11b8af6f4e01257a2983147765f687b413a90c5
fscrypt: export fscrypt_fname_encrypt and fscrypt_fname_encrypted_size

For ceph, we want to use our own scheme for handling filenames that are
are longer than NAME_MAX after encryption and Base64 encoding. This
allows us to have a consistent view of the encrypted filenames for
clients that don't support fscrypt and clients that do but that don't
have the key.

Currently, fs/crypto only supports encrypting filenames using
fscrypt_setup_filename, but that also handles encoding nokey names. Ceph
can't use that because it handles nokey names in a different way.

Export fscrypt_fname_encrypt. Rename fscrypt_fname_encrypted_size to
__fscrypt_fname_encrypted_size and add a new wrapper called
fscrypt_fname_encrypted_size that takes an inode argument rather than a
pointer to a fscrypt_policy union.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Acked-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/crypto/fname.c
fs/crypto/fscrypt_private.h
fs/crypto/hooks.c
include/linux/fscrypt.h