aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/cadet_protocol.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-08-26 12:37:48 +0000
committerChristian Grothoff <christian@grothoff.org>2016-08-26 12:37:48 +0000
commit25081ad4af5f056cb17cc3654560a89f7a932540 (patch)
tree4fdaf9824a9d65e773008f0aadf74a0a94027ccb /src/cadet/cadet_protocol.h
parent6ddb3909c0386efc4cf172eda113dbe904a0f75a (diff)
downloadgnunet-25081ad4af5f056cb17cc3654560a89f7a932540.tar.gz
gnunet-25081ad4af5f056cb17cc3654560a89f7a932540.zip
putting CADET on a diet: proper alignment for AX KX, kill obsolete OTR legacy code
Diffstat (limited to 'src/cadet/cadet_protocol.h')
-rw-r--r--src/cadet/cadet_protocol.h271
1 files changed, 69 insertions, 202 deletions
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h
index 1a42e920f..e40fa0e7b 100644
--- a/src/cadet/cadet_protocol.h
+++ b/src/cadet/cadet_protocol.h
@@ -52,23 +52,23 @@ GNUNET_NETWORK_STRUCT_BEGIN
52 */ 52 */
53struct GNUNET_CADET_ConnectionCreate 53struct GNUNET_CADET_ConnectionCreate
54{ 54{
55 /** 55 /**
56 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE 56 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
57 * 57 *
58 * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) + 58 * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) +
59 * path_length * sizeof (struct GNUNET_PeerIdentity) 59 * path_length * sizeof (struct GNUNET_PeerIdentity)
60 */ 60 */
61 struct GNUNET_MessageHeader header; 61 struct GNUNET_MessageHeader header;
62 62
63 /** 63 /**
64 * ID of the connection 64 * ID of the connection
65 */ 65 */
66 struct GNUNET_CADET_Hash cid; 66 struct GNUNET_CADET_Hash cid;
67 67
68 /** 68 /**
69 * path_length structs defining the *whole* path from the origin [0] to the 69 * path_length structs defining the *whole* path from the origin [0] to the
70 * final destination [path_length-1]. 70 * final destination [path_length-1].
71 */ 71 */
72 /* struct GNUNET_PeerIdentity peers[path_length]; */ 72 /* struct GNUNET_PeerIdentity peers[path_length]; */
73}; 73};
74 74
@@ -160,157 +160,24 @@ struct GNUNET_CADET_AX_KX
160 160
161 161
162/** 162/**
163 * Message transmitted with the signed ephemeral key of a peer. The
164 * session key is then derived from the two ephemeral keys (ECDHE).
165 *
166 * As far as possible, same as CORE's EphemeralKeyMessage.
167 */
168struct GNUNET_CADET_KX_Ephemeral
169{
170
171 /**
172 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL.
173 */
174 struct GNUNET_MessageHeader header;
175
176 /**
177 * Status of the sender (should be in "enum PeerStateMachine"), nbo.
178 */
179 int32_t sender_status GNUNET_PACKED;
180
181 /**
182 * An ECC signature of the 'origin' asserting the validity of
183 * the given ephemeral key.
184 */
185 struct GNUNET_CRYPTO_EddsaSignature signature;
186
187 /**
188 * Information about what is being signed.
189 */
190 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
191
192 /**
193 * At what time was this key created (beginning of validity).
194 */
195 struct GNUNET_TIME_AbsoluteNBO creation_time;
196
197 /**
198 * When does the given ephemeral key expire (end of validity).
199 */
200 struct GNUNET_TIME_AbsoluteNBO expiration_time;
201
202 /**
203 * Ephemeral public ECC key (always for NIST P-521) encoded in a format
204 * suitable for network transmission as created using 'gcry_sexp_sprint'.
205 */
206 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
207
208 /**
209 * Public key of the signing peer
210 * (persistent version, not the ephemeral public key).
211 */
212 struct GNUNET_PeerIdentity origin_identity;
213
214 /**
215 * Seed for the IV of nonce.
216 */
217 uint32_t iv GNUNET_PACKED;
218
219 /**
220 * Nonce to check liveness of peer.
221 */
222 uint32_t nonce GNUNET_PACKED;
223};
224
225
226/**
227 * Response to a PING. Includes data from the original PING.
228 */
229struct GNUNET_CADET_KX_Pong
230{
231 /**
232 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PONG.
233 */
234 struct GNUNET_MessageHeader header;
235
236 /**
237 * Seed for the IV
238 */
239 uint32_t iv GNUNET_PACKED;
240
241 /**
242 * Same nonce as in the reve.
243 */
244 uint32_t nonce GNUNET_PACKED;
245};
246
247
248/**
249 * Tunnel(ed) message.
250 */
251struct GNUNET_CADET_Encrypted
252{
253 /**
254 * Type: GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED
255 */
256 struct GNUNET_MessageHeader header;
257
258 /**
259 * ID of the connection.
260 */
261 struct GNUNET_CADET_Hash cid;
262
263 /**
264 * ID of the packet (hop by hop).
265 */
266 uint32_t pid GNUNET_PACKED;
267
268 /**
269 * Number of hops to live.
270 */
271 uint32_t ttl GNUNET_PACKED;
272
273 /**
274 * Initialization Vector for payload encryption.
275 */
276 uint32_t iv GNUNET_PACKED;
277
278 /**
279 * MAC of the encrypted message, used to verify message integrity.
280 * Everything after this value will be encrypted and authenticated.
281 */
282 struct GNUNET_CADET_Hash hmac;
283
284 /**
285 * Encrypted content follows.
286 */
287};
288
289
290/**
291 * Axolotl tunnel message. 163 * Axolotl tunnel message.
292 */ 164 */
293struct GNUNET_CADET_AX 165struct GNUNET_CADET_AX
294{ 166{
295 /** 167 /**
296 * Type: GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA 168 * Type: #GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA
297 */ 169 */
298 struct GNUNET_MessageHeader header; 170 struct GNUNET_MessageHeader header;
299 171
300 /** 172 /**
301 * ID of the connection.
302 */
303 struct GNUNET_CADET_Hash cid;
304
305 /**
306 * ID of the packet (hop by hop). 173 * ID of the packet (hop by hop).
307 */ 174 */
308 uint32_t pid GNUNET_PACKED; 175 uint32_t pid GNUNET_PACKED;
309 176
310 /** 177 /**
311 * Reserved field for 64b alignment. 178 * ID of the connection.
312 */ 179 */
313 uint32_t reserved GNUNET_PACKED; 180 struct GNUNET_CADET_Hash cid;
314 181
315 /** 182 /**
316 * MAC of the encrypted message, used to verify message integrity. 183 * MAC of the encrypted message, used to verify message integrity.
@@ -324,12 +191,12 @@ struct GNUNET_CADET_AX
324 /** 191 /**
325 * Number of messages sent with the current ratchet key. 192 * Number of messages sent with the current ratchet key.
326 */ 193 */
327 uint32_t Ns; 194 uint32_t Ns GNUNET_PACKED;
328 195
329 /** 196 /**
330 * Number of messages sent with the previous ratchet key. 197 * Number of messages sent with the previous ratchet key.
331 */ 198 */
332 uint32_t PNs; 199 uint32_t PNs GNUNET_PACKED;
333 200
334 /** 201 /**
335 * Current ratchet key. 202 * Current ratchet key.
@@ -350,7 +217,7 @@ struct GNUNET_CADET_AX
350struct GNUNET_CADET_ChannelCreate 217struct GNUNET_CADET_ChannelCreate
351{ 218{
352 /** 219 /**
353 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE 220 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
354 */ 221 */
355 struct GNUNET_MessageHeader header; 222 struct GNUNET_MessageHeader header;
356 223
@@ -377,7 +244,7 @@ struct GNUNET_CADET_ChannelCreate
377struct GNUNET_CADET_ChannelManage 244struct GNUNET_CADET_ChannelManage
378{ 245{
379 /** 246 /**
380 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY} 247 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
381 */ 248 */
382 struct GNUNET_MessageHeader header; 249 struct GNUNET_MessageHeader header;
383 250
@@ -393,25 +260,25 @@ struct GNUNET_CADET_ChannelManage
393 */ 260 */
394struct GNUNET_CADET_Data 261struct GNUNET_CADET_Data
395{ 262{
396 /** 263 /**
397 * Type: GNUNET_MESSAGE_TYPE_CADET_UNICAST, 264 * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
398 * GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN 265 * #GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
399 */ 266 */
400 struct GNUNET_MessageHeader header; 267 struct GNUNET_MessageHeader header;
401 268
402 /** 269 /**
403 * Unique ID of the payload message 270 * Unique ID of the payload message
404 */ 271 */
405 uint32_t mid GNUNET_PACKED; 272 uint32_t mid GNUNET_PACKED;
406 273
407 /** 274 /**
408 * ID of the channel 275 * ID of the channel
409 */ 276 */
410 CADET_ChannelNumber chid GNUNET_PACKED; 277 CADET_ChannelNumber chid GNUNET_PACKED;
411 278
412 /** 279 /**
413 * Payload follows 280 * Payload follows
414 */ 281 */
415}; 282};
416 283
417 284
@@ -449,19 +316,19 @@ struct GNUNET_CADET_DataACK
449 */ 316 */
450struct GNUNET_CADET_ACK 317struct GNUNET_CADET_ACK
451{ 318{
452 /** 319 /**
453 * Type: GNUNET_MESSAGE_TYPE_CADET_ACK 320 * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK
454 */ 321 */
455 struct GNUNET_MessageHeader header; 322 struct GNUNET_MessageHeader header;
456 323
457 /** 324 /**
458 * Maximum packet ID authorized. 325 * Maximum packet ID authorized.
459 */ 326 */
460 uint32_t ack GNUNET_PACKED; 327 uint32_t ack GNUNET_PACKED;
461 328
462 /** 329 /**
463 * ID of the connection. 330 * ID of the connection.
464 */ 331 */
465 struct GNUNET_CADET_Hash cid; 332 struct GNUNET_CADET_Hash cid;
466}; 333};
467 334
@@ -471,19 +338,19 @@ struct GNUNET_CADET_ACK
471 */ 338 */
472struct GNUNET_CADET_Poll 339struct GNUNET_CADET_Poll
473{ 340{
474 /** 341 /**
475 * Type: GNUNET_MESSAGE_TYPE_CADET_POLL 342 * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL
476 */ 343 */
477 struct GNUNET_MessageHeader header; 344 struct GNUNET_MessageHeader header;
478 345
479 /** 346 /**
480 * Last packet sent. 347 * Last packet sent.
481 */ 348 */
482 uint32_t pid GNUNET_PACKED; 349 uint32_t pid GNUNET_PACKED;
483 350
484 /** 351 /**
485 * ID of the connection. 352 * ID of the connection.
486 */ 353 */
487 struct GNUNET_CADET_Hash cid; 354 struct GNUNET_CADET_Hash cid;
488 355
489}; 356};
@@ -494,24 +361,24 @@ struct GNUNET_CADET_Poll
494 */ 361 */
495struct GNUNET_CADET_ConnectionBroken 362struct GNUNET_CADET_ConnectionBroken
496{ 363{
497 /** 364 /**
498 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN 365 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
499 */ 366 */
500 struct GNUNET_MessageHeader header; 367 struct GNUNET_MessageHeader header;
501 368
502 /** 369 /**
503 * ID of the connection. 370 * ID of the connection.
504 */ 371 */
505 struct GNUNET_CADET_Hash cid; 372 struct GNUNET_CADET_Hash cid;
506 373
507 /** 374 /**
508 * ID of the endpoint 375 * ID of the endpoint
509 */ 376 */
510 struct GNUNET_PeerIdentity peer1; 377 struct GNUNET_PeerIdentity peer1;
511 378
512 /** 379 /**
513 * ID of the endpoint 380 * ID of the endpoint
514 */ 381 */
515 struct GNUNET_PeerIdentity peer2; 382 struct GNUNET_PeerIdentity peer2;
516}; 383};
517 384
@@ -521,14 +388,14 @@ struct GNUNET_CADET_ConnectionBroken
521 */ 388 */
522struct GNUNET_CADET_ConnectionDestroy 389struct GNUNET_CADET_ConnectionDestroy
523{ 390{
524 /** 391 /**
525 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY 392 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
526 */ 393 */
527 struct GNUNET_MessageHeader header; 394 struct GNUNET_MessageHeader header;
528 395
529 /** 396 /**
530 * ID of the connection. 397 * ID of the connection.
531 */ 398 */
532 struct GNUNET_CADET_Hash cid; 399 struct GNUNET_CADET_Hash cid;
533}; 400};
534 401