hs_intropoint.h (2322B)
1 /* Copyright (c) 2016-2021, The Tor Project, Inc. */ 2 /* See LICENSE for licensing information */ 3 4 /** 5 * \file hs_intropoint.h 6 * \brief Header file for hs_intropoint.c. 7 **/ 8 9 #ifndef TOR_HS_INTRO_H 10 #define TOR_HS_INTRO_H 11 12 #include "lib/crypt_ops/crypto_curve25519.h" 13 #include "feature/nodelist/torcert.h" 14 15 /** Object containing introduction point common data between the service and 16 * the client side. */ 17 typedef struct hs_intropoint_t { 18 /** Does this intro point only supports legacy ID ?. */ 19 unsigned int is_only_legacy : 1; 20 21 /** Authentication key certificate from the descriptor. */ 22 tor_cert_t *auth_key_cert; 23 /** A list of link specifier. */ 24 smartlist_t *link_specifiers; 25 } hs_intropoint_t; 26 27 int hs_intro_received_establish_intro(or_circuit_t *circ, 28 const uint8_t *request, 29 size_t request_len); 30 int hs_intro_received_introduce1(or_circuit_t *circ, const uint8_t *request, 31 size_t request_len); 32 33 MOCK_DECL(int, hs_intro_send_intro_established_cell,(or_circuit_t *circ)); 34 35 /* also used by rendservice.c */ 36 int hs_intro_circuit_is_suitable_for_establish_intro(const or_circuit_t *circ); 37 38 hs_intropoint_t *hs_intro_new(void); 39 void hs_intropoint_clear(hs_intropoint_t *ip); 40 41 #ifdef HS_INTROPOINT_PRIVATE 42 43 #include "trunnel/hs/cell_establish_intro.h" 44 #include "trunnel/hs/cell_introduce1.h" 45 46 STATIC int 47 verify_establish_intro_cell(const trn_cell_establish_intro_t *out, 48 const uint8_t *circuit_key_material, 49 size_t circuit_key_material_len); 50 51 STATIC void 52 get_auth_key_from_cell(ed25519_public_key_t *auth_key_out, 53 unsigned int cell_type, const void *cell); 54 55 STATIC int handle_introduce1(or_circuit_t *client_circ, 56 const uint8_t *request, size_t request_len); 57 STATIC int validate_introduce1_parsed_cell(const trn_cell_introduce1_t *cell); 58 STATIC int circuit_is_suitable_for_introduce1(const or_circuit_t *circ); 59 STATIC bool cell_dos_extension_parameters_are_valid( 60 uint64_t intro2_rate_per_sec, 61 uint64_t intro2_burst_per_sec); 62 63 #endif /* defined(HS_INTROPOINT_PRIVATE) */ 64 65 #endif /* !defined(TOR_HS_INTRO_H) */