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