aboutsummaryrefslogtreecommitdiffstats
path: root/src/wg_noise.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-04-20 15:50:23 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2021-04-20 16:01:55 -0600
commit0cf31116d73ab5fee76d71671de31c11261b3921 (patch)
treec4f556e26621e0f0f139c1331a5708ba7547bc71 /src/wg_noise.c
parentglobal: use ck for loads/stores, rather than macro maze (diff)
downloadwireguard-freebsd-0cf31116d73ab5fee76d71671de31c11261b3921.tar.xz
wireguard-freebsd-0cf31116d73ab5fee76d71671de31c11261b3921.zip
global: cleanup openbsd lock defines
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/wg_noise.c')
-rw-r--r--src/wg_noise.c7
1 files changed, 4 insertions, 3 deletions
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 <sys/refcount.h>
#include <sys/epoch.h>
#include <sys/ck.h>
+#include <sys/endian.h>
#include <crypto/siphash/siphash.h>
#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);