Lines Matching refs:ci

181 			  const u8 *raw_key, const struct fscrypt_info *ci)  in find_or_insert_direct_key()  argument
193 memcpy(&hash_key, ci->ci_policy.v1.master_key_descriptor, in find_or_insert_direct_key()
198 if (memcmp(ci->ci_policy.v1.master_key_descriptor, in find_or_insert_direct_key()
201 if (ci->ci_mode != dk->dk_mode) in find_or_insert_direct_key()
203 if (!fscrypt_is_key_prepared(&dk->dk_key, ci)) in find_or_insert_direct_key()
205 if (crypto_memneq(raw_key, dk->dk_raw, ci->ci_mode->keysize)) in find_or_insert_direct_key()
221 fscrypt_get_direct_key(const struct fscrypt_info *ci, const u8 *raw_key) in fscrypt_get_direct_key() argument
227 dk = find_or_insert_direct_key(NULL, raw_key, ci); in fscrypt_get_direct_key()
235 dk->dk_sb = ci->ci_inode->i_sb; in fscrypt_get_direct_key()
237 dk->dk_mode = ci->ci_mode; in fscrypt_get_direct_key()
238 err = fscrypt_prepare_key(&dk->dk_key, raw_key, ci); in fscrypt_get_direct_key()
241 memcpy(dk->dk_descriptor, ci->ci_policy.v1.master_key_descriptor, in fscrypt_get_direct_key()
243 memcpy(dk->dk_raw, raw_key, ci->ci_mode->keysize); in fscrypt_get_direct_key()
245 return find_or_insert_direct_key(dk, raw_key, ci); in fscrypt_get_direct_key()
253 static int setup_v1_file_key_direct(struct fscrypt_info *ci, in setup_v1_file_key_direct() argument
258 dk = fscrypt_get_direct_key(ci, raw_master_key); in setup_v1_file_key_direct()
261 ci->ci_direct_key = dk; in setup_v1_file_key_direct()
262 ci->ci_enc_key = dk->dk_key; in setup_v1_file_key_direct()
267 static int setup_v1_file_key_derived(struct fscrypt_info *ci, in setup_v1_file_key_derived() argument
277 derived_key = kmalloc(ci->ci_mode->keysize, GFP_KERNEL); in setup_v1_file_key_derived()
281 err = derive_key_aes(raw_master_key, ci->ci_nonce, in setup_v1_file_key_derived()
282 derived_key, ci->ci_mode->keysize); in setup_v1_file_key_derived()
286 err = fscrypt_set_per_file_enc_key(ci, derived_key); in setup_v1_file_key_derived()
292 int fscrypt_setup_v1_file_key(struct fscrypt_info *ci, const u8 *raw_master_key) in fscrypt_setup_v1_file_key() argument
294 if (ci->ci_policy.v1.flags & FSCRYPT_POLICY_FLAG_DIRECT_KEY) in fscrypt_setup_v1_file_key()
295 return setup_v1_file_key_direct(ci, raw_master_key); in fscrypt_setup_v1_file_key()
297 return setup_v1_file_key_derived(ci, raw_master_key); in fscrypt_setup_v1_file_key()
300 int fscrypt_setup_v1_file_key_via_subscribed_keyrings(struct fscrypt_info *ci) in fscrypt_setup_v1_file_key_via_subscribed_keyrings() argument
307 ci->ci_policy.v1.master_key_descriptor, in fscrypt_setup_v1_file_key_via_subscribed_keyrings()
308 ci->ci_mode->keysize, &payload); in fscrypt_setup_v1_file_key_via_subscribed_keyrings()
309 if (key == ERR_PTR(-ENOKEY) && ci->ci_inode->i_sb->s_cop->key_prefix) { in fscrypt_setup_v1_file_key_via_subscribed_keyrings()
310 key = find_and_lock_process_key(ci->ci_inode->i_sb->s_cop->key_prefix, in fscrypt_setup_v1_file_key_via_subscribed_keyrings()
311 ci->ci_policy.v1.master_key_descriptor, in fscrypt_setup_v1_file_key_via_subscribed_keyrings()
312 ci->ci_mode->keysize, &payload); in fscrypt_setup_v1_file_key_via_subscribed_keyrings()
317 err = fscrypt_setup_v1_file_key(ci, payload->raw); in fscrypt_setup_v1_file_key_via_subscribed_keyrings()