fscrypt: fix up fscrypt_fname_encrypted_size() for internal use
authorEric Biggers <ebiggers@google.com>
Fri, 12 Jan 2018 04:30:08 +0000 (23:30 -0500)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sun, 8 Apr 2018 10:35:02 +0000 (03:35 -0700)
commit69e5234f04b6933284cb5314c232a62ec5533c7e
tree47db2c9e48594bf9293617adfaf48cc183d7fb65
parent7919cba9230452d16dfa61e24f48a201964a859b
fscrypt: fix up fscrypt_fname_encrypted_size() for internal use

Filesystems don't need fscrypt_fname_encrypted_size() anymore, so
unexport it and move it to fscrypt_private.h.

We also never calculate the encrypted size of a filename without having
the fscrypt_info present since it is needed to know the amount of
NUL-padding which is determined by the encryption policy, and also we
will always truncate the NUL-padding to the maximum filename length.
Therefore, also make fscrypt_fname_encrypted_size() assume that the
fscrypt_info is present, and make it truncate the returned length to the
specified max_len.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/crypto/fname.c
fs/crypto/fscrypt_private.h
fs/crypto/hooks.c
include/linux/fscrypt_notsupp.h
include/linux/fscrypt_supp.h