Tor  0.4.5.0-alpha-dev
hs_circuitmap.h
Go to the documentation of this file.
1 /* Copyright (c) 2016-2020, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 /**
5  * \file hs_circuitmap.h
6  * \brief Header file for hs_circuitmap.c.
7  **/
8 
9 #ifndef TOR_HS_CIRCUITMAP_H
10 #define TOR_HS_CIRCUITMAP_H
11 
12 typedef HT_HEAD(hs_circuitmap_ht, circuit_t) hs_circuitmap_ht;
13 
14 typedef struct hs_token_t hs_token_t;
15 struct or_circuit_t;
16 struct origin_circuit_t;
18 
19 /** Public HS circuitmap API: */
20 
21 /** Public relay-side API: */
22 
23 struct or_circuit_t *
25  struct ed25519_public_key_t *auth_key);
26 struct or_circuit_t *
27 hs_circuitmap_get_intro_circ_v2_relay_side(const uint8_t *digest);
28 struct or_circuit_t *
29 hs_circuitmap_get_rend_circ_relay_side(const uint8_t *cookie);
30 
32  const uint8_t *cookie);
34  const uint8_t *digest);
36  const struct ed25519_public_key_t *auth_key);
37 
39 
40 /** Public service-side API: */
41 
42 struct origin_circuit_t *
44  struct ed25519_public_key_t *auth_key);
45 struct origin_circuit_t *
47 struct origin_circuit_t *
48 hs_circuitmap_get_rend_circ_service_side(const uint8_t *cookie);
49 struct origin_circuit_t *
50 hs_circuitmap_get_rend_circ_client_side(const uint8_t *cookie);
51 struct origin_circuit_t *
53 
55  struct origin_circuit_t *circ,
56  const uint8_t *digest);
58  struct origin_circuit_t *circ,
59  const struct ed25519_public_key_t *auth_key);
61  struct origin_circuit_t *circ,
62  const uint8_t *cookie);
64  struct origin_circuit_t *circ,
65  const uint8_t *cookie);
66 
67 void hs_circuitmap_remove_circuit(struct circuit_t *circ);
68 
69 void hs_circuitmap_init(void);
70 void hs_circuitmap_free_all(void);
71 
72 #ifdef HS_CIRCUITMAP_PRIVATE
73 
74 /** Represents the type of HS token. */
75 typedef enum {
76  /** A rendezvous cookie on a relay (128bit)*/
77  HS_TOKEN_REND_RELAY_SIDE,
78  /** A v2 introduction point pubkey on a relay (160bit) */
79  HS_TOKEN_INTRO_V2_RELAY_SIDE,
80  /** A v3 introduction point pubkey on a relay (256bit) */
81  HS_TOKEN_INTRO_V3_RELAY_SIDE,
82 
83  /** A rendezvous cookie on a hidden service (128bit)*/
84  HS_TOKEN_REND_SERVICE_SIDE,
85  /** A v2 introduction point pubkey on a hidden service (160bit) */
86  HS_TOKEN_INTRO_V2_SERVICE_SIDE,
87  /** A v3 introduction point pubkey on a hidden service (256bit) */
88  HS_TOKEN_INTRO_V3_SERVICE_SIDE,
89 
90  /** A rendezvous cookie on the client side (128bit) */
91  HS_TOKEN_REND_CLIENT_SIDE,
92 } hs_token_type_t;
93 
94 /** Represents a token used in the HS protocol. Each such token maps to a
95  * specific introduction or rendezvous circuit. */
96 struct hs_token_t {
97  /* Type of HS token. */
98  hs_token_type_t type;
99 
100  /* The size of the token (depends on the type). */
101  size_t token_len;
102 
103  /* The token itself. Memory allocated at runtime. */
104  uint8_t *token;
105 };
106 
107 #endif /* defined(HS_CIRCUITMAP_PRIVATE) */
108 
109 #ifdef TOR_UNIT_TESTS
110 
111 hs_circuitmap_ht *get_hs_circuitmap(void);
112 
113 #endif /* TOR_UNIT_TESTS */
114 
115 #endif /* !defined(TOR_HS_CIRCUITMAP_H) */
hs_circuitmap_get_rend_circ_client_side
struct origin_circuit_t * hs_circuitmap_get_rend_circ_client_side(const uint8_t *cookie)
Definition: hs_circuitmap.c:461
hs_circuitmap_get_intro_circ_v2_relay_side
struct or_circuit_t * hs_circuitmap_get_intro_circ_v2_relay_side(const uint8_t *digest)
Definition: hs_circuitmap.c:318
hs_circuitmap_register_intro_circ_v2_service_side
void hs_circuitmap_register_intro_circ_v2_service_side(struct origin_circuit_t *circ, const uint8_t *digest)
Definition: hs_circuitmap.c:521
hs_circuitmap_register_intro_circ_v2_relay_side
void hs_circuitmap_register_intro_circ_v2_relay_side(struct or_circuit_t *circ, const uint8_t *digest)
Definition: hs_circuitmap.c:350
hs_circuitmap_get_intro_circ_v2_service_side
struct origin_circuit_t * hs_circuitmap_get_intro_circ_v2_service_side(const uint8_t *digest)
Definition: hs_circuitmap.c:400
hs_circuitmap_get_established_rend_circ_client_side
struct origin_circuit_t * hs_circuitmap_get_established_rend_circ_client_side(const uint8_t *cookie)
Definition: hs_circuitmap.c:492
hs_circuitmap_get_rend_circ_service_side
struct origin_circuit_t * hs_circuitmap_get_rend_circ_service_side(const uint8_t *cookie)
Definition: hs_circuitmap.c:424
hs_circuitmap_register_rend_circ_service_side
void hs_circuitmap_register_rend_circ_service_side(struct origin_circuit_t *circ, const uint8_t *cookie)
Definition: hs_circuitmap.c:543
hs_circuitmap_register_intro_circ_v3_relay_side
void hs_circuitmap_register_intro_circ_v3_relay_side(or_circuit_t *circ, const ed25519_public_key_t *auth_key)
Definition: hs_circuitmap.c:361
origin_circuit_t
Definition: origin_circuit_st.h:79
ed25519_public_key_t
Definition: crypto_ed25519.h:23
circuit_t
Definition: circuit_st.h:61
hs_circuitmap_register_rend_circ_client_side
void hs_circuitmap_register_rend_circ_client_side(struct origin_circuit_t *circ, const uint8_t *cookie)
Definition: hs_circuitmap.c:554
HT_HEAD
typedef HT_HEAD(hs_service_ht, hs_service_t) hs_service_ht
hs_circuitmap_register_rend_circ_relay_side
void hs_circuitmap_register_rend_circ_relay_side(struct or_circuit_t *circ, const uint8_t *cookie)
Definition: hs_circuitmap.c:340
hs_circuitmap_get_intro_circ_v3_relay_side
struct or_circuit_t * hs_circuitmap_get_intro_circ_v3_relay_side(const struct ed25519_public_key_t *auth_key)
hs_circuitmap_get_rend_circ_relay_side
struct or_circuit_t * hs_circuitmap_get_rend_circ_relay_side(const uint8_t *cookie)
Definition: hs_circuitmap.c:328
hs_circuitmap_remove_circuit
void hs_circuitmap_remove_circuit(struct circuit_t *circ)
Definition: hs_circuitmap.c:571
hs_circuitmap_init
void hs_circuitmap_init(void)
Definition: hs_circuitmap.c:597
or_circuit_t
Definition: or_circuit_st.h:21
hs_circuitmap_get_intro_circ_v3_service_side
struct origin_circuit_t * hs_circuitmap_get_intro_circ_v3_service_side(const struct ed25519_public_key_t *auth_key)
hs_circuitmap_free_all
void hs_circuitmap_free_all(void)
Definition: hs_circuitmap.c:607
hs_circuitmap_get_all_intro_circ_relay_side
smartlist_t * hs_circuitmap_get_all_intro_circ_relay_side(void)
Definition: hs_circuitmap.c:280
smartlist_t
Definition: smartlist_core.h:26
hs_circuitmap_register_intro_circ_v3_service_side
void hs_circuitmap_register_intro_circ_v3_service_side(origin_circuit_t *circ, const ed25519_public_key_t *auth_key)
Definition: hs_circuitmap.c:532