Tor 0.4.9.2-alpha-dev
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
crypt_path_st.h
Go to the documentation of this file.
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-2021, The Tor Project, Inc. */
5/* See LICENSE for licensing information */
6
7/**
8 * @file crypt_path_st.h
9 * @brief Path structures for origin circuits.
10 **/
11
12#ifndef CRYPT_PATH_ST_H
13#define CRYPT_PATH_ST_H
14
17
18#define CRYPT_PATH_MAGIC 0x70127012u
19
23 /** One of `ONION_HANDSHAKE_TYPE_*`. Determines which member of the union
24 * is accessible. */
25 uint16_t tag;
26 /** Initial circuit parameters (selected during first stage of negotiation;
27 * may be changed based on response from relay). */
29 union {
30 struct fast_handshake_state_t *fast;
31 struct ntor_handshake_state_t *ntor;
32 struct ntor3_handshake_state_t *ntor3;
33 } u;
34};
35
37
38/** Macro to encapsulate private members of a struct.
39 *
40 * Renames 'x' to 'x_crypt_path_private_field'.
41 */
42#define CRYPT_PATH_PRIV_FIELD(x) x ## _crypt_path_private_field
43
44#ifdef CRYPT_PATH_PRIVATE
45
46/* Helper macro to access private members of a struct. */
47#define pvt_crypto CRYPT_PATH_PRIV_FIELD(crypto)
48
49#endif /* defined(CRYPT_PATH_PRIVATE) */
50
51/** Holds accounting information for a single step in the layered encryption
52 * performed by a circuit. Used only at the client edge of a circuit. */
54 uint32_t magic;
55
56 /** Current state of the handshake as performed with the OR at this
57 * step. */
59
60 /** Negotiated key material shared with the OR at this step. */
61 char rend_circ_nonce[DIGEST_LEN];/* KH in tor-spec.txt */
62
63 /** Information to extend to the OR at this step. */
65
66 /** Is the circuit built to this step? Must be one of:
67 * - CPATH_STATE_CLOSED (The circuit has not been extended to this step)
68 * - CPATH_STATE_AWAITING_KEYS (We have sent an EXTEND/CREATE to this step
69 * and not received an EXTENDED/CREATED)
70 * - CPATH_STATE_OPEN (The circuit has been extended to this step) */
71 uint8_t state;
72#define CPATH_STATE_CLOSED 0
73#define CPATH_STATE_AWAITING_KEYS 1
74#define CPATH_STATE_OPEN 2
75 struct crypt_path_t *next; /**< Link to next crypt_path_t in the circuit.
76 * (The list is circular, so the last node
77 * links to the first.) */
78 struct crypt_path_t *prev; /**< Link to previous crypt_path_t in the
79 * circuit. */
80
81 int package_window; /**< How many cells are we allowed to originate ending
82 * at this step? */
83 int deliver_window; /**< How many cells are we willing to deliver originating
84 * at this step? */
85
86 /** Congestion control info */
88
89 /** Format to use when exchanging relay cells with this relay. */
91
92 /*********************** Private members ****************************/
93
94 /** Private member: Cryptographic state used for encrypting and
95 * authenticating relay cells to and from this hop. */
97};
98
99#endif /* !defined(CRYPT_PATH_ST_H) */
#define DIGEST_LEN
Definition: digest_sizes.h:20
Header file for onion_crypto.c.
struct ntor_handshake_state_t ntor_handshake_state_t
Definition: onion_ntor.h:20
struct ntor3_handshake_state_t ntor3_handshake_state_t
Definition: onion_ntor_v3.h:25
relay_cell_fmt_t
Definition: or.h:534
Relay-cell encryption state structure.
struct crypt_path_t * prev
Definition: crypt_path_st.h:78
uint8_t state
Definition: crypt_path_st.h:71
relay_crypto_t CRYPT_PATH_PRIV_FIELD(crypto)
struct crypt_path_t * next
Definition: crypt_path_st.h:75
relay_cell_fmt_t relay_cell_format
Definition: crypt_path_st.h:90
extend_info_t * extend_info
Definition: crypt_path_st.h:64
char rend_circ_nonce[DIGEST_LEN]
Definition: crypt_path_st.h:61
onion_handshake_state_t handshake_state
Definition: crypt_path_st.h:58
struct congestion_control_t * ccontrol
Definition: crypt_path_st.h:87
circuit_params_t chosen_params
Definition: crypt_path_st.h:28