diff options
Diffstat (limited to 'fs/ecryptfs/main.c')
-rw-r--r-- | fs/ecryptfs/main.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 7dbccb4b38db..a3bd96a80ade 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -266,6 +266,7 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options, int cipher_key_bytes_set = 0; int fn_cipher_key_bytes; int fn_cipher_key_bytes_set = 0; + size_t salt_size = 0; struct ecryptfs_mount_crypt_stat *mount_crypt_stat = &sbi->mount_crypt_stat; substring_t args[MAX_OPT_ARGS]; @@ -418,8 +419,24 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options, && !fn_cipher_name_set) strcpy(mount_crypt_stat->global_default_fn_cipher_name, mount_crypt_stat->global_default_cipher_name); - if (!cipher_key_bytes_set) + + if (cipher_key_bytes_set) { + + salt_size = ecryptfs_get_salt_size_for_cipher( + ecryptfs_get_full_cipher( + mount_crypt_stat->global_default_cipher_name, + mount_crypt_stat->global_default_cipher_mode)); + + if (!ecryptfs_check_space_for_salt( + mount_crypt_stat->global_default_cipher_key_size, + salt_size)) { + ecryptfs_printk( + KERN_WARNING, + "eCryptfs internal error: no space for salt"); + } + } else mount_crypt_stat->global_default_cipher_key_size = 0; + if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) && !fn_cipher_key_bytes_set) mount_crypt_stat->global_default_fn_cipher_key_bytes = |