aboutsummaryrefslogtreecommitdiffstats
path: root/src/Network/WireGuard/Internal
diff options
context:
space:
mode:
authorBin Jin <bjin@ctrl-d.org>2017-03-13 00:38:47 +0800
committerBin Jin <bjin@ctrl-d.org>2017-03-13 00:38:47 +0800
commit6a50ba8572d4fdb760c28dafd0ab652fab9c01fd (patch)
tree6daa5341f90b2ca9e15060be11f0333af2f9d58e /src/Network/WireGuard/Internal
parentAdd README.md (diff)
downloadwireguard-hs-6a50ba8572d4fdb760c28dafd0ab652fab9c01fd.tar.xz
wireguard-hs-6a50ba8572d4fdb760c28dafd0ab652fab9c01fd.zip
Remove unnecessary publickey check
Diffstat (limited to 'src/Network/WireGuard/Internal')
-rw-r--r--src/Network/WireGuard/Internal/Noise.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/Network/WireGuard/Internal/Noise.hs b/src/Network/WireGuard/Internal/Noise.hs
index b529d25..842e002 100644
--- a/src/Network/WireGuard/Internal/Noise.hs
+++ b/src/Network/WireGuard/Internal/Noise.hs
@@ -59,13 +59,11 @@ recvFirstMessageAndReply state0 ciphertext1 plaintext2 = do
Just rpub -> return (ciphertext2, plaintext1, rpub, extractSessionKey state2)
recvSecondMessage :: NoiseStateWG -> ByteString
- -> Either SomeException (ScrubbedBytes, PublicKey, SessionKey)
+ -> Either SomeException (ScrubbedBytes, SessionKey)
recvSecondMessage state1 ciphertext2 = do
(plaintext2, state2) <- readMessage state1 ciphertext2
unless (handshakeComplete state2) internalError
- case remoteStaticKey state2 of
- Nothing -> internalError
- Just rpub -> return (plaintext2, rpub, extractSessionKey state2)
+ return (plaintext2, extractSessionKey state2)
encryptMessage :: SessionKey -> Counter -> ScrubbedBytes -> (EncryptedPayload, AuthTag)
encryptMessage key counter plaintext = (ciphertext, convert authtag)