tor  0.4.1.0-alpha-dev
Macros | Functions | Variables
hs_client.c File Reference
#include "core/or/or.h"
#include "app/config/config.h"
#include "core/crypto/hs_ntor.h"
#include "core/mainloop/connection.h"
#include "core/or/circuitbuild.h"
#include "core/or/circuitlist.h"
#include "core/or/circuituse.h"
#include "core/or/connection_edge.h"
#include "core/or/reasons.h"
#include "feature/client/circpathbias.h"
#include "feature/dirclient/dirclient.h"
#include "feature/dircommon/directory.h"
#include "feature/hs/hs_cache.h"
#include "feature/hs/hs_cell.h"
#include "feature/hs/hs_circuit.h"
#include "feature/hs/hs_circuitmap.h"
#include "feature/hs/hs_client.h"
#include "feature/hs/hs_control.h"
#include "feature/hs/hs_descriptor.h"
#include "feature/hs/hs_ident.h"
#include "feature/nodelist/describe.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerset.h"
#include "feature/rend/rendclient.h"
#include "lib/crypt_ops/crypto_format.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "core/or/cpath_build_state_st.h"
#include "feature/dircommon/dir_connection_st.h"
#include "core/or/entry_connection_st.h"
#include "core/or/extend_info_st.h"
#include "core/or/origin_circuit_st.h"

Go to the source code of this file.

Macros

#define HS_CLIENT_PRIVATE
 
#define client_service_authorization_free(auth)
 

Functions

static const char * fetch_status_to_string (hs_client_fetch_status_t status)
 
static int fetch_status_should_close_socks (hs_client_fetch_status_t status)
 
static void cancel_descriptor_fetches (void)
 
static void flag_all_conn_wait_desc (const ed25519_public_key_t *service_identity_pk)
 
static void purge_hid_serv_request (const ed25519_public_key_t *identity_pk)
 
static int directory_request_is_pending (const ed25519_public_key_t *identity_pk)
 
static void mark_conn_as_waiting_for_circuit (connection_t *conn, time_t now)
 
static void close_all_socks_conns_waiting_for_desc (const ed25519_public_key_t *identity_pk, hs_client_fetch_status_t status, int reason)
 
STATIC void retry_all_socks_conn_waiting_for_desc (void)
 
static void note_connection_attempt_succeeded (const hs_ident_edge_conn_t *hs_conn_ident)
 
static hs_client_fetch_status_t directory_launch_v3_desc_fetch (const ed25519_public_key_t *onion_identity_pk, const routerstatus_t *hsdir)
 
STATIC routerstatus_tpick_hsdir_v3 (const ed25519_public_key_t *onion_identity_pk)
 
 MOCK_IMPL (STATIC hs_client_fetch_status_t, fetch_v3_desc,(const ed25519_public_key_t *onion_identity_pk))
 
void hs_client_launch_v3_desc_fetch (const ed25519_public_key_t *onion_identity_pk, const smartlist_t *hsdirs)
 
static int intro_circ_is_ok (const origin_circuit_t *circ)
 
static const hs_desc_intro_point_tfind_desc_intro_point_by_ident (const hs_ident_circuit_t *ident, const hs_descriptor_t *desc)
 
static hs_desc_intro_point_tfind_desc_intro_point_by_legacy_id (const char *legacy_id, const hs_descriptor_t *desc)
 
static int send_introduce1 (origin_circuit_t *intro_circ, origin_circuit_t *rend_circ)
 
static void setup_intro_circ_auth_key (origin_circuit_t *circ)
 
static void client_intro_circ_has_opened (origin_circuit_t *circ)
 
static void client_rendezvous_circ_has_opened (origin_circuit_t *circ)
 
STATIC extend_info_tdesc_intro_point_to_extend_info (const hs_desc_intro_point_t *ip)
 
static int intro_point_is_usable (const ed25519_public_key_t *service_pk, const hs_desc_intro_point_t *ip)
 
STATIC extend_info_tclient_get_random_intro (const ed25519_public_key_t *service_pk)
 
static int close_or_reextend_intro_circ (origin_circuit_t *intro_circ)
 
static void handle_introduce_ack_success (origin_circuit_t *intro_circ)
 
