summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index 5946c530..cd227a4d 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -657,7 +657,7 @@ cryptoNetHandler sessions addr (NetCrypto (CryptoPacket nonce16 encrypted)) = do
657 theirBaseNonce <- atomically $ readTVar ncTheirBaseNonce 657 theirBaseNonce <- atomically $ readTVar ncTheirBaseNonce
658 -- Try to decrypt message 658 -- Try to decrypt message
659 let diff :: Word16 659 let diff :: Word16
660 diff = nonce16 - fromIntegral (last2Bytes theirBaseNonce) -- truncating to Word16 660 diff = nonce16 - (last2Bytes theirBaseNonce) -- truncating to Word16
661 tempNonce = addtoNonce24 theirBaseNonce (fromIntegral diff) -- expanding to Word 661 tempNonce = addtoNonce24 theirBaseNonce (fromIntegral diff) -- expanding to Word
662 lr <- fmap join $ sequence $ do -- Either Monad -- 662 lr <- fmap join $ sequence $ do -- Either Monad --
663 pubkey <- maybeToEither ncTheirSessionPublic 663 pubkey <- maybeToEither ncTheirSessionPublic
@@ -698,7 +698,7 @@ cryptoNetHandler sessions addr (NetCrypto (CryptoPacket nonce16 encrypted)) = do
698 else do atomically $ PQ.enqueue ncPacketQueue bufferEnd cd 698 else do atomically $ PQ.enqueue ncPacketQueue bufferEnd cd
699 return Nothing 699 return Nothing
700 where 700 where
701 last2Bytes :: Nonce24 -> Word 701 last2Bytes :: Nonce24 -> Word16
702 last2Bytes (Nonce24 bs) = case S.decode (B.drop 22 bs) of 702 last2Bytes (Nonce24 bs) = case S.decode (B.drop 22 bs) of
703 Right n -> n 703 Right n -> n
704 _ -> error "unreachable-last2Bytes" 704 _ -> error "unreachable-last2Bytes"