Lines Matching refs:key

14  * Delay between key revocation/expiry in seconds
34 #define KEY_GC_KEY_EXPIRED 0 /* A key expired and needs unlinking */
40 * Any key whose type gets unregistered will be re-typed to this if it can't be
70 * Set the expiration time on a key.
72 void key_set_expiry(struct key *key, time64_t expiry)
74 key->expiry = expiry;
76 if (!(key->type->flags & KEY_TYPE_INSTANT_REAP))
92 * Some key's cleanup time was met after it expired, so we need to get the
138 struct key *key =
139 list_entry(keys->next, struct key, graveyard_link);
140 short state = key->state;
142 list_del(&key->graveyard_link);
144 kdebug("- %u", key->serial);
145 key_check(key);
148 remove_watch_list(key->watchers, key->serial);
149 key->watchers = NULL;
152 /* Throw away the key data if the key is instantiated */
153 if (state == KEY_IS_POSITIVE && key->type->destroy)
154 key->type->destroy(key);
156 security_key_free(key);
158 /* deal with the user's key tracking and quota */
159 if (test_bit(KEY_FLAG_IN_QUOTA, &key->flags)) {
160 spin_lock(&key->user->lock);
161 key->user->qnkeys--;
162 key->user->qnbytes -= key->quotalen;
163 spin_unlock(&key->user->lock);
166 atomic_dec(&key->user->nkeys);
168 atomic_dec(&key->user->nikeys);
170 key_user_put(key->user);
171 key_put_tag(key->domain_tag);
172 kfree(key->description);
174 memzero_explicit(key, sizeof(*key));
175 kmem_cache_free(key_jar, key);
193 #define KEY_GC_REAPING_DEAD_2 0x20 /* - We need to reap dead key links */
195 #define KEY_GC_FOUND_DEAD_KEY 0x80 /* - We found at least one dead key */
198 struct key *key;
217 /* As only this function is permitted to remove things from the key
226 key = rb_entry(cursor, struct key, serial_node);
229 if (refcount_read(&key->usage) == 0)
233 if (key->type == key_gc_dead_keytype) {
235 set_bit(KEY_FLAG_DEAD, &key->flags);
236 key->perm = 0;
238 } else if (key->type == &key_type_keyring &&
239 key->restrict_link) {
244 expiry = key->expiry;
246 if (!(key->type->flags & KEY_TYPE_INSTANT_REAP))
250 key_serial(key), key->expiry - limit);
251 new_timer = key->expiry;
256 if (key->type == key_gc_dead_keytype)
261 if (key->type == &key_type_keyring)
266 if (key->type == key_gc_dead_keytype)
337 /* We found an unreferenced key - once we've removed it from the tree,
341 kdebug("unrefd key %d", key->serial);
342 rb_erase(&key->serial_node, &key_serial_tree);
345 list_add_tail(&key->graveyard_link, &graveyard);
350 * it is associated with the dead key type.
354 keyring_restriction_gc(key, key_gc_dead_keytype);
364 keyring_gc(key, limit);
367 /* We found a dead key that is still referenced. Reset its type and
372 kdebug("destroy key %d", key->serial);
373 down_write(&key->sem);
374 key->type = &key_type_dead;
376 key_gc_dead_keytype->destroy(key);
377 memset(&key->payload, KEY_DESTROY, sizeof(key->payload));
378 up_write(&key->sem);