summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Crypto
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-05-31 13:24:02 +0000
committerJames Crayne <jim.crayne@gmail.com>2018-05-31 13:24:02 +0000
commitd15e4e2b4f2c944ca8fc15b0b1fa0926ff74afe2 (patch)
treef606c69af6d3a4c1b069f9bdef7bb29ae330094b /src/Network/Tox/Crypto
parent7008671663916828d89bfff5441803dea10f1e00 (diff)
HandshakeData should include my session public, not my long term
Diffstat (limited to 'src/Network/Tox/Crypto')
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index bc7d7af8..493ae925 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -395,8 +395,8 @@ data HandshakeParams
395 , hpCookieRemoteDhtkey :: PublicKey 395 , hpCookieRemoteDhtkey :: PublicKey
396 } 396 }
397 397
398newHandShakeData :: TransportCrypto -> Nonce24 -> HandshakeParams -> SockAddr -> IO (Maybe HandshakeData) 398newHandShakeData :: TransportCrypto -> Nonce24 -> HandshakeParams -> SockAddr -> PublicKey -> IO (Maybe HandshakeData)
399newHandShakeData crypto basenonce (HParam {hpOtherCookie,hpMySecretKey,hpCookieRemotePubkey,hpCookieRemoteDhtkey}) addr 399newHandShakeData crypto basenonce (HParam {hpOtherCookie,hpMySecretKey,hpCookieRemotePubkey,hpCookieRemoteDhtkey}) addr mySessionPublic
400 = do 400 = do
401 freshCookie 401 freshCookie
402 <- case nodeInfo (key2id hpCookieRemoteDhtkey) addr of 402 <- case nodeInfo (key2id hpCookieRemoteDhtkey) addr of
@@ -418,7 +418,7 @@ newHandShakeData crypto basenonce (HParam {hpOtherCookie,hpMySecretKey,hpCookieR
418 fmap (\freshCookie' -> 418 fmap (\freshCookie' ->
419 HandshakeData 419 HandshakeData
420 { baseNonce = basenonce 420 { baseNonce = basenonce
421 , sessionKey = toPublic hpMySecretKey 421 , sessionKey = mySessionPublic
422 , cookieHash = digest 422 , cookieHash = digest
423 , otherCookie = freshCookie' 423 , otherCookie = freshCookie'
424 }) freshCookie 424 }) freshCookie
@@ -515,7 +515,8 @@ freshCryptoSession sessions
515 n24 <- atomically $ transportNewNonce crypto 515 n24 <- atomically $ transportNewNonce crypto
516 state <- lookupSharedSecret crypto key remotePublicKey n24 516 state <- lookupSharedSecret crypto key remotePublicKey n24
517 newBaseNonce <- atomically $ transportNewNonce crypto 517 newBaseNonce <- atomically $ transportNewNonce crypto
518 mbMyhandshakeData <- newHandShakeData crypto newBaseNonce hp addr 518 newsession <- generateSecretKey
519 mbMyhandshakeData <- newHandShakeData crypto newBaseNonce hp addr (toPublic newsession)
519 let encodeHandshake myhandshakeData = let plain = encodePlain myhandshakeData 520 let encodeHandshake myhandshakeData = let plain = encodePlain myhandshakeData
520 -- state = computeSharedSecret key remoteDhtPublicKey n24 521 -- state = computeSharedSecret key remoteDhtPublicKey n24
521 encrypted = encrypt state plain 522 encrypted = encrypt state plain
@@ -529,7 +530,6 @@ freshCryptoSession sessions
529 sendHandshake sessions addr response_handshake 530 sendHandshake sessions addr response_handshake
530 ncMyPacketNonce0 <- atomically $ newTVar newBaseNonce 531 ncMyPacketNonce0 <- atomically $ newTVar newBaseNonce
531 cookie0 <- atomically $ newTVar (HaveCookie otherCookie) 532 cookie0 <- atomically $ newTVar (HaveCookie otherCookie)
532 newsession <- generateSecretKey
533 ncHooks0 <- atomically $ newTVar (defaultHooks sessions) 533 ncHooks0 <- atomically $ newTVar (defaultHooks sessions)
534 ncUnrecognizedHook0 <- atomically $ newTVar (defaultUnrecognizedHook sessions) 534 ncUnrecognizedHook0 <- atomically $ newTVar (defaultUnrecognizedHook sessions)
535 ncIncomingTypeArray0 <- atomically $ newTVar (msgTypeArray sessions) 535 ncIncomingTypeArray0 <- atomically $ newTVar (msgTypeArray sessions)