tor
master
|
Header file for rendcommon.c. More...
Go to the source code of this file.
Macros | |
#define | rend_service_descriptor_free(desc) |
#define | rend_encoded_v2_service_descriptor_free(desc) |
#define | rend_intro_point_free(intro) FREE_AND_NULL(rend_intro_point_t, rend_intro_point_free_, (intro)) |
Typedefs | |
typedef enum rend_intro_point_failure_t | rend_intro_point_failure_t |
Enumerations | |
enum | rend_intro_point_failure_t { INTRO_POINT_FAILURE_GENERIC = 0, INTRO_POINT_FAILURE_TIMEOUT = 1, INTRO_POINT_FAILURE_UNREACHABLE = 2 } |
Functions | |
int | rend_cmp_service_ids (const char *one, const char *two) |
void | rend_process_relay_cell (circuit_t *circ, const crypt_path_t *layer_hint, int command, size_t length, const uint8_t *payload) |
void | rend_service_descriptor_free_ (rend_service_descriptor_t *desc) |
int | rend_get_service_id (crypto_pk_t *pk, char *out) |
void | rend_encoded_v2_service_descriptor_free_ (rend_encoded_v2_service_descriptor_t *desc) |
void | rend_intro_point_free_ (rend_intro_point_t *intro) |
int | rend_valid_v2_service_id (const char *query) |
int | rend_valid_descriptor_id (const char *query) |
int | rend_valid_client_name (const char *client_name) |
int | rend_encode_v2_descriptors (smartlist_t *descs_out, rend_service_descriptor_t *desc, time_t now, uint8_t period, rend_auth_type_t auth_type, crypto_pk_t *client_key, smartlist_t *client_cookies) |
int | rend_compute_v2_desc_id (char *desc_id_out, const char *service_id, const char *descriptor_cookie, time_t now, uint8_t replica) |
void | rend_get_descriptor_id_bytes (char *descriptor_id_out, const char *service_id, const char *secret_id_part) |
int | hid_serv_get_responsible_directories (smartlist_t *responsible_dirs, const char *id) |
int | rend_circuit_pk_digest_eq (const origin_circuit_t *ocirc, const uint8_t *digest) |
char * | rend_auth_encode_cookie (const uint8_t *cookie_in, rend_auth_type_t auth_type) |
int | rend_auth_decode_cookie (const char *cookie_in, uint8_t *cookie_out, rend_auth_type_t *auth_type_out, char **err_msg_out) |
int | rend_allow_non_anonymous_connection (const or_options_t *options) |
int | rend_non_anonymous_mode_enabled (const or_options_t *options) |
void | assert_circ_anonymity_ok (const origin_circuit_t *circ, const or_options_t *options) |
Header file for rendcommon.c.
#define rend_encoded_v2_service_descriptor_free | ( | desc | ) |
#define rend_service_descriptor_free | ( | desc | ) |
int hid_serv_get_responsible_directories | ( | smartlist_t * | responsible_dirs, |
const char * | id | ||
) |
Determine the routers that are responsible for id (binary) and add pointers to those routers' routerstatus_t to responsible_dirs. Return -1 if we're returning an empty smartlist, else return 0.
int rend_auth_decode_cookie | ( | const char * | cookie_in, |
uint8_t * | cookie_out, | ||
rend_auth_type_t * | auth_type_out, | ||
char ** | err_msg_out | ||
) |
Decode a base64-encoded client authorization descriptor cookie. The descriptor_cookie can be truncated to REND_DESC_COOKIE_LEN_BASE64 characters (as given to clients), or may include the two padding characters (as stored by the service).
The result is stored in REND_DESC_COOKIE_LEN bytes of cookie_out. The rend_auth_type_t decoded from the cookie is stored in the optional auth_type_out parameter.
Return 0 on success, or -1 on error. The caller is responsible for freeing the returned err_msg.
char* rend_auth_encode_cookie | ( | const uint8_t * | cookie_in, |
rend_auth_type_t | auth_type | ||
) |
Encode a client authorization descriptor cookie. The result of this function is suitable for use in the HidServAuth option. The trailing padding characters are removed, and the auth type is encoded into the cookie.
Returns a new base64-encoded cookie. This function cannot fail. The caller is responsible for freeing the returned value.
int rend_cmp_service_ids | ( | const char * | one, |
const char * | two | ||
) |
Return 0 if one and two are the same service ids, else -1 or 1
int rend_compute_v2_desc_id | ( | char * | desc_id_out, |
const char * | service_id, | ||
const char * | descriptor_cookie, | ||
time_t | now, | ||
uint8_t | replica | ||
) |
Compute the binary desc_id_out (DIGEST_LEN bytes long) for a given base32-encoded service_id and optional unencoded descriptor_cookie of length REND_DESC_COOKIE_LEN, at time now for replica number replica. desc_id needs to have DIGEST_LEN bytes free. Return 0 for success, -1 otherwise.
int rend_encode_v2_descriptors | ( | smartlist_t * | descs_out, |
rend_service_descriptor_t * | desc, | ||
time_t | now, | ||
uint8_t | period, | ||
rend_auth_type_t | auth_type, | ||
crypto_pk_t * | client_key, | ||
smartlist_t * | client_cookies | ||
) |
Encode a set of rend_encoded_v2_service_descriptor_t's for desc at time now using service_key, depending on auth_type a descriptor_cookie and a list of client_cookies (which are both NULL if no client authorization is performed), and period (e.g. 0 for the current period, 1 for the next period, etc.) and add them to the existing list descs_out; return the number of seconds that the descriptors will be found by clients, or -1 if the encoding was not successful.
void rend_encoded_v2_service_descriptor_free_ | ( | rend_encoded_v2_service_descriptor_t * | desc | ) |
Free the storage held by an encoded v2 service descriptor.
void rend_get_descriptor_id_bytes | ( | char * | descriptor_id_out, |
const char * | service_id, | ||
const char * | secret_id_part | ||
) |
Compute the descriptor ID for service_id of length REND_SERVICE_ID_LEN and secret_id_part of length DIGEST_LEN, and write it to descriptor_id_out of length DIGEST_LEN.
int rend_get_service_id | ( | crypto_pk_t * | pk, |
char * | out | ||
) |
Sets out to the first 10 bytes of the digest of pk, base32 encoded. NUL-terminates out. (We use this string to identify services in directory requests and .onion URLs.)
void rend_intro_point_free_ | ( | rend_intro_point_t * | intro | ) |
Free the storage held by an introduction point info.
void rend_process_relay_cell | ( | circuit_t * | circ, |
const crypt_path_t * | layer_hint, | ||
int | command, | ||
size_t | length, | ||
const uint8_t * | payload | ||
) |
Called when we get a rendezvous-related relay cell on circuit circ. Dispatch on rendezvous relay command.
void rend_service_descriptor_free_ | ( | rend_service_descriptor_t * | desc | ) |
Free the storage held by the service descriptor desc.
int rend_valid_client_name | ( | const char * | client_name | ) |
Return true iff client_name is a syntactically valid name for rendezvous client authentication.
int rend_valid_descriptor_id | ( | const char * | query | ) |
Return true iff query is a syntactically valid descriptor ID. (as generated by rend_get_descriptor_id_bytes).
int rend_valid_v2_service_id | ( | const char * | query | ) |
Return true iff query is a syntactically valid service ID (as generated by rend_get_service_id).