aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@noconroy.net>2020-02-26 11:47:05 +1100
committerMatt Dunwoodie <ncon@noconroy.net>2020-02-26 11:47:05 +1100
commitd62fd47fdc99d3dc3ab01310403f0ce4c6f7bbc9 (patch)
tree35aa1b5eb9e2266a312cb7ee08d7b0165a6ccddb
parentMore tests (diff)
downloadwireguard-openbsd-d62fd47fdc99d3dc3ab01310403f0ce4c6f7bbc9.tar.xz
wireguard-openbsd-d62fd47fdc99d3dc3ab01310403f0ce4c6f7bbc9.zip
Move IPL out of cookie_param_init
-rw-r--r--src/cookie.c4
-rw-r--r--src/cookie.h8
-rw-r--r--src/if_wg.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/cookie.c b/src/cookie.c
index 3d30139..b20f65d 100644
--- a/src/cookie.c
+++ b/src/cookie.c
@@ -48,12 +48,12 @@ cookieinit()
/* Public Functions */
void
-cookie_param_init(struct cookie_param *cp, uint8_t key[COOKIE_INPUT_SIZE])
+cookie_param_init(struct cookie_param *cp, int ipl, uint8_t key[COOKIE_INPUT_SIZE])
{
bzero(cp, sizeof(*cp));
cookie_precompute_key(cp->cp_mac1_key, key, COOKIE_MAC1_KEY_LABEL);
cookie_precompute_key(cp->cp_cookie_key, key, COOKIE_COOKIE_KEY_LABEL);
- mtx_init(&cp->cp_mtx, IPL_NET);
+ mtx_init(&cp->cp_mtx, ipl);
}
int
diff --git a/src/cookie.h b/src/cookie.h
index 236e707..dfbdd71 100644
--- a/src/cookie.h
+++ b/src/cookie.h
@@ -29,11 +29,11 @@
* * mac1 - That the remote end knows a value.
* * mac2 - That the remote end has a specific IP address.
*
- * void cookie_param_init(cookie_param, input)
+ * void cookie_param_init(cookie_param, ipl, input)
* - Initialise cookie_param, should only be called once and before use.
* input is the shared value used for mac1.
*
- * int cookie_checker_init(cookie_checker)
+ * int cookie_checker_init(cookie_checker, ipl)
* - Initialise cookie_checker, should only be called once and before use. It
* will return ENOBUFS if it cannot allocate required memory.
*
@@ -155,8 +155,8 @@ struct cookie_checker {
void cookieinit();
-void cookie_param_init(struct cookie_param *, uint8_t[COOKIE_INPUT_SIZE]);
-int cookie_checker_init(struct cookie_checker *, int ipl);
+void cookie_param_init(struct cookie_param *, int, uint8_t[COOKIE_INPUT_SIZE]);
+int cookie_checker_init(struct cookie_checker *, int);
void cookie_checker_update(struct cookie_checker *, uint8_t[COOKIE_INPUT_SIZE]);
void cookie_checker_deinit(struct cookie_checker *);
void cookie_checker_create_payload(struct cookie_checker *,
diff --git a/src/if_wg.c b/src/if_wg.c
index 27459d3..ce204bb 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -390,7 +390,7 @@ wg_peer_create(struct wg_softc *sc, uint8_t public[WG_KEY_SIZE])
peer->p_id = peer_counter++;
peer->p_sc = if_get(sc->sc_if.if_index)->if_softc;
- cookie_param_init(&peer->p_cookie, public);
+ cookie_param_init(&peer->p_cookie, IPL_NET, public);
noise_keypairs_init(&peer->p_keypairs, IPL_NET);
noise_remote_init(&peer->p_remote, public, IPL_NET);