Lines Matching refs:secret
41 static void wipe_master_key_secret(struct fscrypt_master_key_secret *secret) in wipe_master_key_secret() argument
43 fscrypt_destroy_hkdf(&secret->hkdf); in wipe_master_key_secret()
44 memzero_explicit(secret, sizeof(*secret)); in wipe_master_key_secret()
414 struct fscrypt_master_key_secret *secret, in add_new_master_key() argument
441 move_master_key_secret(&mk->mk_secret, secret); in add_new_master_key()
458 struct fscrypt_master_key_secret *secret) in add_existing_master_key() argument
485 move_master_key_secret(&mk->mk_secret, secret); in add_existing_master_key()
492 struct fscrypt_master_key_secret *secret, in do_add_master_key() argument
506 err = add_new_master_key(sb, secret, mk_spec); in do_add_master_key()
513 err = add_existing_master_key(mk, secret); in do_add_master_key()
522 err = add_new_master_key(sb, secret, mk_spec); in do_add_master_key()
531 struct fscrypt_master_key_secret *secret, in add_master_key() argument
538 u8 *kdf_key = secret->raw; in add_master_key()
539 unsigned int kdf_key_size = secret->size; in add_master_key()
548 if (secret->is_hw_wrapped) { in add_master_key()
549 err = fscrypt_derive_sw_secret(sb, secret->raw, in add_master_key()
550 secret->size, sw_secret); in add_master_key()
556 err = fscrypt_init_hkdf(&secret->hkdf, kdf_key, kdf_key_size); in add_master_key()
566 err = fscrypt_hkdf_expand(&secret->hkdf, keyid_kdf_ctx, NULL, 0, in add_master_key()
572 return do_add_master_key(sb, secret, key_spec); in add_master_key()
646 struct fscrypt_master_key_secret *secret) in get_keyring_key() argument
666 secret->size = key->datalen - sizeof(*payload); in get_keyring_key()
667 memcpy(secret->raw, payload->raw, secret->size); in get_keyring_key()
707 struct fscrypt_master_key_secret secret; in fscrypt_ioctl_add_key() local
728 memset(&secret, 0, sizeof(secret)); in fscrypt_ioctl_add_key()
735 secret.is_hw_wrapped = true; in fscrypt_ioctl_add_key()
741 err = get_keyring_key(arg.key_id, arg.key_spec.type, &secret); in fscrypt_ioctl_add_key()
745 if (secret.size > FSCRYPT_MAX_STANDARD_KEY_SIZE && in fscrypt_ioctl_add_key()
746 !secret.is_hw_wrapped) in fscrypt_ioctl_add_key()
750 arg.raw_size > (secret.is_hw_wrapped ? in fscrypt_ioctl_add_key()
754 secret.size = arg.raw_size; in fscrypt_ioctl_add_key()
756 if (copy_from_user(secret.raw, uarg->raw, secret.size)) in fscrypt_ioctl_add_key()
760 err = add_master_key(sb, &secret, &arg.key_spec); in fscrypt_ioctl_add_key()
772 wipe_master_key_secret(&secret); in fscrypt_ioctl_add_key()
778 fscrypt_get_test_dummy_secret(struct fscrypt_master_key_secret *secret) in fscrypt_get_test_dummy_secret() argument
784 memset(secret, 0, sizeof(*secret)); in fscrypt_get_test_dummy_secret()
785 secret->size = sizeof(test_key); in fscrypt_get_test_dummy_secret()
786 memcpy(secret->raw, test_key, sizeof(test_key)); in fscrypt_get_test_dummy_secret()
792 struct fscrypt_master_key_secret secret; in fscrypt_get_test_dummy_key_identifier() local
795 fscrypt_get_test_dummy_secret(&secret); in fscrypt_get_test_dummy_key_identifier()
797 err = fscrypt_init_hkdf(&secret.hkdf, secret.raw, secret.size); in fscrypt_get_test_dummy_key_identifier()
800 err = fscrypt_hkdf_expand(&secret.hkdf, HKDF_CONTEXT_KEY_IDENTIFIER, in fscrypt_get_test_dummy_key_identifier()
804 wipe_master_key_secret(&secret); in fscrypt_get_test_dummy_key_identifier()
823 struct fscrypt_master_key_secret secret; in fscrypt_add_test_dummy_key() local
826 fscrypt_get_test_dummy_secret(&secret); in fscrypt_add_test_dummy_key()
827 err = add_master_key(sb, &secret, key_spec); in fscrypt_add_test_dummy_key()
828 wipe_master_key_secret(&secret); in fscrypt_add_test_dummy_key()