summaryrefslogtreecommitdiffstats
path: root/src/wireguard.h
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-10 18:10:18 +1000
committerMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-10 18:31:48 +1000
commit85efc47fa76e04c75cad0b95429e90b78aad044c (patch)
tree1df701d2dd83543b24f0f640044a34f2573c4db3 /src/wireguard.h
parentUpdate debug messages (diff)
downloadwireguard-openbsd-85efc47fa76e04c75cad0b95429e90b78aad044c.tar.xz
wireguard-openbsd-85efc47fa76e04c75cad0b95429e90b78aad044c.zip
Abstract all handshake access to wireguard.c
Diffstat (limited to 'src/wireguard.h')
-rw-r--r--src/wireguard.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/wireguard.h b/src/wireguard.h
index 4518ee8e6bc..60c101b1d5a 100644
--- a/src/wireguard.h
+++ b/src/wireguard.h
@@ -90,7 +90,7 @@ struct wg_handshake {
uint8_t hs_spub[WG_KEY_SIZE];
uint8_t hs_shared[WG_KEY_SIZE];
struct wg_cookie hs_cookie;
- struct wg_keypair *hs_skey;
+ struct wg_keypair hs_skey;
struct timespec hs_last_initiation;
struct {
@@ -227,8 +227,6 @@ static char *wg_error_str[] = {
void wg_handshake_init(struct wg_handshake *);
void wg_session_init(struct wg_session *);
-uint32_t wg_handshake_id(struct wg_handshake *);
-uint32_t wg_session_id(struct wg_session *);
void wg_handshake_clean(struct wg_handshake *);
void wg_session_clean(struct wg_session *);
@@ -245,6 +243,16 @@ enum wg_error wg_handshake_response_valid_mac2(struct wg_cookie *, struct wg_msg
enum wg_error wg_handshake_merge(struct wg_handshake *, struct wg_handshake *);
void wg_handshake_reset_attempts(struct wg_handshake *);
+uint32_t wg_handshake_id(struct wg_handshake *);
+uint32_t wg_handshake_shortkey(struct wg_handshake *);
+void wg_handshake_setkeypair(struct wg_handshake *, struct wg_keypair *);
+void wg_handshake_setkey(struct wg_handshake *, uint8_t[WG_KEY_SIZE]);
+void wg_handshake_setshared(struct wg_handshake *, uint8_t[WG_KEY_SIZE]);
+void wg_handshake_getkey(struct wg_handshake *, uint8_t[WG_KEY_SIZE]);
+void wg_handshake_getshared(struct wg_handshake *, uint8_t[WG_KEY_SIZE]);
+int wg_handshake_keycmp(struct wg_handshake *, struct wg_handshake *);
+
+uint32_t wg_session_id(struct wg_session *);
enum wg_error wg_session_encrypt(struct wg_session *, struct wg_msg_transport *, size_t);
enum wg_error wg_session_decrypt(struct wg_session *, struct wg_msg_transport *, size_t);
enum wg_error wg_session_from_handshake(struct wg_session *, struct wg_handshake *);