Tor  0.4.3.0-alpha-dev
hs_client.h
Go to the documentation of this file.
1 /* Copyright (c) 2017-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 /**
5  * \file hs_client.h
6  * \brief Header file containing client data for the HS subsytem.
7  **/
8 
9 #ifndef TOR_HS_CLIENT_H
10 #define TOR_HS_CLIENT_H
11 
14 #include "feature/hs/hs_ident.h"
15 
16 /** Status code of a descriptor fetch request. */
17 typedef enum {
18  /** Something internally went wrong. */
20  /** The fetch request has been launched successfully. */
22  /** We already have a usable descriptor. No fetch. */
24  /** No more HSDir available to query. */
26  /** The fetch request is not allowed. */
28  /** We are missing information to be able to launch a request. */
30  /** There is a pending fetch for the requested service. */
33 
34 /** Client-side configuration of authorization for a service. */
36  /** An curve25519 secret key used to compute decryption keys that
37  * allow the client to decrypt the hidden service descriptor. */
39 
40  /** An onion address that is used to connect to the onion service. */
43 
45  const edge_connection_t *conn);
46 
48  const ed25519_public_key_t *onion_identity_pk,
49  const smartlist_t *hsdirs);
50 
52  const char *desc_str,
53  const ed25519_public_key_t *service_identity_pk,
54  hs_descriptor_t **desc);
56  const hs_descriptor_t *desc);
57 int hs_client_refetch_hsdesc(const ed25519_public_key_t *identity_pk);
59 
61  origin_circuit_t *rend_circ);
62 
64 
66  const uint8_t *payload,
67  size_t payload_len);
69  const uint8_t *payload,
70  size_t payload_len);
72  const uint8_t *payload,
73  size_t payload_len);
74 
76 
78  const edge_connection_t *edge_conn);
79 
81  int validate_only);
82 
85 
86 void hs_client_purge_state(void);
87 
88 void hs_client_free_all(void);
89 
90 #ifdef HS_CLIENT_PRIVATE
91 
92 STATIC int auth_key_filename_is_valid(const char *filename);
93 
95 parse_auth_file_content(const char *client_key_str);
96 
98 pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk);
99 
102 
105 
106 STATIC int handle_rendezvous2(origin_circuit_t *circ, const uint8_t *payload,
107  size_t payload_len);
108 
110  fetch_v3_desc, (const ed25519_public_key_t *onion_identity_pk));
111 
113 
114 #ifdef TOR_UNIT_TESTS
115 
116 STATIC digest256map_t *get_hs_client_auths_map(void);
117 
118 #endif /* defined(TOR_UNIT_TESTS) */
119 
120 #endif /* defined(HS_CLIENT_PRIVATE) */
121 
122 #endif /* !defined(TOR_HS_CLIENT_H) */
int hs_client_any_intro_points_usable(const ed25519_public_key_t *service_pk, const hs_descriptor_t *desc)
Definition: hs_client.c:1325
void hs_client_dir_info_changed(void)
Definition: hs_client.c:1935
int hs_client_reextend_intro_circuit(origin_circuit_t *circ)
Definition: hs_client.c:1830
curve25519_secret_key_t enc_seckey
Definition: hs_client.h:38
int hs_client_send_introduce1(origin_circuit_t *intro_circ, origin_circuit_t *rend_circ)
Definition: hs_client.c:1379
void hs_client_free_all(void)
Definition: hs_client.c:1905
int hs_client_decode_descriptor(const char *desc_str, const ed25519_public_key_t *service_identity_pk, hs_descriptor_t **desc)
Definition: hs_client.c:1269
void hs_client_desc_has_arrived(const hs_ident_dir_conn_t *ident)
Definition: hs_client.c:1693
#define STATIC
Definition: testsupport.h:32
void hs_client_purge_state(void)
Definition: hs_client.c:1915
int hs_client_receive_rendezvous_acked(origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
Definition: hs_client.c:1421
int hs_client_receive_introduce_ack(origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
Definition: hs_client.c:1763
STATIC extend_info_t * desc_intro_point_to_extend_info(const hs_desc_intro_point_t *ip)
Definition: hs_client.c:769
Header file containing circuit and connection identifier data for the whole HS subsytem.
STATIC routerstatus_t * pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk)
Definition: hs_client.c:402
Header for crypto_ed25519.c.
char onion_address[HS_SERVICE_ADDR_LEN_BASE32+1]
Definition: hs_client.h:41
Header file for hs_descriptor.c.
STATIC hs_client_fetch_status_t fetch_v3_desc(const ed25519_public_key_t *onion_identity_pk)
Definition: hs_client.c:439
STATIC void retry_all_socks_conn_waiting_for_desc(void)
Definition: hs_client.c:271
int hs_client_receive_rendezvous2(origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
Definition: hs_client.c:1792
#define HS_SERVICE_ADDR_LEN_BASE32
Definition: hs_common.h:83
void hs_client_close_intro_circuits_from_desc(const hs_descriptor_t *desc)
Definition: hs_client.c:1879
int hs_client_refetch_hsdesc(const ed25519_public_key_t *identity_pk)
Definition: hs_client.c:1348
void hs_client_circuit_has_opened(origin_circuit_t *circ)
Definition: hs_client.c:1391
STATIC int handle_rendezvous2(origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
Definition: hs_client.c:1100
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127
extend_info_t * hs_client_get_random_intro_from_edge(const edge_connection_t *edge_conn)
Definition: hs_client.c:1750
STATIC int auth_key_filename_is_valid(const char *filename)
Definition: hs_client.c:1491
void hs_client_launch_v3_desc_fetch(const ed25519_public_key_t *onion_identity_pk, const smartlist_t *hsdirs)
Definition: hs_client.c:458
STATIC extend_info_t * client_get_random_intro(const ed25519_public_key_t *service_pk)
Definition: hs_client.c:831
int hs_config_client_authorization(const or_options_t *options, int validate_only)
Definition: hs_client.c:1578
hs_client_fetch_status_t
Definition: hs_client.h:17
void hs_client_note_connection_attempt_succeeded(const edge_connection_t *conn)
Definition: hs_client.c:1245