Remove needless includes from or.h

or.h should really include only the minimum of stuff from or/*,
common/*, and lib/*.
This commit is contained in:
Nick Mathewson 2018-07-01 11:32:11 -04:00
parent 7a61a92870
commit 471104eaa5
95 changed files with 262 additions and 201 deletions

View File

@ -18,7 +18,7 @@
* GZIP_METHOD is guaranteed to be supported by the compress/uncompress
* functions here. Call tor_compress_supports_method() to check if a given
* compression schema is supported by Tor. */
typedef enum {
typedef enum compress_method_t {
NO_METHOD=0, // This method must be first.
GZIP_METHOD=1,
ZLIB_METHOD=2,
@ -32,7 +32,7 @@ typedef enum {
* BEST_COMPRESSION saves the most bandwidth; LOW_COMPRESSION saves the most
* memory.
**/
typedef enum {
typedef enum compression_level_t {
BEST_COMPRESSION, HIGH_COMPRESSION, MEDIUM_COMPRESSION, LOW_COMPRESSION
} compression_level_t;

View File

@ -14,6 +14,7 @@
#define TOR_CRYPTO_DH_H
#include "orconfig.h"
#include "lib/cc/torint.h"
#include "lib/defs/dh_sizes.h"
typedef struct crypto_dh_t crypto_dh_t;

View File

@ -15,13 +15,14 @@
#define ADDRESSMAP_PRIVATE
#include "lib/crypt_ops/crypto_rand.h"
#include "or/or.h"
#include "or/addressmap.h"
#include "or/circuituse.h"
#include "or/config.h"
#include "or/connection_edge.h"
#include "or/control.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/dns.h"
#include "or/nodelist.h"
#include "or/routerset.h"
@ -1153,4 +1154,3 @@ addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
iter = strmap_iter_next(addressmap,iter);
}
}

View File

@ -7,6 +7,8 @@
#ifndef PACKED_CELL_ST_H
#define PACKED_CELL_ST_H
#include "tor_queue.h"
/** A cell as packed for writing to the network. */
struct packed_cell_t {
/** Next cell queued on this circuit. */
@ -25,4 +27,3 @@ struct cell_queue_t {
};
#endif

View File

@ -14,6 +14,8 @@
#include "common/timers.h"
#include "common/handles.h"
#include "tor_queue.h"
/* Channel handler function pointer typedefs */
typedef void (*channel_listener_fn_ptr)(channel_listener_t *, channel_t *);
typedef void (*channel_cell_handler_fn_ptr)(channel_t *, cell_t *);
@ -637,4 +639,3 @@ HANDLE_DECL(channel, channel_s,)
FREE_AND_NULL(channel_handle_t, channel_handle_free_, (h))
#endif /* !defined(TOR_CHANNEL_H) */

View File

@ -69,6 +69,8 @@
#include "or/routerinfo_st.h"
#include "or/var_cell_st.h"
#include "lib/tls/tortls.h"
/** How many CELL_PADDING cells have we received, ever? */
uint64_t stats_n_padding_cells_processed = 0;
/** How many CELL_VERSIONS cells have we received, ever? */
@ -2454,4 +2456,3 @@ channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
#undef ERR
}

View File

@ -11,6 +11,8 @@
#include "or/cell_queue_st.h"
struct hs_token_t;
/**
* A circuit is a path over the onion routing
* network. Applications can connect to one end of the circuit, and can
@ -162,11 +164,10 @@ struct circuit_t {
/** If set, points to an HS token that this circuit might be carrying.
* Used by the HS circuitmap. */
hs_token_t *hs_token;
struct hs_token_t *hs_token;
/** Hashtable node: used to look up the circuit by its HS token using the HS
circuitmap. */
HT_ENTRY(circuit_t) hs_circuitmap_node;
};
#endif

View File

@ -67,6 +67,7 @@
#include "or/control.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "or/directory.h"
#include "or/entrynodes.h"
#include "or/main.h"
@ -86,6 +87,7 @@
#include "or/routerlist.h"
#include "or/routerset.h"
#include "or/channelpadding.h"
#include "lib/compress/compress.h"
#include "lib/compress/compress_lzma.h"
#include "lib/compress/compress_zlib.h"
#include "lib/compress/compress_zstd.h"
@ -2737,4 +2739,3 @@ assert_circuit_ok,(const circuit_t *c))
tor_assert(!or_circ || !or_circ->rend_splice);
}
}

View File

@ -42,6 +42,7 @@
#include "or/circuituse.h"
#include "lib/math/fp.h"
#include "lib/time/tvdiff.h"
#include "lib/encoding/confline.h"
#include "or/crypt_path_st.h"
#include "or/origin_circuit_st.h"

View File

@ -71,6 +71,7 @@
#include "or/circuitstats.h"
#include "lib/compress/compress.h"
#include "or/config.h"
#include "lib/encoding/confline.h"
#include "or/connection.h"
#include "or/connection_edge.h"
#include "or/connection_or.h"

View File

@ -42,7 +42,7 @@ void init_protocol_warning_severity_level(void);
int get_protocol_warning_severity_level(void);
const char *get_version(void);
const char *get_short_version(void);
setopt_err_t options_trial_assign(config_line_t *list, unsigned flags,
setopt_err_t options_trial_assign(struct config_line_t *list, unsigned flags,
char **msg);
uint32_t get_last_resolved_addr(void);
@ -62,7 +62,7 @@ setopt_err_t options_init_from_string(const char *cf_defaults, const char *cf,
int command, const char *command_arg, char **msg);
int option_is_recognized(const char *key);
const char *option_get_canonical_name(const char *key);
config_line_t *option_get_assignment(const or_options_t *options,
struct config_line_t *option_get_assignment(const or_options_t *options,
const char *key);
int options_save_current(void);
const char *get_torrc_fname(int defaults_fname);
@ -180,8 +180,8 @@ int init_cookie_authentication(const char *fname, const char *header,
or_options_t *options_new(void);
int config_parse_commandline(int argc, char **argv, int ignore_errors,
config_line_t **result,
config_line_t **cmdline_result);
struct config_line_t **result,
struct config_line_t **cmdline_result);
void config_register_addressmaps(const or_options_t *options);
/* XXXX move to connection_edge.h */
@ -260,7 +260,7 @@ STATIC int parse_dir_fallback_line(const char *line, int validate_only);
STATIC int have_enough_mem_for_dircache(const or_options_t *options,
size_t total_mem, char **msg);
STATIC int parse_port_config(smartlist_t *out,
const config_line_t *ports,
const struct config_line_t *ports,
const char *portname,
int listener_type,
const char *defaultaddr,

View File

@ -26,6 +26,7 @@
#include "or/routerset.h"
#include "lib/container/bitarray.h"
#include "lib/encoding/confline.h"
static uint64_t config_parse_memunit(const char *s, int *ok);
static int config_parse_msec_interval(const char *s, int *ok);

View File

@ -65,9 +65,9 @@ typedef union {
time_t *ISOTIME;
smartlist_t **CSV;
int *CSV_INTERVAL;
config_line_t **LINELIST;
config_line_t **LINELIST_S;
config_line_t **LINELIST_V;
struct config_line_t **LINELIST;
struct config_line_t **LINELIST_S;
struct config_line_t **LINELIST_V;
routerset_t **ROUTERSET;
} confparse_dummy_values_t;
#endif /* defined(TOR_UNIT_TESTS) */
@ -185,7 +185,7 @@ void config_free_(const config_format_t *fmt, void *options);
(options) = NULL; \
} while (0)
config_line_t *config_get_assigned_option(const config_format_t *fmt,
struct config_line_t *config_get_assigned_option(const config_format_t *fmt,
const void *options, const char *key,
int escape_val);
int config_is_same(const config_format_t *fmt,
@ -197,7 +197,7 @@ char *config_dump(const config_format_t *fmt, const void *default_options,
const void *options, int minimal,
int comment_defaults);
int config_assign(const config_format_t *fmt, void *options,
config_line_t *list,
struct config_line_t *list,
unsigned flags, char **msg);
config_var_t *config_find_option_mutable(config_format_t *fmt,
const char *key);
@ -219,4 +219,3 @@ void warn_deprecated_option(const char *what, const char *why);
#define CFG_EQ_ROUTERSET(a,b,opt) routerset_equal((a)->opt, (b)->opt)
#endif /* !defined(TOR_CONFPARSE_H) */

View File

@ -104,6 +104,9 @@
#include "or/routerparse.h"
#include "lib/sandbox/sandbox.h"
#include "lib/net/buffers_net.h"
#include "lib/tls/tortls.h"
#include "common/compat_libevent.h"
#include "lib/compress/compress.h"
#ifdef HAVE_PWD_H
#include <pwd.h>

View File

@ -106,6 +106,7 @@
#include "or/or_circuit_st.h"
#include "or/origin_circuit_st.h"
#include "or/socks_request_st.h"
#include "common/compat_libevent.h"
#ifdef HAVE_LINUX_TYPES_H
#include <linux/types.h>
@ -4221,4 +4222,3 @@ connection_edge_free_all(void)
pending_entry_connections = NULL;
mainloop_event_free(attach_pending_entry_connections_ev);
}

View File

@ -69,6 +69,8 @@
#include "or/routerinfo_st.h"
#include "or/var_cell_st.h"
#include "lib/tls/tortls.h"
static int connection_tls_finish_handshake(or_connection_t *conn);
static int connection_or_launch_v3_or_handshake(or_connection_t *conn);
static int connection_or_process_cells_from_inbuf(or_connection_t *conn);
@ -2990,4 +2992,3 @@ connection_or_send_authenticate_cell,(or_connection_t *conn, int authtype))
return 0;
}

View File

@ -7,6 +7,7 @@
#include "or/conscache.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/fs/storagedir.h"
#include "lib/encoding/confline.h"
#define CCE_MAGIC 0x17162253
@ -624,4 +625,3 @@ consensus_cache_entry_is_mapped(consensus_cache_entry_t *ent)
}
}
#endif /* defined(TOR_UNIT_TESTS) */

