From 0cf31116d73ab5fee76d71671de31c11261b3921 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 20 Apr 2021 15:50:23 -0600 Subject: global: cleanup openbsd lock defines Signed-off-by: Jason A. Donenfeld --- src/wg_noise.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/wg_noise.c') diff --git a/src/wg_noise.c b/src/wg_noise.c index 4beb9fd..4595dc7 100644 --- a/src/wg_noise.c +++ b/src/wg_noise.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "crypto.h" @@ -442,7 +443,7 @@ noise_remote_index(struct noise_local *l, uint32_t idx) { static int noise_remote_index_remove(struct noise_local *l, struct noise_remote *r) { - rw_assert_wrlock(&r->r_handshake_lock); + rw_assert(&r->r_handshake_lock, RA_WLOCKED); if (r->r_handshake_state != HANDSHAKE_DEAD) { rw_wlock(&l->l_index_lock); CK_LIST_REMOVE(&r->r_index, i_entry); @@ -626,7 +627,7 @@ noise_add_new_keypair(struct noise_local *l, struct noise_remote *r, rw_wunlock(&r->r_keypair_lock); /* Insert into index table */ - rw_assert_wrlock(&r->r_handshake_lock); + rw_assert(&r->r_handshake_lock, RA_WLOCKED); kp->kp_index.i_is_keypair = true; kp->kp_index.i_local_index = r_i->i_local_index; @@ -645,7 +646,7 @@ noise_begin_session(struct noise_remote *r) { struct noise_keypair *kp; - rw_assert_wrlock(&r->r_handshake_lock); + rw_assert(&r->r_handshake_lock, RA_WLOCKED); if ((kp = malloc(sizeof(*kp), M_NOISE, M_NOWAIT)) == NULL) return (ENOSPC); -- cgit v1.2.3-59-g8ed1b