aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/if_wg.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/if_wg.c b/src/if_wg.c
index 1a039a0..a373958 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -1548,7 +1548,6 @@ out:
static void
wg_decrypt(struct wg_softc *sc, struct wg_packet *pkt)
{
- struct wg_pkt_data data;
struct wg_peer *peer, *allowed_peer;
struct noise_remote *remote;
struct mbuf *m;
@@ -1559,11 +1558,10 @@ wg_decrypt(struct wg_softc *sc, struct wg_packet *pkt)
peer = noise_remote_arg(remote);
m = pkt->p_mbuf;
- /* Read index, nonce and then adjust to remove the header. */
- memcpy(&data, mtod(m, void *), sizeof(struct wg_pkt_data));
+ /* Read nonce and then adjust to remove the header. */
+ pkt->p_nonce = le64toh(mtod(m, struct wg_pkt_data *)->nonce);
m_adj(m, sizeof(struct wg_pkt_data));
- pkt->p_nonce = le64toh(data.nonce);
if (noise_keypair_decrypt(pkt->p_keypair, pkt->p_nonce, m) != 0)
goto out;