static void handle_introduce_ack_bad (origin_circuit_t *circ, int status)
 
static int handle_introduce_ack (origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
 
STATIC int handle_rendezvous2 (origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
 
static unsigned int can_client_refetch_desc (const ed25519_public_key_t *identity_pk, hs_client_fetch_status_t *status_out)
 
static hs_client_service_authorization_tfind_client_auth (const ed25519_public_key_t *service_identity_pk)
 
void hs_client_note_connection_attempt_succeeded (const edge_connection_t *conn)
 
int hs_client_decode_descriptor (const char *desc_str, const ed25519_public_key_t *service_identity_pk, hs_descriptor_t **desc)
 
int hs_client_any_intro_points_usable (const ed25519_public_key_t *service_pk, const hs_descriptor_t *desc)
 
int hs_client_refetch_hsdesc (const ed25519_public_key_t *identity_pk)
 
int hs_client_send_introduce1 (origin_circuit_t *intro_circ, origin_circuit_t *rend_circ)
 
void hs_client_circuit_has_opened (origin_circuit_t *circ)
 
int hs_client_receive_rendezvous_acked (origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
 
static void client_service_authorization_free_ (hs_client_service_authorization_t *auth)
 
static void client_service_authorization_free_void (void *auth)
 
static void client_service_authorization_free_all (void)
 
STATIC int auth_key_filename_is_valid (const char *filename)
 
STATIC hs_client_service_authorization_tparse_auth_file_content (const char *client_key_str)
 
int hs_config_client_authorization (const or_options_t *options, int validate_only)
 
void hs_client_desc_has_arrived (const hs_ident_dir_conn_t *ident)
 
extend_info_ths_client_get_random_intro_from_edge (const edge_connection_t *edge_conn)
 
int hs_client_receive_introduce_ack (origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
 
int hs_client_receive_rendezvous2 (origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
 
int hs_client_reextend_intro_circuit (origin_circuit_t *circ)
 
void hs_client_close_intro_circuits_from_desc (const hs_descriptor_t *desc)
 
void hs_client_free_all (void)
 
void hs_client_purge_state (void)
 
void hs_client_dir_info_changed (void)
 

Variables

static digest256map_t * client_auths = NULL
 

Detailed Description

Implement next generation hidden service client functionality.

Definition in file hs_client.c.

Macro Definition Documentation

◆ client_service_authorization_free

#define client_service_authorization_free (   auth)
Value:
client_service_authorization_free_, (auth))

Definition at line 1465 of file hs_client.c.

Function Documentation

◆ client_service_authorization_free_void()

static void client_service_authorization_free_void ( void *  auth)
static

Helper for digest256map_free.

Definition at line 1480 of file hs_client.c.

◆ hs_client_note_connection_attempt_succeeded()

void hs_client_note_connection_attempt_succeeded ( const edge_connection_t conn)

A circuit just finished connecting to a hidden service that the stream conn has been waiting for. Let the HS subsystem know about this.

Definition at line 1251 of file hs_client.c.

References connection_edge_is_rendezvous_stream(), and tor_assert().

◆ hs_client_refetch_hsdesc()

int hs_client_refetch_hsdesc ( const ed25519_public_key_t identity_pk)

Launch a connection to a hidden service directory to fetch a hidden service descriptor using identity_pk to get the necessary keys.

A hs_client_fetch_status_t code is returned.

Definition at line 1354 of file hs_client.c.

◆ MOCK_IMPL()

MOCK_IMPL ( STATIC  hs_client_fetch_status_t,
fetch_v3_desc  ,
(const ed25519_public_key_t *onion_identity_pk)   
)

Fetch a v3 descriptor using the given onion_identity_pk.

On success, HS_CLIENT_FETCH_LAUNCHED is returned. Otherwise, an error from hs_client_fetch_status_t is returned.

Definition at line 446 of file hs_client.c.

◆ pick_hsdir_v3()

STATIC routerstatus_t* pick_hsdir_v3 ( const ed25519_public_key_t onion_identity_pk)

Return the HSDir we should use to fetch the descriptor of the hidden service with identity key onion_identity_pk.

Definition at line 406 of file hs_client.c.