From 2f21694c9ef0e94bc3778029ca6fe85f416cc98a Mon Sep 17 00:00:00 2001 From: James Crayne Date: Wed, 30 May 2018 03:21:43 +0000 Subject: last2Bytes should be Word16 --- src/Network/Tox/Crypto/Handlers.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Network/Tox') 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 theirBaseNonce <- atomically $ readTVar ncTheirBaseNonce -- Try to decrypt message let diff :: Word16 - diff = nonce16 - fromIntegral (last2Bytes theirBaseNonce) -- truncating to Word16 + diff = nonce16 - (last2Bytes theirBaseNonce) -- truncating to Word16 tempNonce = addtoNonce24 theirBaseNonce (fromIntegral diff) -- expanding to Word lr <- fmap join $ sequence $ do -- Either Monad -- pubkey <- maybeToEither ncTheirSessionPublic @@ -698,7 +698,7 @@ cryptoNetHandler sessions addr (NetCrypto (CryptoPacket nonce16 encrypted)) = do else do atomically $ PQ.enqueue ncPacketQueue bufferEnd cd return Nothing where - last2Bytes :: Nonce24 -> Word + last2Bytes :: Nonce24 -> Word16 last2Bytes (Nonce24 bs) = case S.decode (B.drop 22 bs) of Right n -> n _ -> error "unreachable-last2Bytes" -- cgit v1.2.3