hooks.c (762f99f4f3cb41a775b5157dd761217beba65873) hooks.c (d3e94fdc4ef476ca1edd468cc11badf2dbbb3c00)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * fs/crypto/hooks.c
4 *
5 * Encryption hooks for higher-level filesystem operations.
6 */
7
8#include <linux/key.h>

--- 214 unchanged lines hidden (view full) ---

223 * targets are prefixed with the ciphertext length, despite this
224 * actually being redundant with i_size. This decreases by 2 bytes the
225 * longest symlink target we can accept.
226 *
227 * We could recover 1 byte by not counting a null terminator, but
228 * counting it (even though it is meaningless for ciphertext) is simpler
229 * for now since filesystems will assume it is there and subtract it.
230 */
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * fs/crypto/hooks.c
4 *
5 * Encryption hooks for higher-level filesystem operations.
6 */
7
8#include <linux/key.h>

--- 214 unchanged lines hidden (view full) ---

223 * targets are prefixed with the ciphertext length, despite this
224 * actually being redundant with i_size. This decreases by 2 bytes the
225 * longest symlink target we can accept.
226 *
227 * We could recover 1 byte by not counting a null terminator, but
228 * counting it (even though it is meaningless for ciphertext) is simpler
229 * for now since filesystems will assume it is there and subtract it.
230 */
231 if (!fscrypt_fname_encrypted_size(policy, len,
232 max_len - sizeof(struct fscrypt_symlink_data),
233 &disk_link->len))
231 if (!__fscrypt_fname_encrypted_size(policy, len,
232 max_len - sizeof(struct fscrypt_symlink_data),
233 &disk_link->len))
234 return -ENAMETOOLONG;
235 disk_link->len += sizeof(struct fscrypt_symlink_data);
236
237 disk_link->name = NULL;
238 return 0;
239}
240EXPORT_SYMBOL_GPL(fscrypt_prepare_symlink);
241

--- 189 unchanged lines hidden ---
234 return -ENAMETOOLONG;
235 disk_link->len += sizeof(struct fscrypt_symlink_data);
236
237 disk_link->name = NULL;
238 return 0;
239}
240EXPORT_SYMBOL_GPL(fscrypt_prepare_symlink);
241

--- 189 unchanged lines hidden ---