hs_intropoint.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Copyright (c) 2016-2017, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file hs_intropoint.h
  5. * \brief Header file for hs_intropoint.c.
  6. **/
  7. #ifndef TOR_HS_INTRO_H
  8. #define TOR_HS_INTRO_H
  9. /* Authentication key type in an ESTABLISH_INTRO cell. */
  10. enum hs_intro_auth_key_type {
  11. HS_INTRO_AUTH_KEY_TYPE_LEGACY0 = 0x00,
  12. HS_INTRO_AUTH_KEY_TYPE_LEGACY1 = 0x01,
  13. HS_INTRO_AUTH_KEY_TYPE_ED25519 = 0x02,
  14. };
  15. /* INTRODUCE_ACK status code. */
  16. typedef enum {
  17. HS_INTRO_ACK_STATUS_SUCCESS = 0x0000,
  18. HS_INTRO_ACK_STATUS_UNKNOWN_ID = 0x0001,
  19. HS_INTRO_ACK_STATUS_BAD_FORMAT = 0x0002,
  20. HS_INTRO_ACK_STATUS_CANT_RELAY = 0x0003,
  21. } hs_intro_ack_status_t;
  22. int hs_intro_received_establish_intro(or_circuit_t *circ,
  23. const uint8_t *request,
  24. size_t request_len);
  25. int hs_intro_received_introduce1(or_circuit_t *circ, const uint8_t *request,
  26. size_t request_len);
  27. MOCK_DECL(int, hs_intro_send_intro_established_cell,(or_circuit_t *circ));
  28. /* also used by rendservice.c */
  29. int hs_intro_circuit_is_suitable_for_establish_intro(const or_circuit_t *circ);
  30. #ifdef HS_INTROPOINT_PRIVATE
  31. #include "hs/cell_establish_intro.h"
  32. #include "hs/cell_introduce1.h"
  33. STATIC int
  34. verify_establish_intro_cell(const trn_cell_establish_intro_t *out,
  35. const uint8_t *circuit_key_material,
  36. size_t circuit_key_material_len);
  37. STATIC void
  38. get_auth_key_from_cell(ed25519_public_key_t *auth_key_out,
  39. unsigned int cell_type, const void *cell);
  40. STATIC int introduce1_cell_is_legacy(const uint8_t *request);
  41. STATIC int handle_introduce1(or_circuit_t *client_circ,
  42. const uint8_t *request, size_t request_len);
  43. STATIC int validate_introduce1_parsed_cell(const trn_cell_introduce1_t *cell);
  44. STATIC int circuit_is_suitable_for_introduce1(const or_circuit_t *circ);
  45. #endif /* HS_INTROPOINT_PRIVATE */
  46. #endif /* TOR_HS_INTRO_H */