From bc8c61dd7933f1cacd91282c0476f7bc46795daf Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 2 Jun 2018 04:08:54 -0400 Subject: Change Cookie -> Cookie Encrypted --- src/Network/Tox/Crypto/Handlers.hs | 4 ++-- src/Network/Tox/Crypto/Transport.hs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Network/Tox/Crypto') diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index f650a815..56fb4dcf 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs @@ -222,7 +222,7 @@ data NetCryptoSession = NCrypto , ncTheirBaseNonce :: TVar (UponHandshake Nonce24) -- base nonce + packet number , ncMyPacketNonce :: TVar Nonce24 -- base nonce + packet number , ncHandShake :: TVar (UponHandshake (Handshake Encrypted)) - , ncCookie :: TVar (UponCookie Cookie) -- ^ Cookie issued by remote peer + , ncCookie :: TVar (UponCookie (Cookie Encrypted)) -- ^ Cookie issued by remote peer , ncTheirDHTKey :: UponDHTKey PublicKey , ncTheirSessionPublic :: TVar (UponHandshake PublicKey) , ncSessionSecret :: SecretKey @@ -387,7 +387,7 @@ newSessionsState crypto unrechook hooks = do data HandshakeParams = HParam { hpTheirBaseNonce :: Maybe Nonce24 -- ignore and generate your own - , hpOtherCookie :: Cookie + , hpOtherCookie :: Cookie Encrypted , hpTheirSessionKeyPublic :: Maybe PublicKey , hpMySecretKey :: SecretKey , hpCookieRemotePubkey :: PublicKey diff --git a/src/Network/Tox/Crypto/Transport.hs b/src/Network/Tox/Crypto/Transport.hs index 0588da4b..e23d1865 100644 --- a/src/Network/Tox/Crypto/Transport.hs +++ b/src/Network/Tox/Crypto/Transport.hs @@ -99,7 +99,7 @@ data Handshake (f :: * -> *) = Handshake -- response packet with a cookie in it. It may also be obtained in the -- handshake packet by a peer receiving a handshake packet (Other -- Cookie). - handshakeCookie :: Cookie + handshakeCookie :: Cookie f -- The nonce is a nonce used to encrypt the encrypted part of the handshake -- packet. , handshakeNonce :: Nonce24 @@ -113,10 +113,10 @@ instance Serialize (Handshake Encrypted) where put (Handshake cookie n24 dta) = put cookie >> put n24 >> put dta data HandshakeData = HandshakeData - { baseNonce :: Nonce24 - , sessionKey :: PublicKey - , cookieHash :: Digest SHA512 - , otherCookie :: Cookie + { baseNonce :: Nonce24 -- ^ [24 bytes base nonce] + , sessionKey :: PublicKey -- ^ [session public key of the peer (32 bytes)] + , cookieHash :: Digest SHA512 -- ^ [sha512 hash of the entire Cookie sitting outside the encrypted part] + , otherCookie :: Cookie Encrypted -- ^ [Other Cookie (used by the other to respond to the handshake packet)] } instance Sized HandshakeData where -- cgit v1.2.3