cell_introduce1.trunnel 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * This contains the definition of the INTRODUCE1 and INTRODUCE_ACK cell for
  3. * onion service version 3 and onward. The following format is specified in
  4. * proposal 224 section 3.2.
  5. */
  6. /* From cell_common.trunnel. */
  7. extern struct trn_cell_extension;
  8. /* From ed25519_cert.trunnel. */
  9. extern struct link_specifier;
  10. const TRUNNEL_SHA1_LEN = 20;
  11. const TRUNNEL_REND_COOKIE_LEN = 20;
  12. /* Introduce ACK status code. */
  13. const TRUNNEL_HS_INTRO_ACK_STATUS_SUCCESS = 0x0000;
  14. const TRUNNEL_HS_INTRO_ACK_STATUS_UNKNOWN_ID = 0x0001;
  15. const TRUNNEL_HS_INTRO_ACK_STATUS_BAD_FORMAT = 0x0002;
  16. /* Authentication key type. */
  17. const TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY0 = 0x00;
  18. const TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY1 = 0x01;
  19. const TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_ED25519 = 0x02;
  20. /* Onion key type. */
  21. const TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR = 0x01;
  22. /* INTRODUCE1 payload. See details in section 3.2.1. */
  23. struct trn_cell_introduce1 {
  24. /* Always zeroed. MUST be checked explicitly by the caller. */
  25. u8 legacy_key_id[TRUNNEL_SHA1_LEN];
  26. /* Authentication key material. */
  27. u8 auth_key_type IN [TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY0,
  28. TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY1,
  29. TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_ED25519];
  30. u16 auth_key_len;
  31. u8 auth_key[auth_key_len];
  32. /* Extension(s). Reserved fields. */
  33. struct trn_cell_extension extensions;
  34. /* Variable length, up to the end of cell. */
  35. u8 encrypted[];
  36. };
  37. /* INTRODUCE_ACK payload. See details in section 3.2.2. */
  38. struct trn_cell_introduce_ack {
  39. /* Status of introduction. */
  40. u16 status;
  41. /* Extension(s). Reserved fields. */
  42. struct trn_cell_extension extensions;
  43. };
  44. /* Encrypted section of the INTRODUCE1/INTRODUCE2 cell. */
  45. struct trn_cell_introduce_encrypted {
  46. /* Rendezvous cookie. */
  47. u8 rend_cookie[TRUNNEL_REND_COOKIE_LEN];
  48. /* Extension(s). Reserved fields. */
  49. struct trn_cell_extension extensions;
  50. /* Onion key material. */
  51. u8 onion_key_type IN [TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR];
  52. u16 onion_key_len;
  53. u8 onion_key[onion_key_len];
  54. /* Link specifiers(s) */
  55. u8 nspec;
  56. struct link_specifier nspecs[nspec];
  57. /* Optional padding. This might be empty or not. */
  58. u8 pad[];
  59. };