Lines Matching refs:peer
61 void wg_cookie_checker_precompute_peer_keys(struct wg_peer *peer) in wg_cookie_checker_precompute_peer_keys() argument
63 precompute_key(peer->latest_cookie.cookie_decryption_key, in wg_cookie_checker_precompute_peer_keys()
64 peer->handshake.remote_static, cookie_key_label); in wg_cookie_checker_precompute_peer_keys()
65 precompute_key(peer->latest_cookie.message_mac1_key, in wg_cookie_checker_precompute_peer_keys()
66 peer->handshake.remote_static, mac1_key_label); in wg_cookie_checker_precompute_peer_keys()
157 struct wg_peer *peer) in wg_cookie_add_mac_to_packet() argument
162 down_write(&peer->latest_cookie.lock); in wg_cookie_add_mac_to_packet()
164 peer->latest_cookie.message_mac1_key); in wg_cookie_add_mac_to_packet()
165 memcpy(peer->latest_cookie.last_mac1_sent, macs->mac1, COOKIE_LEN); in wg_cookie_add_mac_to_packet()
166 peer->latest_cookie.have_sent_mac1 = true; in wg_cookie_add_mac_to_packet()
167 up_write(&peer->latest_cookie.lock); in wg_cookie_add_mac_to_packet()
169 down_read(&peer->latest_cookie.lock); in wg_cookie_add_mac_to_packet()
170 if (peer->latest_cookie.is_valid && in wg_cookie_add_mac_to_packet()
171 !wg_birthdate_has_expired(peer->latest_cookie.birthdate, in wg_cookie_add_mac_to_packet()
174 peer->latest_cookie.cookie); in wg_cookie_add_mac_to_packet()
177 up_read(&peer->latest_cookie.lock); in wg_cookie_add_mac_to_packet()
201 struct wg_peer *peer = NULL; in wg_cookie_message_consume() local
208 src->receiver_index, &peer))) in wg_cookie_message_consume()
211 down_read(&peer->latest_cookie.lock); in wg_cookie_message_consume()
212 if (unlikely(!peer->latest_cookie.have_sent_mac1)) { in wg_cookie_message_consume()
213 up_read(&peer->latest_cookie.lock); in wg_cookie_message_consume()
218 peer->latest_cookie.last_mac1_sent, COOKIE_LEN, src->nonce, in wg_cookie_message_consume()
219 peer->latest_cookie.cookie_decryption_key); in wg_cookie_message_consume()
220 up_read(&peer->latest_cookie.lock); in wg_cookie_message_consume()
223 down_write(&peer->latest_cookie.lock); in wg_cookie_message_consume()
224 memcpy(peer->latest_cookie.cookie, cookie, COOKIE_LEN); in wg_cookie_message_consume()
225 peer->latest_cookie.birthdate = ktime_get_coarse_boottime_ns(); in wg_cookie_message_consume()
226 peer->latest_cookie.is_valid = true; in wg_cookie_message_consume()
227 peer->latest_cookie.have_sent_mac1 = false; in wg_cookie_message_consume()
228 up_write(&peer->latest_cookie.lock); in wg_cookie_message_consume()
235 wg_peer_put(peer); in wg_cookie_message_consume()