aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r--fs/ecryptfs/crypto.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 75bbfae55081..6d85aabb0179 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -915,6 +915,22 @@ static void ecryptfs_generate_new_key(struct ecryptfs_crypt_stat *crypt_stat)
915} 915}
916 916
917/** 917/**
918 * ecryptfs_copy_mount_wide_flags_to_inode_flags
919 *
920 * This function propagates the mount-wide flags to individual inode
921 * flags.
922 */
923static void ecryptfs_copy_mount_wide_flags_to_inode_flags(
924 struct ecryptfs_crypt_stat *crypt_stat,
925 struct ecryptfs_mount_crypt_stat *mount_crypt_stat)
926{
927 if (mount_crypt_stat->flags & ECRYPTFS_XATTR_METADATA_ENABLED)
928 crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR;
929 if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
930 crypt_stat->flags |= ECRYPTFS_VIEW_AS_ENCRYPTED;
931}
932
933/**
918 * ecryptfs_set_default_crypt_stat_vals 934 * ecryptfs_set_default_crypt_stat_vals
919 * @crypt_stat 935 * @crypt_stat
920 * 936 *
@@ -924,6 +940,8 @@ static void ecryptfs_set_default_crypt_stat_vals(
924 struct ecryptfs_crypt_stat *crypt_stat, 940 struct ecryptfs_crypt_stat *crypt_stat,
925 struct ecryptfs_mount_crypt_stat *mount_crypt_stat) 941 struct ecryptfs_mount_crypt_stat *mount_crypt_stat)
926{ 942{
943 ecryptfs_copy_mount_wide_flags_to_inode_flags(crypt_stat,
944 mount_crypt_stat);
927 ecryptfs_set_default_sizes(crypt_stat); 945 ecryptfs_set_default_sizes(crypt_stat);
928 strcpy(crypt_stat->cipher, ECRYPTFS_DEFAULT_CIPHER); 946 strcpy(crypt_stat->cipher, ECRYPTFS_DEFAULT_CIPHER);
929 crypt_stat->key_size = ECRYPTFS_DEFAULT_KEY_BYTES; 947 crypt_stat->key_size = ECRYPTFS_DEFAULT_KEY_BYTES;
@@ -969,6 +987,8 @@ int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry)
969 "file using mount_crypt_stat\n"); 987 "file using mount_crypt_stat\n");
970 ECRYPTFS_SET_FLAG(crypt_stat->flags, ECRYPTFS_ENCRYPTED); 988 ECRYPTFS_SET_FLAG(crypt_stat->flags, ECRYPTFS_ENCRYPTED);
971 ECRYPTFS_SET_FLAG(crypt_stat->flags, ECRYPTFS_KEY_VALID); 989 ECRYPTFS_SET_FLAG(crypt_stat->flags, ECRYPTFS_KEY_VALID);
990 ecryptfs_copy_mount_wide_flags_to_inode_flags(crypt_stat,
991 mount_crypt_stat);
972 memcpy(crypt_stat->keysigs[crypt_stat->num_keysigs++], 992 memcpy(crypt_stat->keysigs[crypt_stat->num_keysigs++],
973 mount_crypt_stat->global_auth_tok_sig, 993 mount_crypt_stat->global_auth_tok_sig,
974 ECRYPTFS_SIG_SIZE_HEX); 994 ECRYPTFS_SIG_SIZE_HEX);