cell_establish_intro.trunnel 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * This contains the definition of the ESTABLISH_INTRO and INTRO_ESTABLISHED
  3. * cell for onion service version 3 and onward. The following format is
  4. * specified in proposal 224 section 3.1.
  5. */
  6. extern struct trn_cell_extension;
  7. const TRUNNEL_SHA3_256_LEN = 32;
  8. /* ESTABLISH_INTRO payload. See details in section 3.1.1 */
  9. struct trn_cell_establish_intro {
  10. /* Indicate the start of the handshake authentication data. */
  11. @ptr start_cell;
  12. /* Authentication key material. */
  13. u8 auth_key_type IN [0x00, 0x01, 0x02];
  14. u16 auth_key_len;
  15. u8 auth_key[auth_key_len];
  16. /* Extension(s). Reserved fields. */
  17. struct trn_cell_extension extensions;
  18. @ptr end_mac_fields;
  19. /* Handshake MAC. */
  20. u8 handshake_mac[TRUNNEL_SHA3_256_LEN];
  21. /* Signature */
  22. /* Indicate the end of the handshake authentication data. */
  23. @ptr end_sig_fields;
  24. u16 sig_len;
  25. u8 sig[sig_len];
  26. };
  27. /* INTRO_ESTABLISHED payload which is an acknowledge of the ESTABLISH_INTRO
  28. * cell. For legacy node, this payload is empty so the following only applies
  29. * to version >= 3. */
  30. struct trn_cell_intro_established {
  31. /* Extension(s). Reserved fields. */
  32. struct trn_cell_extension extensions;
  33. };
  34. /*
  35. * ESTABLISH_INTRO cell extensions.
  36. */
  37. const TRUNNEL_CELL_EXTENSION_TYPE_DOS = 0x01;
  38. /* DoS Parameter types. */
  39. const TRUNNEL_DOS_PARAM_TYPE_INTRO2_RATE_PER_SEC = 0x01;
  40. const TRUNNEL_DOS_PARAM_TYPE_INTRO2_BURST_PER_SEC = 0x02;
  41. /*
  42. * DoS Parameters Extension. See proposal 305 for more details.
  43. */
  44. struct trn_cell_extension_dos_param {
  45. u8 type;
  46. u64 value;
  47. };
  48. struct trn_cell_extension_dos {
  49. u8 n_params;
  50. struct trn_cell_extension_dos_param params[n_params];
  51. };