Lines Matching refs:ctx
35 struct f2fs_encryption_context ctx; in f2fs_is_encryption_context_consistent_with_policy() local
37 F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in f2fs_is_encryption_context_consistent_with_policy()
38 sizeof(ctx), NULL); in f2fs_is_encryption_context_consistent_with_policy()
40 if (res != sizeof(ctx)) in f2fs_is_encryption_context_consistent_with_policy()
43 return (memcmp(ctx.master_key_descriptor, policy->master_key_descriptor, in f2fs_is_encryption_context_consistent_with_policy()
45 (ctx.flags == policy->flags) && in f2fs_is_encryption_context_consistent_with_policy()
46 (ctx.contents_encryption_mode == in f2fs_is_encryption_context_consistent_with_policy()
48 (ctx.filenames_encryption_mode == in f2fs_is_encryption_context_consistent_with_policy()
55 struct f2fs_encryption_context ctx; in f2fs_create_encryption_context_from_policy() local
57 ctx.format = F2FS_ENCRYPTION_CONTEXT_FORMAT_V1; in f2fs_create_encryption_context_from_policy()
58 memcpy(ctx.master_key_descriptor, policy->master_key_descriptor, in f2fs_create_encryption_context_from_policy()
78 ctx.contents_encryption_mode = policy->contents_encryption_mode; in f2fs_create_encryption_context_from_policy()
79 ctx.filenames_encryption_mode = policy->filenames_encryption_mode; in f2fs_create_encryption_context_from_policy()
80 ctx.flags = policy->flags; in f2fs_create_encryption_context_from_policy()
81 BUILD_BUG_ON(sizeof(ctx.nonce) != F2FS_KEY_DERIVATION_NONCE_SIZE); in f2fs_create_encryption_context_from_policy()
82 get_random_bytes(ctx.nonce, F2FS_KEY_DERIVATION_NONCE_SIZE); in f2fs_create_encryption_context_from_policy()
85 F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in f2fs_create_encryption_context_from_policy()
86 sizeof(ctx), NULL, XATTR_CREATE); in f2fs_create_encryption_context_from_policy()
115 struct f2fs_encryption_context ctx; in f2fs_get_policy() local
123 &ctx, sizeof(ctx), NULL); in f2fs_get_policy()
124 if (res != sizeof(ctx)) in f2fs_get_policy()
126 if (ctx.format != F2FS_ENCRYPTION_CONTEXT_FORMAT_V1) in f2fs_get_policy()
130 policy->contents_encryption_mode = ctx.contents_encryption_mode; in f2fs_get_policy()
131 policy->filenames_encryption_mode = ctx.filenames_encryption_mode; in f2fs_get_policy()
132 policy->flags = ctx.flags; in f2fs_get_policy()
133 memcpy(&policy->master_key_descriptor, ctx.master_key_descriptor, in f2fs_get_policy()
186 struct f2fs_encryption_context ctx; in f2fs_inherit_context() local
197 ctx.format = F2FS_ENCRYPTION_CONTEXT_FORMAT_V1; in f2fs_inherit_context()
199 ctx.contents_encryption_mode = ci->ci_data_mode; in f2fs_inherit_context()
200 ctx.filenames_encryption_mode = ci->ci_filename_mode; in f2fs_inherit_context()
201 ctx.flags = ci->ci_flags; in f2fs_inherit_context()
202 memcpy(ctx.master_key_descriptor, ci->ci_master_key, in f2fs_inherit_context()
205 get_random_bytes(ctx.nonce, F2FS_KEY_DERIVATION_NONCE_SIZE); in f2fs_inherit_context()
207 F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, in f2fs_inherit_context()
208 sizeof(ctx), ipage, XATTR_CREATE); in f2fs_inherit_context()