summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-05-04 20:04:43 -0400
committerirungentoo <irungentoo@gmail.com>2014-05-04 20:04:43 -0400
commitfca5e1b99aaa09f60c6f3f469fdfd23231f50c90 (patch)
tree4479f276325714033fcf52ecca0b21ee4feca102 /docs
parent4dc0af61c6ea5b1581aca0d15cfd9ffc0f525b10 (diff)
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.
Diffstat (limited to 'docs')
-rw-r--r--docs/Tox_middle_level_network_protocol.txt31
1 files changed, 26 insertions, 5 deletions
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:
41cookie request packet: 41cookie request packet:
42[uint8_t 24][Senders DHT Public key (32 bytes)][Random nonce (24 42[uint8_t 24][Senders DHT Public key (32 bytes)][Random nonce (24
43bytes)][Encrypted message containing: [Senders real public key (32 43bytes)][Encrypted message containing: [Senders real public key (32
44bytes)][Recievers real public key (32 bytes)][uint64_t number (must be sent back 44bytes)][Recievers real public key (32 bytes)][uint64_t number (must be sent
45untouched in cookie response)]] 45back untouched in cookie response)]]
46Encrypted message is encrypted with sender DHT private key, recievers DHT 46Encrypted message is encrypted with sender DHT private key, recievers DHT
47public key and the nonce. 47public key and the nonce.
48 48
@@ -88,9 +88,30 @@ in the handshake will be used to encrypt the first data packet sent, the nonce
88 88
89Data packets: 89Data packets:
90 90
91[uint8_t 27][uint16_t (in network byte order) the last 2 bytes of the nonce used 91[uint8_t 27][uint16_t (in network byte order) the last 2 bytes of the nonce
92to encrypt this][encrypted with the session key and a nonce:[data]] 92used to encrypt this][encrypted with the session key and a nonce:[plain data]]
93 93
94Data in the data packets: 94Plain data in the data packets:
95
96[uint32_t our recvbuffers buffer_start, (highest packet number handled +
971)][uint32_t packet number if lossless, our sendbuffer buffer_end if
98lossy][data]
99
100data ids:
1010: padding (skipped until we hit a non zero (data id) byte)
1021: packet request packet (lossy packet)
95... 103...
10416+: reserved for Messenger usage (lossless packets).
105
106packet request packet: [uint8_t (1)][uint8_t num][uint8_t num][uint8_t
107num]...[uint8_t num]
108
109the list of nums are a list of packet numbers the other is requesting.
110to get the real packet numbers from this list take the recvbuffers buffer_start
111from the packet, substract 1 to it and put it in packet_num then start from the
112beggining of the num list: if num is zero, add 255 to packet_num then do the
113next num. if num isn't zero, add its value to packet_num, note that the other
114has requested we send this packet again to them then continue to the next num in
115the list.
116
96 117