summaryrefslogtreecommitdiffstats
path: root/src/wireguard.h
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@mail.noconroy.net>2019-05-01 21:44:51 +1000
committerMatt Dunwoodie <ncon@mail.noconroy.net>2019-05-01 22:13:19 +1000
commit40255775694138b09e173a2c1962bb6b0a050e99 (patch)
treef9908776feaf3c769df26a706938b14b89df6a10 /src/wireguard.h
parentAdd util function to allocate packet (diff)
downloadwireguard-openbsd-40255775694138b09e173a2c1962bb6b0a050e99.tar.xz
wireguard-openbsd-40255775694138b09e173a2c1962bb6b0a050e99.zip
Refactor handshake initialisation
Again, reducing code duplication and hopefully making register_id more reliable. The calls to register_id have been consolidated into the init and clear functions.
Diffstat (limited to 'src/wireguard.h')
-rw-r--r--src/wireguard.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/wireguard.h b/src/wireguard.h
index 3935a1a2e6e..f8fbd7b29ef 100644
--- a/src/wireguard.h
+++ b/src/wireguard.h
@@ -35,16 +35,6 @@ enum wg_key_type {
WG_KEY_SHARED,
};
-enum wg_handshake_state {
- WG_HS_UNINITIALISED,
- WG_HS_RECV_INITIATION,
- WG_HS_RECV_RESPONSE,
- WG_HS_SENT_INITIATION,
- WG_HS_SENT_RESPONSE,
- WG_HS_WAIT_CONFIRMATION,
- WG_HS_COMPLETE,
-};
-
enum wg_task {
WG_TASK_REKEY,
WG_TASK_KEEPALIVE,
@@ -66,14 +56,8 @@ struct wg_peer {
u_int8_t p_remote_pubkey[WG_KEY_SIZE];
u_int8_t p_psk [WG_KEY_SIZE];
- struct wg_timestamp {
- u_int8_t bytes[WG_TIMESTAMP_SIZE];
- } p_ts;
-
struct wg_handshake {
- enum wg_handshake_state state;
enum wg_role role;
- struct timespec last_initiation;
u_int32_t local_id;
u_int32_t remote_id;
u_int8_t mac[WG_MAC_SIZE];
@@ -102,12 +86,18 @@ struct wg_peer {
bool p_require_keepalive, p_require_broken;
struct timespec p_lastrecv;
+ struct timespec p_lastinit;
struct wg_cookie {
u_int8_t value [WG_COOKIE_SIZE];
struct timespec time;
} p_cookie;
+ struct wg_timestamp {
+ u_int8_t bytes[WG_TIMESTAMP_SIZE];
+ } p_ts;
+
+
struct mbuf_list p_tempq;
};