summaryrefslogtreecommitdiffstats
path: root/src/wireguard.h
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@mail.noconroy.net>2019-06-25 18:15:26 +1000
committerMatt Dunwoodie <ncon@mail.noconroy.net>2019-06-25 18:15:26 +1000
commitcda4b244e0825cc5f31d1716aa5e8192d03119c1 (patch)
treea34d65f4f32485585f6961131ff036450d71efc8 /src/wireguard.h
parentstaging18 (diff)
downloadwireguard-openbsd-cda4b244e0825cc5f31d1716aa5e8192d03119c1.tar.xz
wireguard-openbsd-cda4b244e0825cc5f31d1716aa5e8192d03119c1.zip
staging19
Diffstat (limited to 'src/wireguard.h')
-rw-r--r--src/wireguard.h99
1 files changed, 54 insertions, 45 deletions
diff --git a/src/wireguard.h b/src/wireguard.h
index b820699da84..74f2cd7ce12 100644
--- a/src/wireguard.h
+++ b/src/wireguard.h
@@ -52,57 +52,66 @@ enum wg_pkt_type {
WG_PKT_TRANSPORT,
};
+struct wg_handshake {
+ enum wg_role hs_role;
+ uint32_t hs_local_id;
+ uint32_t hs_remote_id;
+ uint8_t hs_mac[WG_MAC_SIZE];
+ uint8_t hs_hash [WG_HASH_SIZE];
+ uint8_t hs_ck [WG_HASH_SIZE];
+ uint8_t hs_k [WG_HASH_SIZE];
+ uint8_t hs_local_epub[WG_KEY_SIZE];
+ uint8_t hs_local_epriv[WG_KEY_SIZE];
+ uint8_t hs_remote_epub[WG_KEY_SIZE];
+};
+
+struct wg_antireplay {
+ uint64_t ar_head;
+ uint64_t ar_bitmap[WG_ARB_BITS / WG_ARI_BITS];
+};
+
+struct wg_session {
+ enum wg_role s_role;
+ struct timespec s_created;
+ uint64_t s_txcounter;
+ uint64_t s_rxcounter;
+ struct wg_antireplay s_ar;
+ uint8_t s_txkey[WG_KEY_SIZE];
+ uint8_t s_rxkey[WG_KEY_SIZE];
+ uint32_t s_local_id;
+ uint32_t s_remote_id;
+};
+
+struct wg_cookie {
+ uint8_t c_value[WG_COOKIE_SIZE];
+ struct timespec c_time;
+};
+
+struct wg_timestamp {
+ uint8_t ts_bytes[WG_TIMESTAMP_SIZE];
+};
+
+struct wg_conn;
+struct wg_upcall {
+ void *u_arg;
+ uint32_t (*u_getid)(void *, struct wg_conn *);
+ void (*u_dropid)(void *, uint32_t);
+ struct wg_conn *(*u_keylookup)(void *, uint8_t *);
+ void (*u_connready)(void *, struct wg_conn *);
+ uint8_t *u_pubkey, *u_privkey;
+};
+
struct wg_conn {
struct rwlock c_lock;
uint8_t c_psk[WG_KEY_SIZE];
uint8_t c_pubkey[WG_KEY_SIZE];
uint8_t c_local_pubkey[WG_KEY_SIZE], c_local_privkey[WG_KEY_SIZE];
- struct wg_handshake {
- enum wg_role hs_role;
- uint32_t hs_local_id;
- uint32_t hs_remote_id;
- uint8_t hs_mac[WG_MAC_SIZE];
- uint8_t hs_hash [WG_HASH_SIZE];
- uint8_t hs_ck [WG_HASH_SIZE];
- uint8_t hs_k [WG_HASH_SIZE];
- uint8_t hs_local_epub[WG_KEY_SIZE];
- uint8_t hs_local_epriv[WG_KEY_SIZE];
- uint8_t hs_remote_epub[WG_KEY_SIZE];
- } c_hs;
-
- struct wg_session {
- enum wg_role s_role;
- struct timespec s_created;
- struct wg_antireplay {
- uint64_t ar_head;
- uint64_t ar_bitmap[WG_ARB_BITS / WG_ARI_BITS];
- } s_ar;
- uint64_t s_txcounter;
- uint64_t s_rxcounter;
- uint8_t s_txkey[WG_KEY_SIZE];
- uint8_t s_rxkey[WG_KEY_SIZE];
- uint32_t s_local_id;
- uint32_t s_remote_id;
- } c_sess, c_sess_old;
-
- struct wg_cookie {
- uint8_t c_value[WG_COOKIE_SIZE];
- struct timespec c_time;
- } c_cookie;
-
- struct wg_timestamp {
- uint8_t ts_bytes[WG_TIMESTAMP_SIZE];
- } c_ts;
-
- struct wg_upcall {
- void *u_arg;
- uint32_t (*u_getid)(void *, struct wg_conn *);
- void (*u_dropid)(void *, uint32_t);
- struct wg_conn *(*u_keylookup)(void *, uint8_t *);
- void (*u_connready)(void *, struct wg_conn *);
- uint8_t *u_pubkey, *u_privkey;
- } *c_upcall;
+ struct wg_handshake c_hs;
+ struct wg_session c_sess, c_sess_old;
+ struct wg_cookie c_cookie;
+ struct wg_timestamp c_ts;
+ struct wg_upcall *c_upcall;
};
struct wg_msg_unknown {