ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/doc/gvpe.protocol.7.pod
(Generate patch)

Comparing gvpe/doc/gvpe.protocol.7.pod (file contents):
Revision 1.13 by root, Sat Apr 26 19:05:56 2014 UTC vs.
Revision 1.15 by root, Thu Jan 29 00:21:39 2015 UTC

120 +------+------+--------+------+ 120 +------+------+--------+------+
121 | HMAC | TYPE | SRCDST | DATA | 121 | HMAC | TYPE | SRCDST | DATA |
122 +------+------+--------+------+ 122 +------+------+--------+------+
123 123
124The HMAC field is present in all packets, even if not used (e.g. in auth 124The HMAC field is present in all packets, even if not used (e.g. in auth
125request packets), in which case it is set to all zeroes. The checksum 125request packets), in which case it is set to all zeroes. The MAC itself is
126itself is calculated over the TYPE, SRCDST and DATA fields in all cases. 126calculated over the TYPE, SRCDST and DATA fields in all cases.
127 127
128The TYPE field is a single byte and determines the purpose of the packet 128The TYPE field is a single byte and determines the purpose of the packet
129(e.g. RESET, COMPRESSED/UNCOMPRESSED DATA, PING, AUTH REQUEST/RESPONSE, 129(e.g. RESET, COMPRESSED/UNCOMPRESSED DATA, PING, AUTH REQUEST/RESPONSE,
130CONNECT REQUEST/INFO etc.). 130CONNECT REQUEST/INFO etc.).
131 131
134 134
135The DATA portion differs between each packet type, naturally, and is the 135The DATA portion differs between each packet type, naturally, and is the
136only part that can be encrypted. Data packets contain more fields, as 136only part that can be encrypted. Data packets contain more fields, as
137shown: 137shown:
138 138
139 +------+------+--------+------+-------+------+ 139 +------+------+--------+-------+------+
140 | HMAC | TYPE | SRCDST | RAND | SEQNO | DATA | 140 | HMAC | TYPE | SRCDST | SEQNO | DATA |
141 +------+------+--------+------+-------+------+ 141 +------+------+--------+-------+------+
142
143RAND is a sequence of fully random bytes, used to increase the entropy of
144the data for encryption purposes.
145 142
146SEQNO is a 32-bit sequence number. It is negotiated at every connection 143SEQNO is a 32-bit sequence number. It is negotiated at every connection
147initialization and starts at some random 31 bit value. GVPE currently uses 144initialization and starts at some random 31 bit value. GVPE currently uses
148a sliding window of 512 packets/sequence numbers to detect reordering, 145a sliding window of 512 packets/sequence numbers to detect reordering,
149duplication and replay attacks. 146duplication and replay attacks.
150 147
151The encryption is done on RAND+SEQNO+DATA in CBC mode with zero IV (or, 148The encryption is done on SEQNO+DATA in CTR mode with IV generated from
152equivalently, the IV is RAND+SEQNO, encrypted with the block cipher, 149the seqno (for AES: seqno || seqno || seqno || (u32)0), which ensures
153unless RAND size is decreased or increased over the default value). 150uniqueness for a given key.
154
155The random prefix itself is generated by using AES in CTR mode with a
156random key and starting value, which should make them unpredictable even
157before encrypting them again. The sequence number additionally ensures
158that the IV is unique.
159 151
160=head2 The authentication/key exchange protocol 152=head2 The authentication/key exchange protocol
161 153
162Before nodes can exchange packets, they need to establish authenticity of 154Before nodes can exchange packets, they need to establish authenticity of
163the other side and a key. Every node has a private RSA key and the public 155the other side and a key. Every node has a private RSA key and the public

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines