Lines Matching refs:ctx

32 	struct ext4_encryption_context ctx;  in ext4_is_encryption_context_consistent_with_policy()  local
34 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in ext4_is_encryption_context_consistent_with_policy()
35 sizeof(ctx)); in ext4_is_encryption_context_consistent_with_policy()
36 if (res != sizeof(ctx)) in ext4_is_encryption_context_consistent_with_policy()
38 return (memcmp(ctx.master_key_descriptor, policy->master_key_descriptor, in ext4_is_encryption_context_consistent_with_policy()
40 (ctx.flags == in ext4_is_encryption_context_consistent_with_policy()
42 (ctx.contents_encryption_mode == in ext4_is_encryption_context_consistent_with_policy()
44 (ctx.filenames_encryption_mode == in ext4_is_encryption_context_consistent_with_policy()
51 struct ext4_encryption_context ctx; in ext4_create_encryption_context_from_policy() local
54 ctx.format = EXT4_ENCRYPTION_CONTEXT_FORMAT_V1; in ext4_create_encryption_context_from_policy()
55 memcpy(ctx.master_key_descriptor, policy->master_key_descriptor, in ext4_create_encryption_context_from_policy()
71 ctx.contents_encryption_mode = policy->contents_encryption_mode; in ext4_create_encryption_context_from_policy()
72 ctx.filenames_encryption_mode = policy->filenames_encryption_mode; in ext4_create_encryption_context_from_policy()
73 ctx.flags = policy->flags; in ext4_create_encryption_context_from_policy()
74 BUILD_BUG_ON(sizeof(ctx.nonce) != EXT4_KEY_DERIVATION_NONCE_SIZE); in ext4_create_encryption_context_from_policy()
75 get_random_bytes(ctx.nonce, EXT4_KEY_DERIVATION_NONCE_SIZE); in ext4_create_encryption_context_from_policy()
78 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in ext4_create_encryption_context_from_policy()
79 sizeof(ctx), 0); in ext4_create_encryption_context_from_policy()
108 struct ext4_encryption_context ctx; in ext4_get_policy() local
112 &ctx, sizeof(ctx)); in ext4_get_policy()
113 if (res != sizeof(ctx)) in ext4_get_policy()
115 if (ctx.format != EXT4_ENCRYPTION_CONTEXT_FORMAT_V1) in ext4_get_policy()
118 policy->contents_encryption_mode = ctx.contents_encryption_mode; in ext4_get_policy()
119 policy->filenames_encryption_mode = ctx.filenames_encryption_mode; in ext4_get_policy()
120 policy->flags = ctx.flags; in ext4_get_policy()
121 memcpy(&policy->master_key_descriptor, ctx.master_key_descriptor, in ext4_get_policy()
170 struct ext4_encryption_context ctx; in ext4_inherit_context() local
173 &ctx, sizeof(ctx)); in ext4_inherit_context()
175 if (res != sizeof(ctx)) { in ext4_inherit_context()
177 ctx.format = EXT4_ENCRYPTION_CONTEXT_FORMAT_V1; in ext4_inherit_context()
178 ctx.contents_encryption_mode = in ext4_inherit_context()
180 ctx.filenames_encryption_mode = in ext4_inherit_context()
182 ctx.flags = 0; in ext4_inherit_context()
183 memset(ctx.master_key_descriptor, 0x42, in ext4_inherit_context()
190 get_random_bytes(ctx.nonce, EXT4_KEY_DERIVATION_NONCE_SIZE); in ext4_inherit_context()
192 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in ext4_inherit_context()
193 sizeof(ctx), 0); in ext4_inherit_context()