crypt_path_st.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Copyright (c) 2001 Matej Pfajfar.
  2. * Copyright (c) 2001-2004, Roger Dingledine.
  3. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  4. * Copyright (c) 2007-2019, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef CRYPT_PATH_ST_H
  7. #define CRYPT_PATH_ST_H
  8. #include "core/or/relay_crypto_st.h"
  9. struct crypto_dh_t;
  10. #define CRYPT_PATH_MAGIC 0x70127012u
  11. struct fast_handshake_state_t;
  12. struct ntor_handshake_state_t;
  13. struct crypto_dh_t;
  14. struct onion_handshake_state_t {
  15. uint16_t tag;
  16. union {
  17. struct fast_handshake_state_t *fast;
  18. struct crypto_dh_t *tap;
  19. struct ntor_handshake_state_t *ntor;
  20. } u;
  21. };
  22. /** Holds accounting information for a single step in the layered encryption
  23. * performed by a circuit. Used only at the client edge of a circuit. */
  24. struct crypt_path_t {
  25. uint32_t magic;
  26. /** Cryptographic state used for encrypting and authenticating relay
  27. * cells to and from this hop. */
  28. relay_crypto_t crypto;
  29. /** Current state of the handshake as performed with the OR at this
  30. * step. */
  31. onion_handshake_state_t handshake_state;
  32. /** Diffie-hellman handshake state for performing an introduction
  33. * operations */
  34. struct crypto_dh_t *rend_dh_handshake_state;
  35. /** Negotiated key material shared with the OR at this step. */
  36. char rend_circ_nonce[DIGEST_LEN];/* KH in tor-spec.txt */
  37. /** Information to extend to the OR at this step. */
  38. extend_info_t *extend_info;
  39. /** Is the circuit built to this step? Must be one of:
  40. * - CPATH_STATE_CLOSED (The circuit has not been extended to this step)
  41. * - CPATH_STATE_AWAITING_KEYS (We have sent an EXTEND/CREATE to this step
  42. * and not received an EXTENDED/CREATED)
  43. * - CPATH_STATE_OPEN (The circuit has been extended to this step) */
  44. uint8_t state;
  45. #define CPATH_STATE_CLOSED 0
  46. #define CPATH_STATE_AWAITING_KEYS 1
  47. #define CPATH_STATE_OPEN 2
  48. struct crypt_path_t *next; /**< Link to next crypt_path_t in the circuit.
  49. * (The list is circular, so the last node
  50. * links to the first.) */
  51. struct crypt_path_t *prev; /**< Link to previous crypt_path_t in the
  52. * circuit. */
  53. int package_window; /**< How many cells are we allowed to originate ending
  54. * at this step? */
  55. int deliver_window; /**< How many cells are we willing to deliver originating
  56. * at this step? */
  57. };
  58. #endif