aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--driver/noise.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/driver/noise.c b/driver/noise.c
index e9f3c68..bef6f63 100644
--- a/driver/noise.c
+++ b/driver/noise.c
@@ -790,10 +790,11 @@ NoiseHandshakeConsumeResponse(CONST MESSAGE_HANDSHAKE_RESPONSE *Src, WG_DEVICE *
/* Success! Copy everything to peer */
MuAcquirePushLockExclusive(&Handshake->Lock);
- /* It's important to check that the state is still the same, while we
- * have an exclusive lock.
+ /* Check that the state is the same and that this is still the
+ * initiation we started with, while we have an exclusive lock.
*/
- if (Handshake->State != State)
+ if (Handshake->State != State ||
+ !CryptoEqualMemory32(Handshake->EphemeralPrivate, EphemeralPrivate, NOISE_PUBLIC_KEY_LEN))
{
MuReleasePushLockExclusive(&Handshake->Lock);
goto fail;