diff options
author | Joe Crayne <joe@jerkface.net> | 2018-11-01 21:51:00 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-11-02 00:21:52 -0400 |
commit | 1b3b665cb8413ed519fab1fa560716736676fa59 (patch) | |
tree | 413491b8429dc3986a576dea037956342ca5ef2d /src/Network | |
parent | b9b1a68f1a440f36b5f3b7a7acdd3d0e9a09a2a2 (diff) |
Comments and debug prints.
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/Tox/Crypto/Transport.hs | 3 | ||||
-rw-r--r-- | src/Network/Tox/Session.hs | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/Network/Tox/Crypto/Transport.hs b/src/Network/Tox/Crypto/Transport.hs index 9220fd1e..2a0633f0 100644 --- a/src/Network/Tox/Crypto/Transport.hs +++ b/src/Network/Tox/Crypto/Transport.hs | |||
@@ -154,8 +154,9 @@ data HandshakeData = HandshakeData | |||
154 | -- This prevents a replay attack where a new cookie is inserted into | 154 | -- This prevents a replay attack where a new cookie is inserted into |
155 | -- an old valid handshake packet | 155 | -- an old valid handshake packet |
156 | , otherCookie :: Cookie Encrypted | 156 | , otherCookie :: Cookie Encrypted |
157 | -- ^ Other Cookie (used by the repient to respond to the handshake packet) | 157 | -- ^ Other Cookie (used by the recipient to respond to the handshake packet) |
158 | } | 158 | } |
159 | deriving (Eq,Ord,Show) | ||
159 | 160 | ||
160 | instance Sized HandshakeData where | 161 | instance Sized HandshakeData where |
161 | size = contramap baseNonce size | 162 | size = contramap baseNonce size |
diff --git a/src/Network/Tox/Session.hs b/src/Network/Tox/Session.hs index c672087f..968b3503 100644 --- a/src/Network/Tox/Session.hs +++ b/src/Network/Tox/Session.hs | |||
@@ -116,10 +116,14 @@ plainHandshakeH :: SessionParams | |||
116 | plainHandshakeH sp saddr skey handshake = do | 116 | plainHandshakeH sp saddr skey handshake = do |
117 | let hd = runIdentity $ handshakeData handshake | 117 | let hd = runIdentity $ handshakeData handshake |
118 | prelude = show saddr ++ " --> " | 118 | prelude = show saddr ++ " --> " |
119 | dput XNetCrypto $ prelude ++ "handshake: " ++ show (otherCookie hd, baseNonce hd) | 119 | dput XNetCrypto $ unlines $ map (prelude ++) |
120 | [ "handshake: auth=" ++ show (handshakeCookie handshake) | ||
121 | , " : issuing=" ++ show (otherCookie hd) | ||
122 | , " : baseNonce=" ++ show (baseNonce hd) | ||
123 | ] | ||
120 | sent <- spGetSentHandshake sp skey saddr (handshakeCookie handshake) (otherCookie hd) | 124 | sent <- spGetSentHandshake sp skey saddr (handshakeCookie handshake) (otherCookie hd) |
121 | -- TODO: this is always returning sent = Nothing | 125 | -- TODO: this is always returning sent = Nothing |
122 | dput XNetCrypto $ " <-- (cached) handshake baseNonce" ++ show (fmap (baseNonce . snd) sent) | 126 | dput XNetCrypto $ " <-- (cached) handshake baseNonce " ++ show (fmap (baseNonce . snd) sent) |
123 | forM_ sent $ \(hd_skey,hd_sent) -> do | 127 | forM_ sent $ \(hd_skey,hd_sent) -> do |
124 | sk <- SessionKeys (spCrypto sp) | 128 | sk <- SessionKeys (spCrypto sp) |
125 | hd_skey | 129 | hd_skey |