Lines Matching refs:keypair
100 struct noise_keypair *keypair = kzalloc(sizeof(*keypair), GFP_KERNEL); in keypair_create() local
102 if (unlikely(!keypair)) in keypair_create()
104 spin_lock_init(&keypair->receiving_counter.lock); in keypair_create()
105 keypair->internal_id = atomic64_inc_return(&keypair_counter); in keypair_create()
106 keypair->entry.type = INDEX_HASHTABLE_KEYPAIR; in keypair_create()
107 keypair->entry.peer = peer; in keypair_create()
108 kref_init(&keypair->refcount); in keypair_create()
109 return keypair; in keypair_create()
119 struct noise_keypair *keypair = in keypair_free_kref() local
123 keypair->entry.peer->device->dev->name, in keypair_free_kref()
124 keypair->internal_id, in keypair_free_kref()
125 keypair->entry.peer->internal_id); in keypair_free_kref()
126 wg_index_hashtable_remove(keypair->entry.peer->device->index_hashtable, in keypair_free_kref()
127 &keypair->entry); in keypair_free_kref()
128 call_rcu(&keypair->rcu, keypair_free_rcu); in keypair_free_kref()
131 void wg_noise_keypair_put(struct noise_keypair *keypair, bool unreference_now) in wg_noise_keypair_put() argument
133 if (unlikely(!keypair)) in wg_noise_keypair_put()
137 keypair->entry.peer->device->index_hashtable, in wg_noise_keypair_put()
138 &keypair->entry); in wg_noise_keypair_put()
139 kref_put(&keypair->refcount, keypair_free_kref); in wg_noise_keypair_put()
142 struct noise_keypair *wg_noise_keypair_get(struct noise_keypair *keypair) in wg_noise_keypair_get() argument
146 if (unlikely(!keypair || !kref_get_unless_zero(&keypair->refcount))) in wg_noise_keypair_get()
148 return keypair; in wg_noise_keypair_get()
181 struct noise_keypair *keypair; in wg_noise_expire_current_peer_keypairs() local
187 keypair = rcu_dereference_protected(peer->keypairs.next_keypair, in wg_noise_expire_current_peer_keypairs()
189 if (keypair) in wg_noise_expire_current_peer_keypairs()
190 keypair->sending.is_valid = false; in wg_noise_expire_current_peer_keypairs()
191 keypair = rcu_dereference_protected(peer->keypairs.current_keypair, in wg_noise_expire_current_peer_keypairs()
193 if (keypair) in wg_noise_expire_current_peer_keypairs()
194 keypair->sending.is_valid = false; in wg_noise_expire_current_peer_keypairs()