crypt_path_st.h 2.1 KB

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