• Home
  • Raw
  • Download

Lines Matching refs:key

35 	      ((PAGE_SIZE - sizeof(struct keyring_list)) / sizeof(struct key *)))
68 static int keyring_instantiate(struct key *keyring,
70 static int keyring_match(const struct key *keyring, const void *criterion);
71 static void keyring_revoke(struct key *keyring);
72 static void keyring_destroy(struct key *keyring);
73 static void keyring_describe(const struct key *keyring, struct seq_file *m);
74 static long keyring_read(const struct key *keyring,
99 static void keyring_publish_name(struct key *keyring) in keyring_publish_name()
123 static int keyring_instantiate(struct key *keyring, in keyring_instantiate()
141 static int keyring_match(const struct key *keyring, const void *description) in keyring_match()
156 static void keyring_destroy(struct key *keyring) in keyring_destroy()
182 static void keyring_describe(const struct key *keyring, struct seq_file *m) in keyring_describe()
207 static long keyring_read(const struct key *keyring, in keyring_read()
211 struct key *key; in keyring_read() local
230 key = rcu_deref_link_locked(klist, loop, in keyring_read()
238 &key->serial, in keyring_read()
259 struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid, in keyring_alloc()
261 unsigned long flags, struct key *dest) in keyring_alloc()
263 struct key *keyring; in keyring_alloc()
325 struct key *keyring; in keyring_search_aux()
333 struct key *keyring, *key; in keyring_search_aux() local
364 key = keyring; in keyring_search_aux()
372 if (key->expiry && now.tv_sec >= key->expiry) in keyring_search_aux()
374 key_ref = ERR_PTR(key->type_data.reject_error); in keyring_search_aux()
404 key = rcu_dereference(keylist->keys[kix]); in keyring_search_aux()
405 kflags = key->flags; in keyring_search_aux()
408 if (key->type != type) in keyring_search_aux()
417 if (key->expiry && now.tv_sec >= key->expiry) in keyring_search_aux()
422 if (!match(key, description)) in keyring_search_aux()
426 if (key_task_permission(make_key_ref(key, possessed), in keyring_search_aux()
435 err = key->type_data.reject_error; in keyring_search_aux()
448 key = rcu_dereference(keylist->keys[kix]); in keyring_search_aux()
449 if (key->type != &key_type_keyring) in keyring_search_aux()
458 if (key_task_permission(make_key_ref(key, possessed), in keyring_search_aux()
469 keyring = key; in keyring_search_aux()
490 atomic_inc(&key->usage); in keyring_search_aux()
491 key->last_used_at = now.tv_sec; in keyring_search_aux()
495 key_check(key); in keyring_search_aux()
496 key_ref = make_key_ref(key, possessed); in keyring_search_aux()
546 struct key *keyring, *key; in __keyring_search_one() local
559 key = rcu_dereference(klist->keys[loop]); in __keyring_search_one()
560 if (key->type == ktype && in __keyring_search_one()
561 (!key->type->match || in __keyring_search_one()
562 key->type->match(key, description)) && in __keyring_search_one()
563 key_permission(make_key_ref(key, possessed), in __keyring_search_one()
565 !(key->flags & ((1 << KEY_FLAG_INVALIDATED) | in __keyring_search_one()
576 atomic_inc(&key->usage); in __keyring_search_one()
577 keyring->last_used_at = key->last_used_at = in __keyring_search_one()
580 return make_key_ref(key, possessed); in __keyring_search_one()
594 struct key *find_keyring_by_name(const char *name, bool skip_perm_check) in find_keyring_by_name()
596 struct key *keyring; in find_keyring_by_name()
650 static int keyring_detect_cycle(struct key *A, struct key *B) in keyring_detect_cycle()
658 struct key *subtree, *key; in keyring_detect_cycle() local
685 key = rcu_dereference(keylist->keys[kix]); in keyring_detect_cycle()
687 if (key == A) in keyring_detect_cycle()
691 if (key->type == &key_type_keyring) { in keyring_detect_cycle()
701 subtree = key; in keyring_detect_cycle()
749 int __key_link_begin(struct key *keyring, const struct key_type *type, in __key_link_begin()
784 struct key *key = rcu_deref_link_locked(klist, loop, in __key_link_begin() local
786 if (key->type == type && in __key_link_begin()
787 strcmp(key->description, description) == 0) { in __key_link_begin()
796 if (key->last_used_at < lowest_lru) { in __key_link_begin()
797 lowest_lru = key->last_used_at; in __key_link_begin()
833 size = sizeof(*klist) + sizeof(struct key *) * max; in __key_link_begin()
843 sizeof(struct key *) * klist->nkeys); in __key_link_begin()
881 int __key_link_check_live_key(struct key *keyring, struct key *key) in __key_link_check_live_key() argument
883 if (key->type == &key_type_keyring) in __key_link_check_live_key()
886 return keyring_detect_cycle(keyring, key); in __key_link_check_live_key()
898 void __key_link(struct key *keyring, struct key *key, in __key_link() argument
902 struct key *discard; in __key_link()
907 kenter("%d,%d,%p", keyring->serial, key->serial, nklist); in __key_link()
911 atomic_inc(&key->usage); in __key_link()
912 keyring->last_used_at = key->last_used_at = in __key_link()
921 RCU_INIT_POINTER(nklist->keys[nklist->delkey], key); in __key_link()
939 rcu_assign_pointer(klist->keys[klist->delkey], key); in __key_link()
948 RCU_INIT_POINTER(klist->keys[klist->delkey], key); in __key_link()
959 void __key_link_end(struct key *keyring, struct key_type *type, in __key_link_end()
1001 int key_link(struct key *keyring, struct key *key) in key_link() argument
1007 key_check(key); in key_link()
1009 ret = __key_link_begin(keyring, key->type, key->description, &prealloc); in key_link()
1011 ret = __key_link_check_live_key(keyring, key); in key_link()
1013 __key_link(keyring, key, &prealloc); in key_link()
1014 __key_link_end(keyring, key->type, prealloc); in key_link()
1038 int key_unlink(struct key *keyring, struct key *key) in key_unlink() argument
1044 key_check(key); in key_unlink()
1056 if (rcu_access_pointer(klist->keys[loop]) == key) in key_unlink()
1067 sizeof(struct key *) * klist->maxkeys, in key_unlink()
1077 loop * sizeof(struct key *)); in key_unlink()
1082 (nklist->nkeys - loop) * sizeof(struct key *)); in key_unlink()
1132 int keyring_clear(struct key *keyring) in keyring_clear()
1170 static void keyring_revoke(struct key *keyring) in keyring_revoke()
1193 void keyring_gc(struct key *keyring, time_t limit) in keyring_gc()
1196 struct key *key; in keyring_gc() local
1219 new = kmalloc(sizeof(struct keyring_list) + max * sizeof(struct key *), in keyring_gc()
1232 key = rcu_deref_link_locked(klist, loop, keyring); in keyring_gc()
1233 if (!key_is_dead(key, limit)) { in keyring_gc()
1236 RCU_INIT_POINTER(new->keys[keep++], key_get(key)); in keyring_gc()