aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-01-05 16:51:18 -0500
committerTheodore Ts'o <tytso@mit.edu>2017-01-08 01:03:41 -0500
commita5d431eff2e0bb22156897435aa277ddc96074f7 (patch)
tree21fc94db3331336db3fd7bce15820907d6da5261 /fs/ubifs
parentf099d616dd689d27b08dec95d0b6f1f302cf8ec4 (diff)
fscrypt: make fscrypt_operations.key_prefix a string
There was an unnecessary amount of complexity around requesting the filesystem-specific key prefix. It was unclear why; perhaps it was envisioned that different instances of the same filesystem type could use different key prefixes, or that key prefixes could be binary. However, neither of those things were implemented or really make sense at all. So simplify the code by making key_prefix a const char *. Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/crypto.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/fs/ubifs/crypto.c b/fs/ubifs/crypto.c
index 3402720f2b28..6335abcf98df 100644
--- a/fs/ubifs/crypto.c
+++ b/fs/ubifs/crypto.c
@@ -26,15 +26,6 @@ static unsigned int ubifs_crypt_max_namelen(struct inode *inode)
26 return UBIFS_MAX_NLEN; 26 return UBIFS_MAX_NLEN;
27} 27}
28 28
29static int ubifs_key_prefix(struct inode *inode, u8 **key)
30{
31 static char prefix[] = "ubifs:";
32
33 *key = prefix;
34
35 return sizeof(prefix) - 1;
36}
37
38int ubifs_encrypt(const struct inode *inode, struct ubifs_data_node *dn, 29int ubifs_encrypt(const struct inode *inode, struct ubifs_data_node *dn,
39 unsigned int in_len, unsigned int *out_len, int block) 30 unsigned int in_len, unsigned int *out_len, int block)
40{ 31{
@@ -88,10 +79,10 @@ int ubifs_decrypt(const struct inode *inode, struct ubifs_data_node *dn,
88 79
89struct fscrypt_operations ubifs_crypt_operations = { 80struct fscrypt_operations ubifs_crypt_operations = {
90 .flags = FS_CFLG_OWN_PAGES, 81 .flags = FS_CFLG_OWN_PAGES,
82 .key_prefix = "ubifs:",
91 .get_context = ubifs_crypt_get_context, 83 .get_context = ubifs_crypt_get_context,
92 .set_context = ubifs_crypt_set_context, 84 .set_context = ubifs_crypt_set_context,
93 .is_encrypted = __ubifs_crypt_is_encrypted, 85 .is_encrypted = __ubifs_crypt_is_encrypted,
94 .empty_dir = ubifs_crypt_empty_dir, 86 .empty_dir = ubifs_crypt_empty_dir,
95 .max_namelen = ubifs_crypt_max_namelen, 87 .max_namelen = ubifs_crypt_max_namelen,
96 .key_prefix = ubifs_key_prefix,
97}; 88};