View File

@ -27,7 +27,7 @@ void consensus_cache_delete_pending(consensus_cache_t *cache,
int force);
int consensus_cache_get_n_filenames_available(consensus_cache_t *cache);
consensus_cache_entry_t *consensus_cache_add(consensus_cache_t *cache,
const config_line_t *labels,
const struct config_line_t *labels,
const uint8_t *data,
size_t datalen);
@ -46,7 +46,7 @@ void consensus_cache_filter_list(smartlist_t *lst,
const char *consensus_cache_entry_get_value(const consensus_cache_entry_t *ent,
const char *key);
const config_line_t *consensus_cache_entry_get_labels(
const struct config_line_t *consensus_cache_entry_get_labels(
const consensus_cache_entry_t *ent);
void consensus_cache_entry_incref(consensus_cache_entry_t *ent);
@ -64,4 +64,3 @@ int consensus_cache_entry_is_mapped(consensus_cache_entry_t *ent);
#endif
#endif /* !defined(TOR_CONSCACHE_H) */

View File

@ -21,7 +21,10 @@
#include "or/cpuworker.h"
#include "or/networkstatus.h"
#include "or/routerparse.h"
#include "common/compat_libevent.h"
#include "common/workqueue.h"
#include "lib/compress/compress.h"
#include "lib/encoding/confline.h"
#include "or/networkstatus_st.h"
#include "or/networkstatus_voter_info_st.h"
@ -1940,4 +1943,3 @@ consensus_cache_entry_get_valid_after(const consensus_cache_entry_t *ent,
else
return 0;
}

View File

@ -4,6 +4,8 @@
#ifndef TOR_CONSDIFFMGR_H
#define TOR_CONSDIFFMGR_H
enum compress_method_t;
/**
* Possible outcomes from trying to look up a given consensus diff.
*/
@ -25,7 +27,7 @@ int consdiffmgr_add_consensus(const char *consensus,
consdiff_status_t consdiffmgr_find_consensus(
struct consensus_cache_entry_t **entry_out,
consensus_flavor_t flavor,
compress_method_t method);
enum compress_method_t method);
consdiff_status_t consdiffmgr_find_diff_from(
struct consensus_cache_entry_t **entry_out,
@ -33,7 +35,7 @@ consdiff_status_t consdiffmgr_find_diff_from(
int digest_type,
const uint8_t *digest,
size_t digestlen,
compress_method_t method);
enum compress_method_t method);
int consensus_cache_entry_get_voter_id_digests(
const struct consensus_cache_entry_t *ent,
@ -71,4 +73,3 @@ STATIC int uncompress_or_copy(char **out, size_t *outlen,
#endif /* defined(CONSDIFFMGR_PRIVATE) */
#endif /* !defined(TOR_CONSDIFFMGR_H) */

View File

@ -80,6 +80,7 @@
#include "or/routerlist.h"
#include "or/routerparse.h"
#include "or/shared_random_client.h"
#include "lib/encoding/confline.h"
#include "or/cached_dir_st.h"
#include "or/control_connection_st.h"
@ -106,6 +107,7 @@
#include "lib/crypt_ops/crypto_s2k.h"
#include "common/procmon.h"
#include "common/compat_libevent.h"
/** Yield true iff <b>s</b> is the state of a control_connection_t that has
* finished authentication and is accepting commands. */
@ -7791,4 +7793,3 @@ control_testing_set_global_event_mask(uint64_t mask)
global_event_mask = mask;
}
#endif /* defined(TOR_UNIT_TESTS) */

View File

@ -99,7 +99,7 @@ int control_event_signal(uintptr_t signal);
int init_control_cookie_authentication(int enabled);
char *get_controller_cookie_file_name(void);
smartlist_t *decode_hashed_passwords(config_line_t *passwords);
smartlist_t *decode_hashed_passwords(struct config_line_t *passwords);
void disable_control_logging(void);
void enable_control_logging(void);
@ -325,4 +325,3 @@ STATIC int getinfo_helper_current_time(
#endif /* defined(CONTROL_PRIVATE) */
#endif /* !defined(TOR_CONTROL_H) */

View File

@ -8,6 +8,7 @@
#define CRYPT_PATH_ST_H
#include "or/relay_crypto_st.h"
struct crypto_dh_t;
/** Holds accounting information for a single step in the layered encryption
* performed by a circuit. Used only at the client edge of a circuit. */
@ -23,7 +24,7 @@ struct crypt_path_t {
onion_handshake_state_t handshake_state;
/** Diffie-hellman handshake state for performing an introduction
* operations */
crypto_dh_t *rend_dh_handshake_state;
struct crypto_dh_t *rend_dh_handshake_state;
/** Negotiated key material shared with the OR at this step. */
char rend_circ_nonce[DIGEST_LEN];/* KH in tor-spec.txt */
@ -53,4 +54,3 @@ struct crypt_path_t {
};
#endif

View File

@ -9,6 +9,8 @@
#include "or/connection_st.h"
struct tor_compress_state_t;
/** Subtype of connection_t for an "directory connection" -- that is, an HTTP
* connection to retrieve or serve directory material. */
struct dir_connection_t {
@ -31,7 +33,7 @@ struct dir_connection_t {
* it from back to front. */
smartlist_t *spool;
/** The compression object doing on-the-fly compression for spooled data. */
tor_compress_state_t *compress_state;
struct tor_compress_state_t *compress_state;
/** What rendezvous service are we querying for? */
rend_data_t *rend_data;
@ -63,4 +65,3 @@ struct dir_connection_t {
};
#endif

View File

@ -44,6 +44,7 @@
#include "or/vote_timing_st.h"
#include "lib/container/order.h"
#include "lib/encoding/confline.h"
/**
* \file dirvote.c

View File

@ -21,6 +21,7 @@
#include "or/shared_random_client.h"
#include "or/dirauth/shared_random_state.h"
#include "or/voting_schedule.h"
#include "lib/encoding/confline.h"
/* Default filename of the shared random state on disk. */
static const char default_fname[] = "sr-state";
@ -1321,4 +1322,3 @@ get_sr_state(void)
}
#endif /* defined(TOR_UNIT_TESTS) */

View File

@ -85,11 +85,11 @@ typedef struct sr_disk_state_t {
/* State valid until? */
time_t ValidUntil;
/* All commits seen that are valid. */
config_line_t *Commit;
struct config_line_t *Commit;
/* Previous and current shared random value. */
config_line_t *SharedRandValues;
struct config_line_t *SharedRandValues;
/* Extra Lines for configuration we might not know. */
config_line_t *ExtraLines;
struct config_line_t *ExtraLines;
} sr_disk_state_t;
/* API */
@ -144,4 +144,3 @@ STATIC sr_state_t *get_sr_state(void);
#endif /* defined(TOR_UNIT_TESTS) */
#endif /* !defined(TOR_SHARED_RANDOM_STATE_H) */

View File

@ -17,6 +17,7 @@
#include "or/consdiff.h"
#include "or/consdiffmgr.h"
#include "or/control.h"
#include "lib/compress/compress.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "or/directory.h"
@ -42,6 +43,7 @@
#include "or/routerlist.h"
#include "or/routerparse.h"
#include "or/routerset.h"
#include "lib/encoding/confline.h"
#if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
#if !defined(OpenBSD)
@ -5952,4 +5954,3 @@ dir_split_resource_into_spoolable(const char *resource,
smartlist_free(fingerprints);
return r;
}

View File

@ -13,6 +13,7 @@
#define TOR_DIRECTORY_H
#include "or/hs_ident.h"
enum compress_method_t;
dir_connection_t *TO_DIR_CONN(connection_t *c);
int directories_have_accepted_server_descriptor(void);
@ -90,7 +91,7 @@ void directory_request_add_header(directory_request_t *req,
MOCK_DECL(void, directory_initiate_request, (directory_request_t *request));
int parse_http_response(const char *headers, int *code, time_t *date,
compress_method_t *compression, char **response);
enum compress_method_t *compression, char **response);
int parse_http_command(const char *headers,
char **command_out, char **url_out);
char *http_get_header(const char *headers, const char *which);
@ -189,7 +190,7 @@ struct directory_request_t {
/** Hidden-service-specific information v2. */
const rend_data_t *rend_query;
/** Extra headers to append to the request */
config_line_t *additional_headers;
struct config_line_t *additional_headers;
/** Hidden-service-specific information for v3+. */
const hs_ident_dir_conn_t *hs_ident;
/** Used internally to directory.c: gets informed when the attempt to
@ -203,8 +204,10 @@ STATIC int handle_get_hs_descriptor_v3(dir_connection_t *conn,
const struct get_handler_args_t *args);
STATIC int directory_handle_command(dir_connection_t *conn);
STATIC char *accept_encoding_header(void);
STATIC int allowed_anonymous_connection_compression_method(compress_method_t);
STATIC void warn_disallowed_anonymous_compression_method(compress_method_t);
STATIC int allowed_anonymous_connection_compression_method(
enum compress_method_t);
STATIC void warn_disallowed_anonymous_compression_method(
enum compress_method_t);
STATIC int handle_response_fetch_hsdesc_v3(dir_connection_t *conn,
const response_handler_args_t *args);
@ -239,7 +242,8 @@ STATIC int handle_post_hs_descriptor(const char *url, const char *body);
STATIC char* authdir_type_to_string(dirinfo_type_t auth);
STATIC const char * dir_conn_purpose_to_string(int purpose);
STATIC int should_use_directory_guards(const or_options_t *options);
STATIC compression_level_t choose_compression_level(ssize_t n_bytes);
enum compression_level_t;
STATIC enum compression_level_t choose_compression_level(ssize_t n_bytes);
STATIC int find_dl_min_delay(const download_status_t *dls,
const or_options_t *options);
@ -268,4 +272,3 @@ STATIC unsigned parse_accept_encoding_header(const char *h);
#endif /* defined(TOR_UNIT_TESTS) || defined(DIRECTORY_PRIVATE) */
#endif /* !defined(TOR_DIRECTORY_H) */

View File

@ -46,7 +46,9 @@
#include "or/tor_version_st.h"
#include "or/vote_routerstatus_st.h"
#include "lib/compress/compress.h"
#include "lib/container/order.h"
#include "lib/encoding/confline.h"
/**
* \file dirserv.c

View File

@ -64,6 +64,7 @@
#include "or/router.h"
#include "ht.h"
#include "lib/sandbox/sandbox.h"
#include "common/compat_libevent.h"
#include "or/edge_connection_st.h"
#include "or/or_circuit_st.h"
@ -2136,4 +2137,3 @@ dns_insert_cache_entry(cached_resolve_t *new_entry)
{
HT_INSERT(cache_map, &cache_root, new_entry);
}

View File

@ -34,6 +34,7 @@
#include "or/entry_connection_st.h"
#include "or/listener_connection_st.h"
#include "or/socks_request_st.h"
#include "common/compat_libevent.h"
#include <event2/dns.h>
#include <event2/dns_compat.h>
@ -412,4 +413,3 @@ dnsserv_close_listener(connection_t *conn)
listener_conn->dns_server_port = NULL;
}
}

View File

@ -139,6 +139,7 @@
#include "or/transports.h"
#include "or/statefile.h"
#include "lib/math/fp.h"
#include "lib/encoding/confline.h"
#include "or/node_st.h"
#include "or/origin_circuit_st.h"

View File

@ -41,6 +41,7 @@ hibernating, phase 2:
#include "or/main.h"
#include "or/router.h"
#include "or/statefile.h"
#include "common/compat_libevent.h"
#include "or/or_connection_st.h"
@ -1227,4 +1228,3 @@ hibernate_set_state_for_testing_(hibernate_state_t newstate)
hibernate_state = newstate;
}
#endif /* defined(TOR_UNIT_TESTS) */

View File

@ -23,6 +23,7 @@
#include "or/router.h"
#include "or/hs_cell.h"
#include "or/hs_circuitmap.h"
#include "or/hs_ident.h"
#include "or/hs_ntor.h"
#include "or/hs_service.h"

View File

@ -583,4 +583,3 @@ hs_circuitmap_free_all(void)
tor_free(the_hs_circuitmap);
}
}

View File

@ -11,7 +11,7 @@
typedef HT_HEAD(hs_circuitmap_ht, circuit_t) hs_circuitmap_ht;
typedef struct hs_token_s hs_token_t;
typedef struct hs_token_t hs_token_t;
struct or_circuit_t;
struct origin_circuit_t;
@ -90,7 +90,7 @@ typedef enum {
/** Represents a token used in the HS protocol. Each such token maps to a
* specific introduction or rendezvous circuit. */
struct hs_token_s {
struct hs_token_t {
/* Type of HS token. */
hs_token_type_t type;
@ -110,4 +110,3 @@ hs_circuitmap_ht *get_hs_circuitmap(void);
#endif /* TOR_UNIT_TESTS */
#endif /* !defined(TOR_HS_CIRCUITMAP_H) */

View File

@ -22,6 +22,7 @@
#include "or/hs_cache.h"
#include "or/hs_cell.h"
#include "or/hs_circuit.h"
#include "or/hs_circuitmap.h"
#include "or/hs_client.h"
#include "or/hs_control.h"
#include "or/hs_descriptor.h"
@ -1619,4 +1620,3 @@ hs_client_dir_info_changed(void)
* AP_CONN_STATE_RENDDESC_WAIT state in order to fetch the descriptor. */
retry_all_socks_conn_waiting_for_desc();
}

View File

@ -29,6 +29,7 @@
#include "or/hs_config.h"
#include "or/hs_service.h"
#include "or/rendservice.h"
#include "lib/encoding/confline.h"
/* Using the given list of services, stage them into our global state. Every
* service version are handled. This function can remove entries in the given
@ -587,4 +588,3 @@ hs_config_service_all(const or_options_t *options, int validate_only)
/* Tor main should call the free all function on error. */
return ret;
}

View File

@ -47,6 +47,8 @@
#include "or/origin_circuit_st.h"
#include "or/routerstatus_st.h"
#include "lib/encoding/confline.h"
/* Trunnel */
#include "trunnel/ed25519_cert.h"
#include "trunnel/hs/cell_common.h"
@ -3631,4 +3633,3 @@ get_first_service(void)
}
#endif /* defined(TOR_UNIT_TESTS) */

View File

@ -116,6 +116,9 @@
#include "lib/sandbox/sandbox.h"
#include "lib/fs/lockfile.h"
#include "lib/net/buffers_net.h"
#include "lib/tls/tortls.h"
#include "common/compat_libevent.h"
#include "lib/encoding/confline.h"
#include <event2/event.h>

View File

@ -96,10 +96,12 @@ uint64_t get_main_loop_idle_count(void);
void periodic_events_on_new_options(const or_options_t *options);
void reschedule_per_second_timer(void);
struct token_bucket_rw_t;
extern time_t time_of_process_start;
extern int quiet_level;
extern token_bucket_rw_t global_bucket;
extern token_bucket_rw_t global_relayed_bucket;
extern struct token_bucket_rw_t global_bucket;
extern struct token_bucket_rw_t global_relayed_bucket;
#ifdef MAIN_PRIVATE
STATIC void init_connection_lists(void);
@ -118,4 +120,3 @@ extern periodic_event_item_t periodic_events[];
#endif /* defined(MAIN_PRIVATE) */
#endif /* !defined(TOR_MAIN_H) */

View File

@ -25,6 +25,7 @@
#include "or/ntmain.h"
#include "lib/log/win32err.h"
#include "lib/fs/winlib.h"
#include "common/compat_libevent.h"
#include <windows.h>
#define GENSRV_SERVICENAME "tor"

View File

@ -68,6 +68,7 @@
#include "or/config.h"
#include "or/cpuworker.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "or/networkstatus.h"
#include "or/onion.h"
#include "or/onion_fast.h"
@ -1343,4 +1344,3 @@ extended_cell_format(uint8_t *command_out, uint16_t *len_out,
return 0;
}

View File

@ -29,6 +29,7 @@
#include "or/or.h"
#include "or/onion_fast.h"
#include "lib/crypt_ops/crypto_hkdf.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
@ -141,4 +142,3 @@ fast_client_handshake(const fast_handshake_state_t *handshake_state,
tor_free(out);
return r;
}

View File

@ -29,6 +29,7 @@
#include "or/or.h"
#include "or/config.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "or/onion_tap.h"
@ -243,4 +244,3 @@ onion_skin_TAP_client_handshake(crypto_dh_t *handshake_state,
tor_free(key_material);
return -1;
}

View File

@ -17,22 +17,24 @@
DH1024_KEY_LEN)
#define TAP_ONIONSKIN_REPLY_LEN (DH1024_KEY_LEN+DIGEST_LEN)
int onion_skin_TAP_create(crypto_pk_t *router_key,
crypto_dh_t **handshake_state_out,
struct crypto_dh_t;
struct crypto_pk_t;
int onion_skin_TAP_create(struct crypto_pk_t *router_key,
struct crypto_dh_t **handshake_state_out,
char *onion_skin_out);
int onion_skin_TAP_server_handshake(const char *onion_skin,
crypto_pk_t *private_key,
crypto_pk_t *prev_private_key,
struct crypto_pk_t *private_key,
struct crypto_pk_t *prev_private_key,
char *handshake_reply_out,
char *key_out,
size_t key_out_len);
int onion_skin_TAP_client_handshake(crypto_dh_t *handshake_state,
int onion_skin_TAP_client_handshake(struct crypto_dh_t *handshake_state,
const char *handshake_reply,
char *key_out,
size_t key_out_len,
const char **msg_out);
#endif /* !defined(TOR_ONION_TAP_H) */

View File

@ -63,27 +63,17 @@
#include <windows.h>
#endif /* defined(_WIN32) */
#include "common/util.h"
#include "lib/container/map.h"
#include "lib/container/smartlist.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_format.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_hkdf.h"
#include "lib/tls/tortls.h"
#include "lib/log/torlog.h"
#include "lib/container/smartlist.h"
#include "lib/container/map.h"
#include "lib/compress/compress.h"
#include "lib/net/address.h"
#include "common/compat_libevent.h"
#include "ht.h"
#include "lib/encoding/confline.h"
#include "or/replaycache.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "lib/crypt_ops/crypto_ed25519.h"
#include "tor_queue.h"
#include "common/token_bucket.h"
#include "lib/defs/dh_sizes.h"
#include "lib/encoding/binascii.h"
#include "or/hs_circuitmap.h"
#include "common/util.h"
#include "lib/net/address.h"
#include "ht.h"
// These, more than other includes, are for keeping the other struct
// definitions working. We should remove them when we minimize our includes.
@ -1523,6 +1513,7 @@ typedef enum {
struct fast_handshake_state_t;
struct ntor_handshake_state_t;
struct crypto_dh_t;
#define ONION_HANDSHAKE_TYPE_TAP 0x0000
#define ONION_HANDSHAKE_TYPE_FAST 0x0001
#define ONION_HANDSHAKE_TYPE_NTOR 0x0002
@ -1531,7 +1522,7 @@ typedef struct {
uint16_t tag;
union {
struct fast_handshake_state_t *fast;
crypto_dh_t *tap;
struct crypto_dh_t *tap;
struct ntor_handshake_state_t *ntor;
} u;
} onion_handshake_state_t;
@ -1694,6 +1685,8 @@ typedef enum {OUTBOUND_ADDR_EXIT, OUTBOUND_ADDR_OR,
OUTBOUND_ADDR_EXIT_AND_OR,
OUTBOUND_ADDR_MAX} outbound_addr_t;
struct config_line_t;
/** Configuration options for a Tor process. */
typedef struct {
uint32_t magic_;
@ -1707,7 +1700,7 @@ typedef struct {
} command;
char *command_arg; /**< Argument for command-line option. */
config_line_t *Logs; /**< New-style list of configuration lines
struct config_line_t *Logs; /**< New-style list of configuration lines
* for logs */
int LogTimeGranularity; /**< Log resolution in milliseconds. */
@ -1761,7 +1754,7 @@ typedef struct {
int DisableAllSwap; /**< Boolean: Attempt to call mlockall() on our
* process for all current and future memory. */
config_line_t *ExitPolicy; /**< Lists of exit policy components. */
struct config_line_t *ExitPolicy; /**< Lists of exit policy components. */
int ExitPolicyRejectPrivate; /**< Should we not exit to reserved private
* addresses, and our own published addresses?
*/
@ -1770,36 +1763,37 @@ typedef struct {
* Includes OutboundBindAddresses and
* configured ports. */
int ReducedExitPolicy; /**<Should we use the Reduced Exit Policy? */
config_line_t *SocksPolicy; /**< Lists of socks policy components */
config_line_t *DirPolicy; /**< Lists of dir policy components */
struct config_line_t *SocksPolicy; /**< Lists of socks policy components */
struct config_line_t *DirPolicy; /**< Lists of dir policy components */
/** Local address to bind outbound sockets */
config_line_t *OutboundBindAddress;
struct config_line_t *OutboundBindAddress;
/** Local address to bind outbound relay sockets */
config_line_t *OutboundBindAddressOR;
struct config_line_t *OutboundBindAddressOR;
/** Local address to bind outbound exit sockets */
config_line_t *OutboundBindAddressExit;
struct config_line_t *OutboundBindAddressExit;
/** Addresses derived from the various OutboundBindAddress lines.
* [][0] is IPv4, [][1] is IPv6
*/
tor_addr_t OutboundBindAddresses[OUTBOUND_ADDR_MAX][2];
/** Directory server only: which versions of
* Tor should we tell users to run? */
config_line_t *RecommendedVersions;
config_line_t *RecommendedClientVersions;
config_line_t *RecommendedServerVersions;
config_line_t *RecommendedPackages;
struct config_line_t *RecommendedVersions;
struct config_line_t *RecommendedClientVersions;
struct config_line_t *RecommendedServerVersions;
struct config_line_t *RecommendedPackages;
/** Whether dirservers allow router descriptors with private IPs. */
int DirAllowPrivateAddresses;
/** Whether routers accept EXTEND cells to routers with private IPs. */
int ExtendAllowPrivateAddresses;
char *User; /**< Name of user to run Tor as. */
config_line_t *ORPort_lines; /**< Ports to listen on for OR connections. */
/** Ports to listen on for OR connections. */
struct config_line_t *ORPort_lines;
/** Ports to listen on for extended OR connections. */
config_line_t *ExtORPort_lines;
struct config_line_t *ExtORPort_lines;
/** Ports to listen on for SOCKS connections. */
config_line_t *SocksPort_lines;
struct config_line_t *SocksPort_lines;
/** Ports to listen on for transparent pf/netfilter connections. */
config_line_t *TransPort_lines;
struct config_line_t *TransPort_lines;
char *TransProxyType; /**< What kind of transparent proxy
* implementation are we using? */
/** Parsed value of TransProxyType. */
@ -1809,20 +1803,21 @@ typedef struct {
TPT_IPFW,
TPT_TPROXY,
} TransProxyType_parsed;
config_line_t *NATDPort_lines; /**< Ports to listen on for transparent natd
* connections. */
/** Ports to listen on for transparent natd connections. */
struct config_line_t *NATDPort_lines;
/** Ports to listen on for HTTP Tunnel connections. */
config_line_t *HTTPTunnelPort_lines;
config_line_t *ControlPort_lines; /**< Ports to listen on for control
struct config_line_t *HTTPTunnelPort_lines;
struct config_line_t *ControlPort_lines; /**< Ports to listen on for control
* connections. */
config_line_t *ControlSocket; /**< List of Unix Domain Sockets to listen on
* for control connections. */
/** List of Unix Domain Sockets to listen on for control connections. */
struct config_line_t *ControlSocket;
int ControlSocketsGroupWritable; /**< Boolean: Are control sockets g+rw? */
int UnixSocksGroupWritable; /**< Boolean: Are SOCKS Unix sockets g+rw? */
/** Ports to listen on for directory connections. */
config_line_t *DirPort_lines;
config_line_t *DNSPort_lines; /**< Ports to listen on for DNS requests. */
struct config_line_t *DirPort_lines;
/** Ports to listen on for DNS requests. */
struct config_line_t *DNSPort_lines;
/* MaxMemInQueues value as input by the user. We clean this up to be
* MaxMemInQueues. */
@ -1878,19 +1873,19 @@ typedef struct {
char *BridgePassword_AuthDigest_;
int UseBridges; /**< Boolean: should we start all circuits with a bridge? */
config_line_t *Bridges; /**< List of bootstrap bridge addresses. */
struct config_line_t *Bridges; /**< List of bootstrap bridge addresses. */
config_line_t *ClientTransportPlugin; /**< List of client
struct config_line_t *ClientTransportPlugin; /**< List of client
transport plugins. */
config_line_t *ServerTransportPlugin; /**< List of client
struct config_line_t *ServerTransportPlugin; /**< List of client
transport plugins. */
/** List of TCP/IP addresses that transports should listen at. */
config_line_t *ServerTransportListenAddr;
struct config_line_t *ServerTransportListenAddr;
/** List of options that must be passed to pluggable transports. */
config_line_t *ServerTransportOptions;
struct config_line_t *ServerTransportOptions;
int BridgeRelay; /**< Boolean: are we acting as a bridge relay? We make
* this explicit so we can change how we behave in the
@ -1975,9 +1970,10 @@ typedef struct {
int FascistFirewall; /**< Whether to prefer ORs reachable on open ports. */
smartlist_t *FirewallPorts; /**< Which ports our firewall allows
* (strings). */
config_line_t *ReachableAddresses; /**< IP:ports our firewall allows. */
config_line_t *ReachableORAddresses; /**< IP:ports for OR conns. */
config_line_t *ReachableDirAddresses; /**< IP:ports for Dir conns. */
/** IP:ports our firewall allows. */
struct config_line_t *ReachableAddresses;
struct config_line_t *ReachableORAddresses; /**< IP:ports for OR conns. */
struct config_line_t *ReachableDirAddresses; /**< IP:ports for Dir conns. */
int ConstrainedSockets; /**< Shrink xmit and recv socket buffers. */
uint64_t ConstrainedSockSize; /**< Size of constrained buffers. */
@ -2004,7 +2000,7 @@ typedef struct {
smartlist_t *TrackHostExits;
int TrackHostExitsExpire; /**< Number of seconds until we expire an
* addressmap */
config_line_t *AddressMap; /**< List of address map directives. */
struct config_line_t *AddressMap; /**< List of address map directives. */
int AutomapHostsOnResolve; /**< If true, when we get a resolve request for a
* hostname ending with one of the suffixes in
* <b>AutomapHostsSuffixes</b>, map it to a
@ -2049,10 +2045,11 @@ typedef struct {
uint64_t PerConnBWRate; /**< Long-term bw on a single TLS conn, if set. */
uint64_t PerConnBWBurst; /**< Allowed burst on a single TLS conn, if set. */
int NumCPUs; /**< How many CPUs should we try to use? */
config_line_t *RendConfigLines; /**< List of configuration lines
struct config_line_t *RendConfigLines; /**< List of configuration lines
* for rendezvous services. */
config_line_t *HidServAuth; /**< List of configuration lines for client-side
* authorizations for hidden services */
struct config_line_t *HidServAuth; /**< List of configuration lines for
* client-side authorizations for hidden
* services */
char *ContactInfo; /**< Contact info to be published in the directory. */
int HeartbeatPeriod; /**< Log heartbeat messages after this many seconds
@ -2083,10 +2080,10 @@ typedef struct {
/** List of configuration lines for replacement directory authorities.
* If you just want to replace one class of authority at a time,
* use the "Alternate*Authority" options below instead. */
config_line_t *DirAuthorities;
struct config_line_t *DirAuthorities;
/** List of fallback directory servers */
config_line_t *FallbackDir;
struct config_line_t *FallbackDir;
/** Whether to use the default hard-coded FallbackDirs */
int UseDefaultFallbackDirs;
@ -2096,21 +2093,22 @@ typedef struct {
/** If set, use these main (currently v3) directory authorities and
* not the default ones. */
config_line_t *AlternateDirAuthority;
struct config_line_t *AlternateDirAuthority;
/** If set, use these bridge authorities and not the default one. */
config_line_t *AlternateBridgeAuthority;
struct config_line_t *AlternateBridgeAuthority;
config_line_t *MyFamily_lines; /**< Declared family for this OR. */
config_line_t *MyFamily; /**< Declared family for this OR, normalized */
config_line_t *NodeFamilies; /**< List of config lines for
struct config_line_t *MyFamily_lines; /**< Declared family for this OR. */
struct config_line_t *MyFamily; /**< Declared family for this OR,
normalized */
struct config_line_t *NodeFamilies; /**< List of config lines for
* node families */
smartlist_t *NodeFamilySets; /**< List of parsed NodeFamilies values. */
config_line_t *AuthDirBadExit; /**< Address policy for descriptors to
struct config_line_t *AuthDirBadExit; /**< Address policy for descriptors to
* mark as bad exits. */
config_line_t *AuthDirReject; /**< Address policy for descriptors to
struct config_line_t *AuthDirReject; /**< Address policy for descriptors to
* reject. */
config_line_t *AuthDirInvalid; /**< Address policy for descriptors to
struct config_line_t *AuthDirInvalid; /**< Address policy for descriptors to
* never mark as valid. */
/** @name AuthDir...CC
*
@ -2153,9 +2151,9 @@ typedef struct {
enum { ACCT_MAX, ACCT_SUM, ACCT_IN, ACCT_OUT } AccountingRule;
/** Base64-encoded hash of accepted passwords for the control system. */
config_line_t *HashedControlPassword;
struct config_line_t *HashedControlPassword;
/** As HashedControlPassword, but not saved. */
config_line_t *HashedControlSessionPassword;
struct config_line_t *HashedControlSessionPassword;
int CookieAuthentication; /**< Boolean: do we enable cookie-based auth for
* the control system? */
@ -2767,15 +2765,15 @@ typedef struct {
uint64_t AccountingExpectedUsage;
/** A list of Entry Guard-related configuration lines. (pre-prop271) */
config_line_t *EntryGuards;
struct config_line_t *EntryGuards;
/** A list of guard-related configuration lines. (post-prop271) */
config_line_t *Guard;
struct config_line_t *Guard;
config_line_t *TransportProxies;
struct config_line_t *TransportProxies;
/** Cached revision counters for active hidden services on this host */
config_line_t *HidServRevCounter;
struct config_line_t *HidServRevCounter;
/** These fields hold information on the history of bandwidth usage for
* servers. The "Ends" fields hold the time when we last updated the
@ -2803,7 +2801,7 @@ typedef struct {
smartlist_t *BWHistoryDirWriteMaxima;
/** Build time histogram */
config_line_t * BuildtimeHistogram;
struct config_line_t * BuildtimeHistogram;
int TotalBuildTimes;
int CircuitBuildAbandonedCount;
@ -2812,7 +2810,7 @@ typedef struct {
/** Holds any unrecognized values we found in the state file, in the order
* in which we found them. */
config_line_t *ExtraLines;
struct config_line_t *ExtraLines;
/** When did we last rotate our onion key? "0" for 'no idea'. */
time_t LastRotatedOnionKey;

View File

@ -8,6 +8,9 @@
#define OR_CONNECTION_ST_H
#include "or/connection_st.h"
#include "common/token_bucket.h"
struct tor_tls_t;
/** Subtype of connection_t for an "OR connection" -- that is, one that speaks
* cells over TLS. */
@ -33,7 +36,7 @@ struct or_connection_t {
char *nickname; /**< Nickname of OR on other side (if any). */
tor_tls_t *tls; /**< TLS connection state. */
struct tor_tls_t *tls; /**< TLS connection state. */
int tls_error; /**< Last tor_tls error code. */
/** When we last used this conn for any client traffic. If not
* recent, we can rate limit it further. */
@ -87,4 +90,3 @@ struct or_connection_t {
};
#endif

View File

@ -7,6 +7,8 @@
#ifndef OR_HANDSHAKE_CERTS_ST
#define OR_HANDSHAKE_CERTS_ST
struct tor_x509_cert_t;
/** Structure to hold all the certificates we've received on an OR connection
*/
struct or_handshake_certs_t {
@ -14,13 +16,13 @@ struct or_handshake_certs_t {
int started_here;
/** The cert for the 'auth' RSA key that's supposed to sign the AUTHENTICATE
* cell. Signed with the RSA identity key. */
tor_x509_cert_t *auth_cert;
struct tor_x509_cert_t *auth_cert;
/** The cert for the 'link' RSA key that was used to negotiate the TLS
* connection. Signed with the RSA identity key. */
tor_x509_cert_t *link_cert;
struct tor_x509_cert_t *link_cert;
/** A self-signed identity certificate: the RSA identity key signed
* with itself. */
tor_x509_cert_t *id_cert;
struct tor_x509_cert_t *id_cert;
/** The Ed25519 signing key, signed with the Ed25519 identity key. */
struct tor_cert_st *ed_id_sign;
/** A digest of the X509 link certificate for the TLS connection, signed
@ -36,4 +38,3 @@ struct or_handshake_certs_t {
};
#endif

View File

@ -16,6 +16,7 @@
#include "or/config.h"
#include "or/main.h"
#include "or/periodic.h"
#include "common/compat_libevent.h"
/** We disable any interval greater than this number of seconds, on the
* grounds that it is probably an absolute time mistakenly passed in as a
@ -169,4 +170,3 @@ periodic_event_disable(periodic_event_item_t *event)
mainloop_event_cancel(event->ev);
event->enabled = 0;
}

View File

@ -29,6 +29,7 @@
#include "or/routerparse.h"
#include "or/geoip.h"
#include "ht.h"
#include "lib/encoding/confline.h"
#include "or/dir_server_st.h"
#include "or/microdesc_st.h"
@ -3143,4 +3144,3 @@ policies_free_all(void)
}
HT_CLEAR(policy_map, &policy_root);
}

View File

@ -88,7 +88,7 @@ int policies_parse_exit_policy_from_options(
uint32_t local_address,
const tor_addr_t *ipv6_local_address,
smartlist_t **result);
int policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
int policies_parse_exit_policy(struct config_line_t *cfg, smartlist_t **dest,
exit_policy_parser_cfg_t options,
const smartlist_t *configured_addresses);
void policies_parse_exit_policy_reject_private(
@ -151,4 +151,3 @@ STATIC const tor_addr_port_t * fascist_firewall_choose_address(
#endif /* defined(POLICIES_PRIVATE) */
#endif /* !defined(TOR_POLICIES_H) */

View File

@ -17,6 +17,7 @@
#include "or/or.h"
#include "or/config.h"
#include "or/reasons.h"
#include "lib/tls/tortls.h"
/***************************** Edge (stream) reasons **********************/
@ -493,4 +494,3 @@ end_reason_to_http_connect_response_line(int endreason)
return "HTTP/1.0 500 Internal Server Error (weird end reason)\r\n\r\n";
}
}

View File

@ -7,6 +7,7 @@
#include "or/or.h"
#include "or/circuitlist.h"
#include "or/config.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_util.h"
#include "or/hs_ntor.h" // for HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN
#include "or/relay.h"
@ -329,4 +330,3 @@ relay_crypto_assert_ok(const relay_crypto_t *crypto)
tor_assert(crypto->f_digest);
tor_assert(crypto->b_digest);
}

View File

@ -7,21 +7,25 @@
#ifndef RELAY_CRYPTO_ST_H
#define RELAY_CRYPTO_ST_H
#define crypto_cipher_t aes_cnt_cipher
struct crypto_cipher_t;
struct crypto_digest_t;
struct relay_crypto_t {
/* crypto environments */
/** Encryption key and counter for cells heading towards the OR at this
* step. */
crypto_cipher_t *f_crypto;
struct crypto_cipher_t *f_crypto;
/** Encryption key and counter for cells heading back from the OR at this
* step. */
crypto_cipher_t *b_crypto;
struct crypto_cipher_t *b_crypto;
/** Digest state for cells heading towards the OR at this step. */
crypto_digest_t *f_digest; /* for integrity checking */
struct crypto_digest_t *f_digest; /* for integrity checking */
/** Digest state for cells heading away from the OR at this step. */
crypto_digest_t *b_digest;
struct crypto_digest_t *b_digest;
};
#undef crypto_cipher_t
#endif

View File

@ -7,14 +7,17 @@
#ifndef REND_INTRO_POINT_ST_H
#define REND_INTRO_POINT_ST_H
struct replaycache_t;
struct crypto_pk_t;
/** Introduction point information. Used both in rend_service_t (on
* the service side) and in rend_service_descriptor_t (on both the
* client and service side). */
struct rend_intro_point_t {
extend_info_t *extend_info; /**< Extend info for connecting to this
* introduction point via a multi-hop path. */
crypto_pk_t *intro_key; /**< Introduction key that replaces the service
* key, if this descriptor is V2. */
struct crypto_pk_t *intro_key; /**< Introduction key that replaces the
* service key, if this descriptor is V2. */
/** (Client side only) Flag indicating that a timeout has occurred
* after sending an INTRODUCE cell to this intro point. After a
@ -35,7 +38,7 @@ struct rend_intro_point_t {
/** (Service side only) A replay cache recording the RSA-encrypted parts
* of INTRODUCE2 cells this intro point's circuit has received. This is
* used to prevent replay attacks. */
replaycache_t *accepted_intro_rsa_parts;
struct replaycache_t *accepted_intro_rsa_parts;
/** (Service side only) Count of INTRODUCE2 cells accepted from this
* intro point.
@ -71,4 +74,3 @@ struct rend_intro_point_t {
};
#endif

View File

@ -16,6 +16,7 @@
#include "or/connection.h"
#include "or/connection_edge.h"
#include "or/control.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "or/directory.h"
@ -32,6 +33,7 @@
#include "or/router.h"
#include "or/routerlist.h"
#include "or/routerset.h"
#include "lib/encoding/confline.h"
#include "or/cpath_build_state_st.h"
#include "or/crypt_path_st.h"
@ -1253,4 +1255,3 @@ rend_client_non_anonymous_mode_enabled(const or_options_t *options)
return 0;
#endif /* defined(NON_ANONYMOUS_MODE_ENABLED) */
}

View File

@ -27,6 +27,7 @@
#include "or/rendmid.h"
#include "or/rendservice.h"
#include "or/rephist.h"
#include "or/replaycache.h"
#include "or/router.h"
#include "or/routerlist.h"
#include "or/routerparse.h"
@ -1053,4 +1054,3 @@ rend_circuit_pk_digest_eq(const origin_circuit_t *ocirc,
match:
return 1;
}

View File

@ -35,6 +35,7 @@
#include "or/routerlist.h"
#include "or/routerparse.h"
#include "or/routerset.h"
#include "lib/encoding/confline.h"
#include "or/cpath_build_state_st.h"
#include "or/crypt_path_st.h"
@ -4437,4 +4438,3 @@ set_rend_rend_service_staging_list(smartlist_t *new_list)
}
#endif /* defined(TOR_UNIT_TESTS) */

View File

@ -14,6 +14,7 @@
#include "or/or.h"
#include "or/hs_service.h"
#include "lib/crypt_ops/crypto_dh.h"
typedef struct rend_intro_cell_s rend_intro_cell_t;
@ -138,7 +139,7 @@ STATIC void rend_service_prune_list_impl_(void);
#endif /* defined(RENDSERVICE_PRIVATE) */
int rend_num_services(void);
int rend_config_service(const config_line_t *line_,
int rend_config_service(const struct config_line_t *line_,
const or_options_t *options,
hs_service_config_t *config);
void rend_service_prune_list(void);
@ -218,4 +219,3 @@ int rend_service_reveal_startup_time(const or_options_t *options);
int rend_service_non_anonymous_mode_enabled(const or_options_t *options);
#endif /* !defined(TOR_RENDSERVICE_H) */

View File

@ -9,11 +9,11 @@
#ifndef TOR_REPLAYCACHE_H
#define TOR_REPLAYCACHE_H
typedef struct replaycache_s replaycache_t;
typedef struct replaycache_t replaycache_t;
#ifdef REPLAYCACHE_PRIVATE
struct replaycache_s {
struct replaycache_t {
/* Scrub interval */
time_t scrub_interval;
/* Last scrubbed */
@ -65,4 +65,3 @@ int replaycache_add_test_and_elapsed(
void replaycache_scrub_if_needed(replaycache_t *r);
#endif /* !defined(TOR_REPLAYCACHE_H) */

View File

@ -51,6 +51,8 @@
#include "or/routerinfo_st.h"
#include "lib/osinfo/uname.h"
#include "lib/tls/tortls.h"
#include "lib/encoding/confline.h"
/**
* \file router.c

View File

@ -16,12 +16,14 @@
#include "or/or.h"
#include "or/config.h"
#include "lib/crypt_ops/crypto_util.h"
#include "or/router.h"
#include "lib/crypt_ops/crypto_pwbox.h"
#include "or/routerkeys.h"
#include "or/torcert.h"
#include "lib/crypt_ops/crypto_pwbox.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/term/getpass.h"
#include "lib/tls/tortls.h"
#define ENC_KEY_HEADER "Boxed Ed25519 key"
#define ENC_KEY_TAG "master"

View File

@ -12,6 +12,7 @@
#include "lib/container/buffers.h"
#define TOR_CHANNEL_INTERNAL_
#include "or/channeltls.h"
#include "common/compat_libevent.h"
#include "or/or_connection_st.h"
@ -765,4 +766,3 @@ scheduler_touch_channel(channel_t *chan)
}
#endif /* defined(TOR_UNIT_TESTS) */

View File

@ -42,6 +42,7 @@
#include "or/router.h"
#include "lib/sandbox/sandbox.h"
#include "or/statefile.h"
#include "lib/encoding/confline.h"
/** A list of state-file "abbreviations," for compatibility. */
static config_abbrev_t state_abbrevs_[] = {
@ -708,4 +709,3 @@ or_state_free_all(void)
or_state_free(global_state);
global_state = NULL;
}

View File

@ -20,11 +20,11 @@ void or_state_free_all(void);
void or_state_mark_dirty(or_state_t *state, time_t when);
#ifdef STATEFILE_PRIVATE
STATIC config_line_t *get_transport_in_state_by_name(const char *transport);
STATIC struct config_line_t *get_transport_in_state_by_name(
const char *transport);
STATIC void or_state_free_(or_state_t *state);
#define or_state_free(st) FREE_AND_NULL(or_state_t, or_state_free_, (st))
STATIC or_state_t *or_state_new(void);
#endif
#endif /* !defined(TOR_STATEFILE_H) */

View File

@ -31,6 +31,7 @@
#include "or/dos.h"
#include "or/routerinfo_st.h"
#include "lib/tls/tortls.h"
static void log_accounting(const time_t now, const or_options_t *options);
#include "or/geoip.h"
@ -247,4 +248,3 @@ log_accounting(const time_t now, const or_options_t *options)
tor_free(acc_max);
tor_free(remaining);
}

View File

@ -33,6 +33,7 @@
#include "lib/log/torlog.h"
#include "common/util.h"
#include "trunnel/link_handshake.h"
#include "lib/tls/tortls.h"
#include "or/or_handshake_certs_st.h"
@ -723,4 +724,3 @@ tor_cert_encode_ed22519(const tor_cert_t *cert, char **cert_str_out)
tor_free(ed_cert_b64);
return ret;
}

View File

@ -49,6 +49,8 @@ typedef struct tor_cert_st {
unsigned cert_valid : 1;
} tor_cert_t;
struct tor_tls_t;
tor_cert_t *tor_cert_create(const ed25519_keypair_t *signing_key,
uint8_t cert_type,
const ed25519_public_key_t *signed_key,
@ -90,15 +92,15 @@ void or_handshake_certs_free_(or_handshake_certs_t *certs);
FREE_AND_NULL(or_handshake_certs_t, or_handshake_certs_free_, (certs))
int or_handshake_certs_rsa_ok(int severity,
or_handshake_certs_t *certs,
tor_tls_t *tls,
struct tor_tls_t *tls,
time_t now);
int or_handshake_certs_ed25519_ok(int severity,
or_handshake_certs_t *certs,
tor_tls_t *tls,
struct tor_tls_t *tls,
time_t now);
void or_handshake_certs_check_both(int severity,
or_handshake_certs_t *certs,
tor_tls_t *tls,
struct tor_tls_t *tls,
time_t now,
const ed25519_public_key_t **ed_id_out,
const common_digests_t **rsa_id_out);
@ -106,4 +108,3 @@ void or_handshake_certs_check_both(int severity,
int tor_cert_encode_ed22519(const tor_cert_t *cert, char **cert_str_out);
#endif /* !defined(TORCERT_H_INCLUDED) */

View File

@ -21,10 +21,12 @@
#include "or/config.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "or/onion_ntor.h"
#include "lib/crypt_ops/crypto_ed25519.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/consdiff.h"
#include "lib/compress/compress.h"
#include "or/cell_st.h"
#include "or/or_circuit_st.h"

View File

@ -6,6 +6,7 @@
#include "lib/err/backtrace.h"
#include "or/config.h"
#include "test/fuzz/fuzzing.h"
#include "lib/compress/compress.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_ed25519.h"
@ -189,4 +190,3 @@ main(int argc, char **argv)
}
#endif

View File

@ -9,6 +9,7 @@
**/
#include "orconfig.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_rand.h"
#include <stdio.h>

View File

@ -8,6 +8,8 @@
#include "or/or.h"
#include "lib/container/buffers.h"
#include "lib/tls/buffers_tls.h"
#include "lib/tls/tortls.h"
#include "lib/compress/compress.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/proto_http.h"
#include "or/proto_socks.h"
@ -819,4 +821,3 @@ struct testcase_t buffer_tests[] = {
END_OF_TESTCASES
};

View File

@ -1302,4 +1302,3 @@ struct testcase_t cell_format_tests[] = {
TEST(is_destroy, 0),
END_OF_TESTCASES
};

View File

@ -19,6 +19,7 @@
#include "or/main.h"
#include "or/networkstatus.h"
#include "test/log_test_helpers.h"
#include "lib/tls/tortls.h"
#include "or/cell_st.h"
#include "or/networkstatus_st.h"
@ -1168,4 +1169,3 @@ struct testcase_t channelpadding_tests[] = {
TEST_CHANNELPADDING(channelpadding_timers, TT_FORK),
END_OF_TESTCASES
};

View File

@ -51,6 +51,7 @@
#include "lib/fs/conffile.h"
#include "lib/meminfo/meminfo.h"
#include "lib/net/gethostname.h"
#include "lib/encoding/confline.h"
static void
test_config_addressmap(void *arg)

View File

@ -4,6 +4,7 @@
#include "or/or.h"
#include "or/config.h"
#include "or/conscache.h"
#include "lib/encoding/confline.h"
#include "test/test.h"
#ifdef HAVE_UTIME_H
@ -337,4 +338,3 @@ struct testcase_t conscache_tests[] = {
ENT(filter),
END_OF_TESTCASES
};

View File

@ -13,6 +13,8 @@
#include "or/networkstatus.h"
#include "or/routerparse.h"
#include "common/workqueue.h"
#include "lib/compress/compress.h"
#include "lib/encoding/confline.h"
#include "or/networkstatus_st.h"
@ -896,4 +898,3 @@ struct testcase_t consdiffmgr_tests[] = {
END_OF_TESTCASES
};

View File

@ -12,7 +12,9 @@
#include "common/util.h"
#include "siphash.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_ed25519.h"
#include "lib/crypt_ops/crypto_hkdf.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "ed25519_vectors.inc"

View File

@ -45,6 +45,7 @@
#include "or/relay.h"
#include "test/log_test_helpers.h"
#include "or/voting_schedule.h"
#include "lib/compress/compress.h"
#include "or/authority_cert_st.h"
#include "or/document_signature_st.h"

View File

@ -22,6 +22,8 @@
#include "or/entry_connection_st.h"
#include "or/socks_request_st.h"
#include "lib/encoding/confline.h"
static void *
entryconn_rewrite_setup(const struct testcase_t *tc)
{
@ -833,4 +835,3 @@ struct testcase_t entryconn_tests[] = {
END_OF_TESTCASES
};

View File

@ -44,6 +44,7 @@
#include "test/log_test_helpers.h"
#include "lib/container/bloomfilt.h"
#include "lib/encoding/confline.h"
/* TODO:
* choose_random_entry() test with state set.

View File

@ -23,6 +23,7 @@
#include "or/nodelist.h"
#include "or/relay.h"
#include "or/routerlist.h"
#include "lib/encoding/confline.h"
#include "or/cell_st.h"
#include "or/connection_st.h"
@ -282,4 +283,3 @@ helper_parse_options(const char *conf)
}
return opt;
}

View File

@ -22,12 +22,14 @@
#include "or/config.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "or/channeltls.h"
#include "or/main.h"
#include "or/nodelist.h"
#include "or/routerset.h"
#include "or/hs_circuit.h"
#include "or/hs_circuitmap.h"
#include "or/hs_client.h"
#include "or/hs_ident.h"
#include "or/hs_cache.h"
@ -609,4 +611,3 @@ struct testcase_t hs_client_tests[] = {
TT_FORK, NULL, NULL },
END_OF_TESTCASES
};

View File

@ -45,6 +45,7 @@
#include "or/hs_intropoint.h"
#include "or/hs_ntor.h"
#include "or/hs_circuit.h"
#include "or/hs_circuitmap.h"
#include "or/hs_service.h"
#include "or/hs_client.h"
#include "or/main.h"
@ -1634,4 +1635,3 @@ struct testcase_t hs_service_tests[] = {
END_OF_TESTCASES
};

View File

@ -24,6 +24,8 @@
#include "or/or_handshake_state_st.h"
#include "or/var_cell_st.h"
#include "lib/tls/tortls.h"
#include "test/test.h"
#include "test/log_test_helpers.h"

View File

@ -18,6 +18,7 @@
#include "lib/sandbox/sandbox.h"
#include "lib/memarea/memarea.h"
#include "lib/osinfo/uname.h"
#include "lib/encoding/confline.h"
#include "or/policies.h"
#include "test/test_helpers.h"

View File

@ -8,6 +8,7 @@
#include "or/routerparse.h"
#define POLICIES_PRIVATE
#include "or/policies.h"
#include "lib/encoding/confline.h"
#include "test/test.h"
#include "or/node_st.h"
@ -2450,4 +2451,3 @@ struct testcase_t policy_tests[] = {
test_policies_fascist_firewall_choose_address, 0, NULL, NULL },
END_OF_TESTCASES
};

View File

@ -19,6 +19,7 @@
#include "or/statefile.h"
#include "test/test.h"
#include "lib/process/subprocess.h"
#include "lib/encoding/confline.h"
static void
reset_mp(managed_proxy_t *mp)

View File

@ -39,6 +39,8 @@
#include "or/node_st.h"
#include "or/routerstatus_st.h"
#include "lib/encoding/confline.h"
#include "test/test.h"
#include "test/test_dir_common.h"
#include "test/log_test_helpers.h"
@ -782,4 +784,3 @@ struct testcase_t routerlist_tests[] = {
{ "warn_early_consensus", test_warn_early_consensus, 0, NULL, NULL },
END_OF_TESTCASES
};

View File

@ -24,6 +24,7 @@
#include "or/main.h"
#include "or/nodelist.h"
#include "or/statefile.h"
#include "lib/tls/tortls.h"
#include "or/origin_circuit_st.h"
#include "or/routerinfo_st.h"
@ -1097,4 +1098,3 @@ struct testcase_t status_tests[] = {
TEST_CASE_ASPECT(log_heartbeat, tls_write_overhead),
END_OF_TESTCASES
};

View File

@ -4,6 +4,7 @@
#include "or/or.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/fs/storagedir.h"
#include "lib/encoding/confline.h"
#include "test/test.h"
#ifdef HAVE_UTIME_H
@ -373,4 +374,3 @@ struct testcase_t storagedir_tests[] = {
ENT(read_labeled),
END_OF_TESTCASES
};

View File

@ -22,6 +22,7 @@
#include "lib/memarea/memarea.h"
#include "lib/process/waitpid.h"
#include "test/log_test_helpers.h"
#include "lib/compress/compress.h"
#include "lib/compress/compress_zstd.h"
#include "lib/encoding/keyval.h"
#include "lib/fdio/fdio.h"
@ -35,6 +36,7 @@
#include "lib/math/laplace.h"
#include "lib/meminfo/meminfo.h"
#include "lib/time/tvdiff.h"
#include "lib/encoding/confline.h"
#ifdef HAVE_PWD_H
#include <pwd.h>

View File

@ -13,12 +13,15 @@
#include "or/or.h"
#include "or/control.h"
#include "or/config.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/rephist.h"
#include "lib/err/backtrace.h"
#include "test/test.h"
#include "or/channelpadding.h"
#include "or/main.h"
#include "lib/compress/compress.h"
#include "common/compat_libevent.h"
#include <stdio.h>
#ifdef HAVE_FCNTL_H