Lines Matching refs:key

173 	struct key *key;  in SYSCALL_DEFINE4()  local
222 key = request_key_and_link(ktype, description, NULL, callout_info, in SYSCALL_DEFINE4()
225 if (IS_ERR(key)) { in SYSCALL_DEFINE4()
226 ret = PTR_ERR(key); in SYSCALL_DEFINE4()
231 ret = wait_for_key_construction(key, 1); in SYSCALL_DEFINE4()
235 ret = key->serial; in SYSCALL_DEFINE4()
238 key_put(key); in SYSCALL_DEFINE4()
382 struct key *key; in keyctl_revoke_key() local
397 key = key_ref_to_ptr(key_ref); in keyctl_revoke_key()
399 if (test_bit(KEY_FLAG_KEEP, &key->flags)) in keyctl_revoke_key()
402 key_revoke(key); in keyctl_revoke_key()
423 struct key *key; in keyctl_invalidate_key() local
447 key = key_ref_to_ptr(key_ref); in keyctl_invalidate_key()
449 if (test_bit(KEY_FLAG_KEEP, &key->flags)) in keyctl_invalidate_key()
452 key_invalidate(key); in keyctl_invalidate_key()
470 struct key *keyring; in keyctl_keyring_clear()
555 struct key *keyring, *key; in keyctl_keyring_unlink() local
571 key = key_ref_to_ptr(key_ref); in keyctl_keyring_unlink()
573 test_bit(KEY_FLAG_KEEP, &key->flags)) in keyctl_keyring_unlink()
576 ret = key_unlink(keyring, key); in keyctl_keyring_unlink()
648 struct key *key, *instkey; in keyctl_describe_key() local
675 key = key_ref_to_ptr(key_ref); in keyctl_describe_key()
676 desclen = strlen(key->description); in keyctl_describe_key()
682 key->type->name, in keyctl_describe_key()
683 from_kuid_munged(current_user_ns(), key->uid), in keyctl_describe_key()
684 from_kgid_munged(current_user_ns(), key->gid), in keyctl_describe_key()
685 key->perm); in keyctl_describe_key()
694 copy_to_user(buffer + infolen, key->description, in keyctl_describe_key()
803 static long __keyctl_read_key(struct key *key, char *buffer, size_t buflen) in __keyctl_read_key() argument
807 down_read(&key->sem); in __keyctl_read_key()
808 ret = key_validate(key); in __keyctl_read_key()
810 ret = key->type->read(key, buffer, buflen); in __keyctl_read_key()
811 up_read(&key->sem); in __keyctl_read_key()
827 struct key *key; in keyctl_read_key() local
840 key = key_ref_to_ptr(key_ref); in keyctl_read_key()
842 ret = key_read_state(key); in keyctl_read_key()
864 if (!key->type->read) { in keyctl_read_key()
871 ret = __keyctl_read_key(key, NULL, 0); in keyctl_read_key()
900 ret = __keyctl_read_key(key, key_data, key_data_len); in keyctl_read_key()
929 key_put(key); in keyctl_read_key()
952 struct key *key; in keyctl_chown_key() local
977 key = key_ref_to_ptr(key_ref); in keyctl_chown_key()
981 down_write(&key->sem); in keyctl_chown_key()
987 if (user != (uid_t) -1 && !uid_eq(key->uid, uid)) in keyctl_chown_key()
992 if (group != (gid_t) -1 && !gid_eq(gid, key->gid) && !in_group_p(gid)) in keyctl_chown_key()
1000 if (user != (uid_t) -1 && !uid_eq(uid, key->uid)) { in keyctl_chown_key()
1007 if (test_bit(KEY_FLAG_IN_QUOTA, &key->flags)) { in keyctl_chown_key()
1015 newowner->qnbytes + key->quotalen > maxbytes || in keyctl_chown_key()
1016 newowner->qnbytes + key->quotalen < in keyctl_chown_key()
1021 newowner->qnbytes += key->quotalen; in keyctl_chown_key()
1024 spin_lock(&key->user->lock); in keyctl_chown_key()
1025 key->user->qnkeys--; in keyctl_chown_key()
1026 key->user->qnbytes -= key->quotalen; in keyctl_chown_key()
1027 spin_unlock(&key->user->lock); in keyctl_chown_key()
1030 atomic_dec(&key->user->nkeys); in keyctl_chown_key()
1033 if (key->state != KEY_IS_UNINSTANTIATED) { in keyctl_chown_key()
1034 atomic_dec(&key->user->nikeys); in keyctl_chown_key()
1038 zapowner = key->user; in keyctl_chown_key()
1039 key->user = newowner; in keyctl_chown_key()
1040 key->uid = uid; in keyctl_chown_key()
1045 key->gid = gid; in keyctl_chown_key()
1047 notify_key(key, NOTIFY_KEY_SETATTR, 0); in keyctl_chown_key()
1051 up_write(&key->sem); in keyctl_chown_key()
1052 key_put(key); in keyctl_chown_key()
1074 struct key *key; in keyctl_setperm_key() local
1089 key = key_ref_to_ptr(key_ref); in keyctl_setperm_key()
1093 down_write(&key->sem); in keyctl_setperm_key()
1096 if (uid_eq(key->uid, current_fsuid()) || capable(CAP_SYS_ADMIN)) { in keyctl_setperm_key()
1097 key->perm = perm; in keyctl_setperm_key()
1098 notify_key(key, NOTIFY_KEY_SETATTR, 0); in keyctl_setperm_key()
1102 up_write(&key->sem); in keyctl_setperm_key()
1103 key_put(key); in keyctl_setperm_key()
1114 struct key **_dest_keyring) in get_instantiation_keyring()
1149 static int keyctl_change_reqkey_auth(struct key *key) in keyctl_change_reqkey_auth() argument
1158 new->request_key_auth = key_get(key); in keyctl_change_reqkey_auth()
1178 struct key *instkey, *dest_keyring; in keyctl_instantiate_key_common()
1340 struct key *instkey, *dest_keyring; in keyctl_reject_key()
1459 struct key *key, *instkey; in keyctl_set_timeout() local
1485 key = key_ref_to_ptr(key_ref); in keyctl_set_timeout()
1487 if (test_bit(KEY_FLAG_KEEP, &key->flags)) { in keyctl_set_timeout()
1490 key_set_timeout(key, timeout); in keyctl_set_timeout()
1491 notify_key(key, NOTIFY_KEY_SETATTR, 0); in keyctl_set_timeout()
1493 key_put(key); in keyctl_set_timeout()
1518 struct key *authkey; in keyctl_assume_authority()
1565 struct key *key, *instkey; in keyctl_get_security() local
1588 key = key_ref_to_ptr(key_ref); in keyctl_get_security()
1589 ret = security_key_getsecurity(key, &context); in keyctl_get_security()
1778 struct key *key; in keyctl_watch_key() local
1788 key = key_ref_to_ptr(key_ref); in keyctl_watch_key()
1798 if (!key->watchers) { in keyctl_watch_key()
1810 watch->id = key->serial; in keyctl_watch_key()
1813 ret = security_watch_key(key); in keyctl_watch_key()
1817 down_write(&key->sem); in keyctl_watch_key()
1818 if (!key->watchers) { in keyctl_watch_key()
1819 key->watchers = wlist; in keyctl_watch_key()
1823 ret = add_watch_to_object(watch, key->watchers); in keyctl_watch_key()
1824 up_write(&key->sem); in keyctl_watch_key()
1830 if (key->watchers) { in keyctl_watch_key()
1831 down_write(&key->sem); in keyctl_watch_key()
1832 ret = remove_watch_from_object(key->watchers, in keyctl_watch_key()
1833 wqueue, key_serial(key), in keyctl_watch_key()
1835 up_write(&key->sem); in keyctl_watch_key()
1846 key_put(key); in keyctl_watch_key()