aboutsummaryrefslogtreecommitdiffstats
path: root/src/wg_cookie.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wg_cookie.c')
-rw-r--r--src/wg_cookie.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/wg_cookie.c b/src/wg_cookie.c
index 6b90e3ab7898..34d0328d898f 100644
--- a/src/wg_cookie.c
+++ b/src/wg_cookie.c
@@ -111,6 +111,14 @@ cookie_checker_init(struct cookie_checker *cc)
}
void
+cookie_checker_free(struct cookie_checker *cc)
+{
+ rw_destroy(&cc->cc_key_lock);
+ rw_destroy(&cc->cc_secret_lock);
+ explicit_bzero(cc, sizeof(*cc));
+}
+
+void
cookie_checker_update(struct cookie_checker *cc,
const uint8_t key[COOKIE_INPUT_SIZE])
{
@@ -152,6 +160,13 @@ cookie_maker_init(struct cookie_maker *cm, const uint8_t key[COOKIE_INPUT_SIZE])
rw_init(&cm->cm_lock, "cookie_maker");
}
+void
+cookie_maker_free(struct cookie_maker *cm)
+{
+ rw_destroy(&cm->cm_lock);
+ explicit_bzero(cm, sizeof(*cm));
+}
+
int
cookie_maker_consume_payload(struct cookie_maker *cm,
uint8_t nonce[COOKIE_NONCE_SIZE], uint8_t ecookie[COOKIE_ENCRYPTED_SIZE])
@@ -340,6 +355,7 @@ ratelimit_deinit(struct ratelimit *rl)
callout_stop(&rl->rl_gc);
ratelimit_gc(rl, true);
rw_wunlock(&rl->rl_lock);
+ rw_destroy(&rl->rl_lock);
}
static void