From e2e69ffc55abdd6df9e6f328ee867d8ed6639322 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 27 Oct 2017 17:39:30 -0400 Subject: Added TODO regarding Tox "Hardening" message. --- src/Network/Tox/DHT/Transport.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Network/Tox/DHT') diff --git a/src/Network/Tox/DHT/Transport.hs b/src/Network/Tox/DHT/Transport.hs index b7982a1a..6009afa2 100644 --- a/src/Network/Tox/DHT/Transport.hs +++ b/src/Network/Tox/DHT/Transport.hs @@ -174,6 +174,16 @@ data DHTRequest -- `8` `uint64_t` random number (the same that was received in request) | NATPong Nonce8 | DHTPK LongTermKeyWrap + -- From docs/Hardening_docs.txt + -- + -- All hardening requests must contain exactly 384 bytes of data. (The data sent + -- must be padded with zeros if it is smaller than that.) + -- + -- [byte with value: 02 (get nodes test request)][struct Node_format (the node to + -- test.)][client_id(32 bytes) the id to query the node with.][padding] + -- + -- packet id: CRYPTO_PACKET_HARDENING (48) + | Hardening -- TODO deriving Show instance Sized DHTRequest where @@ -193,10 +203,12 @@ instance Serialize DHTRequest where direction <- get bool NATPong NATPing (direction==(0::Word8)) <$> get 0x9c -> DHTPK <$> get + 0x30 -> pure Hardening -- TODO: CRYPTO_PACKET_HARDENING _ -> fail ("unrecognized DHT request: "++show tag) put (NATPing n) = put (0xfe00 :: Word16) >> put n put (NATPong n) = put (0xfe01 :: Word16) >> put n put (DHTPK pk) = put (0x9c :: Word8) >> put pk + put (Hardening) = put (0x30 :: Word8) >> putByteString (B.replicate 384 0) -- TODO -- DHT public key packet: -- (As Onion data packet?) -- cgit v1.2.3