Lines Matching defs:keypair
100 struct noise_keypair *keypair = kzalloc(sizeof(*keypair), GFP_KERNEL);
102 if (unlikely(!keypair))
104 spin_lock_init(&keypair->receiving_counter.lock);
105 keypair->internal_id = atomic64_inc_return(&keypair_counter);
106 keypair->entry.type = INDEX_HASHTABLE_KEYPAIR;
107 keypair->entry.peer = peer;
108 kref_init(&keypair->refcount);
109 return keypair;
119 struct noise_keypair *keypair =
123 keypair->entry.peer->device->dev->name,
124 keypair->internal_id,
125 keypair->entry.peer->internal_id);
126 wg_index_hashtable_remove(keypair->entry.peer->device->index_hashtable,
127 &keypair->entry);
128 call_rcu(&keypair->rcu, keypair_free_rcu);
131 void wg_noise_keypair_put(struct noise_keypair *keypair, bool unreference_now)
133 if (unlikely(!keypair))
137 keypair->entry.peer->device->index_hashtable,
138 &keypair->entry);
139 kref_put(&keypair->refcount, keypair_free_kref);
142 struct noise_keypair *wg_noise_keypair_get(struct noise_keypair *keypair)
145 "Taking noise keypair reference without holding the RCU BH read lock");
146 if (unlikely(!keypair || !kref_get_unless_zero(&keypair->refcount)))
148 return keypair;
181 struct noise_keypair *keypair;
187 keypair = rcu_dereference_protected(peer->keypairs.next_keypair,
189 if (keypair)
190 keypair->sending.is_valid = false;
191 keypair = rcu_dereference_protected(peer->keypairs.current_keypair,
193 if (keypair)
194 keypair->sending.is_valid = false;
213 * keypair can now be used.
216 /* If there already was a next keypair pending, we
217 * demote it to be the previous keypair, and free the
220 * always just get rid of the unused next keypair
229 } else /* If there wasn't an existing next keypair, we replace
234 /* At this point we can get rid of the old previous keypair, and
235 * set up the new keypair.
240 /* If we're the responder, it means we can't use the new keypair