Lines Matching refs:key
155 struct key *key; in SYSCALL_DEFINE4() local
203 key = request_key_and_link(ktype, description, callout_info, in SYSCALL_DEFINE4()
206 if (IS_ERR(key)) { in SYSCALL_DEFINE4()
207 ret = PTR_ERR(key); in SYSCALL_DEFINE4()
211 ret = key->serial; in SYSCALL_DEFINE4()
213 key_put(key); in SYSCALL_DEFINE4()
463 struct key *key, *instkey; in keyctl_describe_key() local
494 key = key_ref_to_ptr(key_ref); in keyctl_describe_key()
635 struct key *key; in keyctl_read_key() local
646 key = key_ref_to_ptr(key_ref); in keyctl_read_key()
666 ret = key_validate(key); in keyctl_read_key()
669 if (key->type->read) { in keyctl_read_key()
672 down_read(&key->sem); in keyctl_read_key()
673 ret = key->type->read(key, buffer, buflen); in keyctl_read_key()
674 up_read(&key->sem); in keyctl_read_key()
679 key_put(key); in keyctl_read_key()
695 struct key *key; in keyctl_chown_key() local
709 key = key_ref_to_ptr(key_ref); in keyctl_chown_key()
713 down_write(&key->sem); in keyctl_chown_key()
717 if (uid != (uid_t) -1 && key->uid != uid) in keyctl_chown_key()
722 if (gid != (gid_t) -1 && gid != key->gid && !in_group_p(gid)) in keyctl_chown_key()
727 if (uid != (uid_t) -1 && uid != key->uid) { in keyctl_chown_key()
734 if (test_bit(KEY_FLAG_IN_QUOTA, &key->flags)) { in keyctl_chown_key()
742 newowner->qnbytes + key->quotalen >= maxbytes || in keyctl_chown_key()
743 newowner->qnbytes + key->quotalen < in keyctl_chown_key()
748 newowner->qnbytes += key->quotalen; in keyctl_chown_key()
751 spin_lock(&key->user->lock); in keyctl_chown_key()
752 key->user->qnkeys--; in keyctl_chown_key()
753 key->user->qnbytes -= key->quotalen; in keyctl_chown_key()
754 spin_unlock(&key->user->lock); in keyctl_chown_key()
757 atomic_dec(&key->user->nkeys); in keyctl_chown_key()
760 if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) { in keyctl_chown_key()
761 atomic_dec(&key->user->nikeys); in keyctl_chown_key()
765 zapowner = key->user; in keyctl_chown_key()
766 key->user = newowner; in keyctl_chown_key()
767 key->uid = uid; in keyctl_chown_key()
772 key->gid = gid; in keyctl_chown_key()
777 up_write(&key->sem); in keyctl_chown_key()
778 key_put(key); in keyctl_chown_key()
800 struct key *key; in keyctl_setperm_key() local
814 key = key_ref_to_ptr(key_ref); in keyctl_setperm_key()
818 down_write(&key->sem); in keyctl_setperm_key()
821 if (capable(CAP_SYS_ADMIN) || key->uid == current_fsuid()) { in keyctl_setperm_key()
822 key->perm = perm; in keyctl_setperm_key()
826 up_write(&key->sem); in keyctl_setperm_key()
827 key_put(key); in keyctl_setperm_key()
838 struct key **_dest_keyring) in get_instantiation_keyring()
873 static int keyctl_change_reqkey_auth(struct key *key) in keyctl_change_reqkey_auth() argument
882 new->request_key_auth = key_get(key); in keyctl_change_reqkey_auth()
899 struct key *instkey, *dest_keyring; in keyctl_instantiate_key()
977 struct key *instkey, *dest_keyring; in keyctl_negate_key()
1081 struct key *key; in keyctl_set_timeout() local
1092 key = key_ref_to_ptr(key_ref); in keyctl_set_timeout()
1095 down_write(&key->sem); in keyctl_set_timeout()
1103 key->expiry = expiry; in keyctl_set_timeout()
1105 up_write(&key->sem); in keyctl_set_timeout()
1106 key_put(key); in keyctl_set_timeout()
1120 struct key *authkey; in keyctl_assume_authority()
1168 struct key *key, *instkey; in keyctl_get_security() local
1190 key = key_ref_to_ptr(key_ref); in keyctl_get_security()
1191 ret = security_key_getsecurity(key, &context); in keyctl_get_security()