summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Crypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/Tox/Crypto')
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index 5a52450b..95cb1bc8 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -45,6 +45,7 @@ import PingMachine
45import qualified Data.IntMap.Strict as IntMap 45import qualified Data.IntMap.Strict as IntMap
46import Control.Concurrent.Supply 46import Control.Concurrent.Supply
47import Data.InOrOut 47import Data.InOrOut
48import DPut
48 49
49-- util, todo: move to another module 50-- util, todo: move to another module
50maybeToEither :: Maybe b -> Either String b 51maybeToEither :: Maybe b -> Either String b
@@ -536,7 +537,7 @@ updateCryptoSession sessions addr hp session = do
536 537
537cryptoNetHandler :: NetCryptoSessions -> SockAddr -> NetCrypto -> IO (Maybe (NetCrypto -> NetCrypto)) 538cryptoNetHandler :: NetCryptoSessions -> SockAddr -> NetCrypto -> IO (Maybe (NetCrypto -> NetCrypto))
538cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) nonce24 encrypted)) = do 539cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) nonce24 encrypted)) = do
539 hPutStrLn stderr ("RECIEVED HANDSHAKE from " ++ show addr) 540 dput XNetCrypto ("RECIEVED HANDSHAKE from " ++ show addr)
540 -- Handle Handshake Message 541 -- Handle Handshake Message
541 let crypto = transportCrypto sessions 542 let crypto = transportCrypto sessions
542 allsessions = netCryptoSessions sessions 543 allsessions = netCryptoSessions sessions
@@ -545,7 +546,7 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non
545 seckeys <- map fst <$> atomically (readTVar (userKeys crypto)) 546 seckeys <- map fst <$> atomically (readTVar (userKeys crypto))
546 symkey <- atomically $ transportSymmetric crypto 547 symkey <- atomically $ transportSymmetric crypto
547 now <- getPOSIXTime 548 now <- getPOSIXTime
548 hPutStrLn stderr ("Decrypt cookie with n24=" ++ show n24 ++ "\n symkey= " ++ show symkey) 549 dput XNetCrypto ("Decrypt cookie with n24=" ++ show n24 ++ "\n symkey= " ++ show symkey)
549 lr <- fmap join . sequence $ do -- Either Monad 550 lr <- fmap join . sequence $ do -- Either Monad
550 -- TODO: XXX: FIXME: 551 -- TODO: XXX: FIXME:
551 -- The following call to decryptSymmetric is failing every time, 552 -- The following call to decryptSymmetric is failing every time,
@@ -579,7 +580,7 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non
579 , hpCookieRemoteDhtkey = remoteDhtkey 580 , hpCookieRemoteDhtkey = remoteDhtkey
580 } 581 }
581 case lr of 582 case lr of
582 Left s -> hPutStrLn stderr ("cryptoNetHandler: " ++ s) 583 Left s -> dput XNetCrypto ("cryptoNetHandler: " ++ s)
583 Right hp@(HParam 584 Right hp@(HParam
584 { hpTheirBaseNonce = Just theirBaseNonce 585 { hpTheirBaseNonce = Just theirBaseNonce
585 , hpOtherCookie = otherCookie 586 , hpOtherCookie = otherCookie