diff options
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 10 |
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 | ||
398 | newHandShakeData :: TransportCrypto -> Nonce24 -> HandshakeParams -> SockAddr -> IO (Maybe HandshakeData) | 398 | newHandShakeData :: TransportCrypto -> Nonce24 -> HandshakeParams -> SockAddr -> PublicKey -> IO (Maybe HandshakeData) |
399 | newHandShakeData crypto basenonce (HParam {hpOtherCookie,hpMySecretKey,hpCookieRemotePubkey,hpCookieRemoteDhtkey}) addr | 399 | newHandShakeData 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) |