diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-27 14:30:52 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-27 14:30:52 +0100 |
commit | 164e9747a9a90666c98d2dd31541bb11a3eee51d (patch) | |
tree | ab51f64cd797ecacf9d3cee364eb8292246957b0 /src/cadet/cadet_protocol.h | |
parent | d3b0b69e7d360b4b82c5a5580a7ea21317dfee24 (diff) | |
download | gnunet-164e9747a9a90666c98d2dd31541bb11a3eee51d.tar.gz gnunet-164e9747a9a90666c98d2dd31541bb11a3eee51d.zip |
trying to make KX logic slightly more readable
Diffstat (limited to 'src/cadet/cadet_protocol.h')
-rw-r--r-- | src/cadet/cadet_protocol.h | 67 |
1 files changed, 56 insertions, 11 deletions
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index 8fb260dfd..e2d6f9d0b 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h | |||
@@ -205,7 +205,9 @@ enum GNUNET_CADET_KX_Flags { | |||
205 | struct GNUNET_CADET_TunnelKeyExchangeMessage | 205 | struct GNUNET_CADET_TunnelKeyExchangeMessage |
206 | { | 206 | { |
207 | /** | 207 | /** |
208 | * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX. | 208 | * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX or |
209 | * #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX_AUTH as part | ||
210 | * of `struct GNUNET_CADET_TunnelKeyExchangeAuthMessage`. | ||
209 | */ | 211 | */ |
210 | struct GNUNET_MessageHeader header; | 212 | struct GNUNET_MessageHeader header; |
211 | 213 | ||
@@ -234,17 +236,57 @@ struct GNUNET_CADET_TunnelKeyExchangeMessage | |||
234 | */ | 236 | */ |
235 | struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key; | 237 | struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key; |
236 | 238 | ||
237 | #ifdef NEW_CADET | 239 | }; |
240 | |||
241 | |||
242 | /** | ||
243 | * Message for a Key eXchange for a tunnel, with authentication. | ||
244 | * Used as a response to the initial KX as well as for rekeying. | ||
245 | */ | ||
246 | struct GNUNET_CADET_TunnelKeyExchangeAuthMessage | ||
247 | { | ||
248 | |||
238 | /** | 249 | /** |
239 | * Proof that sender could compute the 3-DH, in lieu of a signature. | 250 | * Message header with key material. |
240 | */ | 251 | */ |
241 | struct GNUNET_HashCode triple_dh_proof; | 252 | struct GNUNET_CADET_TunnelKeyExchangeMessage kx; |
242 | #endif | 253 | |
254 | /** | ||
255 | * KDF-proof that sender could compute the 3-DH, used in lieu of a | ||
256 | * signature or payload data. | ||
257 | */ | ||
258 | struct GNUNET_HashCode auth; | ||
259 | |||
260 | }; | ||
261 | |||
262 | |||
263 | /** | ||
264 | * Encrypted axolotl header with numbers that identify which | ||
265 | * keys in which ratchet are to be used to decrypt the body. | ||
266 | */ | ||
267 | struct GNUNET_CADET_AxHeader | ||
268 | { | ||
269 | |||
270 | /** | ||
271 | * Number of messages sent with the current ratchet key. | ||
272 | */ | ||
273 | uint32_t Ns GNUNET_PACKED; | ||
274 | |||
275 | /** | ||
276 | * Number of messages sent with the previous ratchet key. | ||
277 | */ | ||
278 | uint32_t PNs GNUNET_PACKED; | ||
279 | |||
280 | /** | ||
281 | * Current ratchet key. | ||
282 | */ | ||
283 | struct GNUNET_CRYPTO_EcdhePublicKey DHRs; | ||
284 | |||
243 | }; | 285 | }; |
244 | 286 | ||
245 | 287 | ||
246 | /** | 288 | /** |
247 | * Axolotl tunnel message. | 289 | * Axolotl-encrypted tunnel message with application payload. |
248 | */ | 290 | */ |
249 | struct GNUNET_CADET_TunnelEncryptedMessage | 291 | struct GNUNET_CADET_TunnelEncryptedMessage |
250 | { | 292 | { |
@@ -277,8 +319,13 @@ struct GNUNET_CADET_TunnelEncryptedMessage | |||
277 | */ | 319 | */ |
278 | struct GNUNET_ShortHashCode hmac; | 320 | struct GNUNET_ShortHashCode hmac; |
279 | 321 | ||
280 | /**************** AX_HEADER start ****************/ | 322 | #if NEW_CADET |
281 | 323 | /** | |
324 | * Axolotl-header that specifies which keys to use in which ratchet | ||
325 | * to decrypt the body that follows. | ||
326 | */ | ||
327 | struct GNUNET_CADET_AxHeader ax_header; | ||
328 | #else | ||
282 | /** | 329 | /** |
283 | * Number of messages sent with the current ratchet key. | 330 | * Number of messages sent with the current ratchet key. |
284 | */ | 331 | */ |
@@ -293,9 +340,7 @@ struct GNUNET_CADET_TunnelEncryptedMessage | |||
293 | * Current ratchet key. | 340 | * Current ratchet key. |
294 | */ | 341 | */ |
295 | struct GNUNET_CRYPTO_EcdhePublicKey DHRs; | 342 | struct GNUNET_CRYPTO_EcdhePublicKey DHRs; |
296 | 343 | #endif | |
297 | /**************** AX_HEADER end ****************/ | ||
298 | |||
299 | /** | 344 | /** |
300 | * Encrypted content follows. | 345 | * Encrypted content follows. |
301 | */ | 346 | */ |