Lines Matching refs:ctx

33 	struct ext4_encryption_context ctx;  in ext4_is_encryption_context_consistent_with_policy()  local
35 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in ext4_is_encryption_context_consistent_with_policy()
36 sizeof(ctx)); in ext4_is_encryption_context_consistent_with_policy()
37 if (res != sizeof(ctx)) in ext4_is_encryption_context_consistent_with_policy()
39 return (memcmp(ctx.master_key_descriptor, policy->master_key_descriptor, in ext4_is_encryption_context_consistent_with_policy()
41 (ctx.flags == in ext4_is_encryption_context_consistent_with_policy()
43 (ctx.contents_encryption_mode == in ext4_is_encryption_context_consistent_with_policy()
45 (ctx.filenames_encryption_mode == in ext4_is_encryption_context_consistent_with_policy()
52 struct ext4_encryption_context ctx; in ext4_create_encryption_context_from_policy() local
60 ctx.format = EXT4_ENCRYPTION_CONTEXT_FORMAT_V1; in ext4_create_encryption_context_from_policy()
61 memcpy(ctx.master_key_descriptor, policy->master_key_descriptor, in ext4_create_encryption_context_from_policy()
77 ctx.contents_encryption_mode = policy->contents_encryption_mode; in ext4_create_encryption_context_from_policy()
78 ctx.filenames_encryption_mode = policy->filenames_encryption_mode; in ext4_create_encryption_context_from_policy()
79 ctx.flags = policy->flags; in ext4_create_encryption_context_from_policy()
80 BUILD_BUG_ON(sizeof(ctx.nonce) != EXT4_KEY_DERIVATION_NONCE_SIZE); in ext4_create_encryption_context_from_policy()
81 get_random_bytes(ctx.nonce, EXT4_KEY_DERIVATION_NONCE_SIZE); in ext4_create_encryption_context_from_policy()
88 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in ext4_create_encryption_context_from_policy()
89 sizeof(ctx), 0); in ext4_create_encryption_context_from_policy()
127 struct ext4_encryption_context ctx; in ext4_get_policy() local
131 &ctx, sizeof(ctx)); in ext4_get_policy()
132 if (res != sizeof(ctx)) in ext4_get_policy()
134 if (ctx.format != EXT4_ENCRYPTION_CONTEXT_FORMAT_V1) in ext4_get_policy()
137 policy->contents_encryption_mode = ctx.contents_encryption_mode; in ext4_get_policy()
138 policy->filenames_encryption_mode = ctx.filenames_encryption_mode; in ext4_get_policy()
139 policy->flags = ctx.flags; in ext4_get_policy()
140 memcpy(&policy->master_key_descriptor, ctx.master_key_descriptor, in ext4_get_policy()
192 struct ext4_encryption_context ctx; in ext4_inherit_context() local
203 ctx.format = EXT4_ENCRYPTION_CONTEXT_FORMAT_V1; in ext4_inherit_context()
205 ctx.contents_encryption_mode = EXT4_ENCRYPTION_MODE_AES_256_XTS; in ext4_inherit_context()
206 ctx.filenames_encryption_mode = in ext4_inherit_context()
208 ctx.flags = 0; in ext4_inherit_context()
209 memset(ctx.master_key_descriptor, 0x42, in ext4_inherit_context()
213 ctx.contents_encryption_mode = ci->ci_data_mode; in ext4_inherit_context()
214 ctx.filenames_encryption_mode = ci->ci_filename_mode; in ext4_inherit_context()
215 ctx.flags = ci->ci_flags; in ext4_inherit_context()
216 memcpy(ctx.master_key_descriptor, ci->ci_master_key, in ext4_inherit_context()
219 get_random_bytes(ctx.nonce, EXT4_KEY_DERIVATION_NONCE_SIZE); in ext4_inherit_context()
221 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in ext4_inherit_context()
222 sizeof(ctx), 0); in ext4_inherit_context()