From fca5e1b99aaa09f60c6f3f469fdfd23231f50c90 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sun, 4 May 2014 20:04:43 -0400 Subject: Added arrays to store packets on send/recv in net crypto. Wrote down more of the protocol. Padding support has been added and implemented which will make it possible for us to pad packets to mitigate length related attacks. --- docs/Tox_middle_level_network_protocol.txt | 31 +++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/Tox_middle_level_network_protocol.txt b/docs/Tox_middle_level_network_protocol.txt index 7b65db51..f9b03196 100644 --- a/docs/Tox_middle_level_network_protocol.txt +++ b/docs/Tox_middle_level_network_protocol.txt @@ -41,8 +41,8 @@ Detailed implementation details: cookie request packet: [uint8_t 24][Senders DHT Public key (32 bytes)][Random nonce (24 bytes)][Encrypted message containing: [Senders real public key (32 -bytes)][Recievers real public key (32 bytes)][uint64_t number (must be sent back -untouched in cookie response)]] +bytes)][Recievers real public key (32 bytes)][uint64_t number (must be sent +back untouched in cookie response)]] Encrypted message is encrypted with sender DHT private key, recievers DHT public key and the nonce. @@ -88,9 +88,30 @@ in the handshake will be used to encrypt the first data packet sent, the nonce Data packets: -[uint8_t 27][uint16_t (in network byte order) the last 2 bytes of the nonce used -to encrypt this][encrypted with the session key and a nonce:[data]] +[uint8_t 27][uint16_t (in network byte order) the last 2 bytes of the nonce +used to encrypt this][encrypted with the session key and a nonce:[plain data]] -Data in the data packets: +Plain data in the data packets: + +[uint32_t our recvbuffers buffer_start, (highest packet number handled + +1)][uint32_t packet number if lossless, our sendbuffer buffer_end if +lossy][data] + +data ids: +0: padding (skipped until we hit a non zero (data id) byte) +1: packet request packet (lossy packet) ... +16+: reserved for Messenger usage (lossless packets). + +packet request packet: [uint8_t (1)][uint8_t num][uint8_t num][uint8_t +num]...[uint8_t num] + +the list of nums are a list of packet numbers the other is requesting. +to get the real packet numbers from this list take the recvbuffers buffer_start +from the packet, substract 1 to it and put it in packet_num then start from the +beggining of the num list: if num is zero, add 255 to packet_num then do the +next num. if num isn't zero, add its value to packet_num, note that the other +has requested we send this packet again to them then continue to the next num in +the list. + -- cgit v1.2.3