Lines Matching refs:mk

165 				  struct fscrypt_master_key *mk,  in setup_per_mode_enc_key()  argument
202 err = fscrypt_hkdf_expand(&mk->mk_secret.hkdf, in setup_per_mode_enc_key()
227 static int fscrypt_derive_siphash_key(const struct fscrypt_master_key *mk, in fscrypt_derive_siphash_key() argument
233 err = fscrypt_hkdf_expand(&mk->mk_secret.hkdf, context, info, infolen, in fscrypt_derive_siphash_key()
246 const struct fscrypt_master_key *mk) in fscrypt_derive_dirhash_key() argument
250 err = fscrypt_derive_siphash_key(mk, HKDF_CONTEXT_DIRHASH_KEY, in fscrypt_derive_dirhash_key()
260 const struct fscrypt_master_key *mk) in fscrypt_hash_inode_number() argument
263 WARN_ON(!mk->mk_ino_hash_key_initialized); in fscrypt_hash_inode_number()
266 &mk->mk_ino_hash_key); in fscrypt_hash_inode_number()
270 struct fscrypt_master_key *mk) in fscrypt_setup_iv_ino_lblk_32_key() argument
274 err = setup_per_mode_enc_key(ci, mk, mk->mk_iv_ino_lblk_32_keys, in fscrypt_setup_iv_ino_lblk_32_key()
280 if (!smp_load_acquire(&mk->mk_ino_hash_key_initialized)) { in fscrypt_setup_iv_ino_lblk_32_key()
284 if (mk->mk_ino_hash_key_initialized) in fscrypt_setup_iv_ino_lblk_32_key()
287 err = fscrypt_derive_siphash_key(mk, in fscrypt_setup_iv_ino_lblk_32_key()
289 NULL, 0, &mk->mk_ino_hash_key); in fscrypt_setup_iv_ino_lblk_32_key()
293 smp_store_release(&mk->mk_ino_hash_key_initialized, true); in fscrypt_setup_iv_ino_lblk_32_key()
305 fscrypt_hash_inode_number(ci, mk); in fscrypt_setup_iv_ino_lblk_32_key()
310 struct fscrypt_master_key *mk, in fscrypt_setup_v2_file_key() argument
324 err = setup_per_mode_enc_key(ci, mk, mk->mk_direct_keys, in fscrypt_setup_v2_file_key()
334 err = setup_per_mode_enc_key(ci, mk, mk->mk_iv_ino_lblk_64_keys, in fscrypt_setup_v2_file_key()
339 err = fscrypt_setup_iv_ino_lblk_32_key(ci, mk); in fscrypt_setup_v2_file_key()
343 err = fscrypt_hkdf_expand(&mk->mk_secret.hkdf, in fscrypt_setup_v2_file_key()
358 err = fscrypt_derive_dirhash_key(ci, mk); in fscrypt_setup_v2_file_key()
383 static bool fscrypt_valid_master_key_size(const struct fscrypt_master_key *mk, in fscrypt_valid_master_key_size() argument
393 if (mk->mk_secret.size < min_keysize) { in fscrypt_valid_master_key_size()
396 master_key_spec_type(&mk->mk_spec), in fscrypt_valid_master_key_size()
397 master_key_spec_len(&mk->mk_spec), in fscrypt_valid_master_key_size()
398 (u8 *)&mk->mk_spec.u, in fscrypt_valid_master_key_size()
399 mk->mk_secret.size, min_keysize); in fscrypt_valid_master_key_size()
420 struct fscrypt_master_key *mk = NULL; in setup_file_encryption_key() local
461 mk = key->payload.data[0]; in setup_file_encryption_key()
465 if (!is_master_key_secret_present(&mk->mk_secret)) { in setup_file_encryption_key()
470 if (!fscrypt_valid_master_key_size(mk, ci)) { in setup_file_encryption_key()
477 err = fscrypt_setup_v1_file_key(ci, mk->mk_secret.raw); in setup_file_encryption_key()
480 err = fscrypt_setup_v2_file_key(ci, mk, need_dirhash_key); in setup_file_encryption_key()
513 struct fscrypt_master_key *mk = key->payload.data[0]; in put_crypt_info() local
523 spin_lock(&mk->mk_decrypted_inodes_lock); in put_crypt_info()
525 spin_unlock(&mk->mk_decrypted_inodes_lock); in put_crypt_info()
526 if (refcount_dec_and_test(&mk->mk_refcount)) in put_crypt_info()
582 struct fscrypt_master_key *mk = in fscrypt_setup_encryption_info() local
585 refcount_inc(&mk->mk_refcount); in fscrypt_setup_encryption_info()
587 spin_lock(&mk->mk_decrypted_inodes_lock); in fscrypt_setup_encryption_info()
589 &mk->mk_decrypted_inodes); in fscrypt_setup_encryption_info()
590 spin_unlock(&mk->mk_decrypted_inodes_lock); in fscrypt_setup_encryption_info()
763 const struct fscrypt_master_key *mk; in fscrypt_drop_inode() local
773 mk = ci->ci_master_key->payload.data[0]; in fscrypt_drop_inode()
792 return !is_master_key_secret_present(&mk->mk_secret); in fscrypt_drop_inode()