mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge branch 'pre_formatter_cleanups_squashed'
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
o Code simplification and refactoring:
|
||||
|
||||
- Add numerous missing dependencies to our include files, so that
|
||||
they can be included in different reasonable orders and still
|
||||
compile. Addresses part of ticket 32764.
|
||||
|
||||
- Fix some small issues in our code that prevented automatic
|
||||
formatting tools from working.
|
||||
Addresses part of ticket 32764.
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef TOR_OR_OPTIONS_ST_H
|
||||
#define TOR_OR_OPTIONS_ST_H
|
||||
|
||||
#include "core/or/or.h"
|
||||
#include "lib/cc/torint.h"
|
||||
#include "lib/net/address.h"
|
||||
#include "app/config/tor_cmdline_mode.h"
|
||||
@@ -20,6 +21,7 @@
|
||||
struct smartlist_t;
|
||||
struct config_line_t;
|
||||
struct config_suite_t;
|
||||
struct routerset_t;
|
||||
|
||||
/** Enumeration of outbound address configuration types:
|
||||
* Exit-only, OR-only, or both */
|
||||
@@ -72,28 +74,29 @@ struct or_options_t {
|
||||
char *Address; /**< OR only: configured address for this onion router. */
|
||||
char *PidFile; /**< Where to store PID of Tor process. */
|
||||
|
||||
routerset_t *ExitNodes; /**< Structure containing nicknames, digests,
|
||||
struct routerset_t *ExitNodes; /**< Structure containing nicknames, digests,
|
||||
* country codes and IP address patterns of ORs to
|
||||
* consider as exits. */
|
||||
routerset_t *MiddleNodes; /**< Structure containing nicknames, digests,
|
||||
* country codes and IP address patterns of ORs to
|
||||
* consider as middles. */
|
||||
routerset_t *EntryNodes;/**< Structure containing nicknames, digests,
|
||||
struct routerset_t *MiddleNodes; /**< Structure containing nicknames,
|
||||
* digests, country codes and IP address patterns
|
||||
* of ORs to consider as middles. */
|
||||
struct routerset_t *EntryNodes;/**< Structure containing nicknames, digests,
|
||||
* country codes and IP address patterns of ORs to
|
||||
* consider as entry points. */
|
||||
int StrictNodes; /**< Boolean: When none of our EntryNodes or ExitNodes
|
||||
* are up, or we need to access a node in ExcludeNodes,
|
||||
* do we just fail instead? */
|
||||
routerset_t *ExcludeNodes;/**< Structure containing nicknames, digests,
|
||||
* country codes and IP address patterns of ORs
|
||||
* not to use in circuits. But see StrictNodes
|
||||
* above. */
|
||||
routerset_t *ExcludeExitNodes;/**< Structure containing nicknames, digests,
|
||||
* country codes and IP address patterns of
|
||||
* ORs not to consider as exits. */
|
||||
struct routerset_t *ExcludeNodes;/**< Structure containing nicknames,
|
||||
* digests, country codes and IP address patterns
|
||||
* of ORs not to use in circuits. But see
|
||||
* StrictNodes above. */
|
||||
struct routerset_t *ExcludeExitNodes;/**< Structure containing nicknames,
|
||||
* digests, country codes and IP address
|
||||
* patterns of ORs not to consider as
|
||||
* exits. */
|
||||
|
||||
/** Union of ExcludeNodes and ExcludeExitNodes */
|
||||
routerset_t *ExcludeExitNodesUnion_;
|
||||
struct routerset_t *ExcludeExitNodesUnion_;
|
||||
|
||||
int DisableAllSwap; /**< Boolean: Attempt to call mlockall() on our
|
||||
* process for all current and future memory. */
|
||||
@@ -280,11 +283,11 @@ struct or_options_t {
|
||||
|
||||
/** A routerset that should be used when picking middle nodes for HS
|
||||
* circuits. */
|
||||
routerset_t *HSLayer2Nodes;
|
||||
struct routerset_t *HSLayer2Nodes;
|
||||
|
||||
/** A routerset that should be used when picking third-hop nodes for HS
|
||||
* circuits. */
|
||||
routerset_t *HSLayer3Nodes;
|
||||
struct routerset_t *HSLayer3Nodes;
|
||||
|
||||
/** Onion Services in HiddenServiceSingleHopMode make one-hop (direct)
|
||||
* circuits between the onion service server, and the introduction and
|
||||
@@ -815,17 +818,17 @@ struct or_options_t {
|
||||
|
||||
/** Relays in a testing network which should be voted Exit
|
||||
* regardless of exit policy. */
|
||||
routerset_t *TestingDirAuthVoteExit;
|
||||
struct routerset_t *TestingDirAuthVoteExit;
|
||||
int TestingDirAuthVoteExitIsStrict;
|
||||
|
||||
/** Relays in a testing network which should be voted Guard
|
||||
* regardless of uptime and bandwidth. */
|
||||
routerset_t *TestingDirAuthVoteGuard;
|
||||
struct routerset_t *TestingDirAuthVoteGuard;
|
||||
int TestingDirAuthVoteGuardIsStrict;
|
||||
|
||||
/** Relays in a testing network which should be voted HSDir
|
||||
* regardless of uptime and DirPort. */
|
||||
routerset_t *TestingDirAuthVoteHSDir;
|
||||
struct routerset_t *TestingDirAuthVoteHSDir;
|
||||
int TestingDirAuthVoteHSDirIsStrict;
|
||||
|
||||
/** Enable CONN_BW events. Only altered on testing networks. */
|
||||
|
||||
@@ -19,7 +19,7 @@ struct curve25519_keypair_t;
|
||||
(DIGEST256_LEN*2 + CIPHER256_KEY_LEN*2)
|
||||
|
||||
/* Key material needed to encode/decode INTRODUCE1 cells */
|
||||
typedef struct {
|
||||
typedef struct hs_ntor_intro_cell_keys_t {
|
||||
/* Key used for encryption of encrypted INTRODUCE1 blob */
|
||||
uint8_t enc_key[CIPHER256_KEY_LEN];
|
||||
/* MAC key used to protect encrypted INTRODUCE1 blob */
|
||||
@@ -27,7 +27,7 @@ typedef struct {
|
||||
} hs_ntor_intro_cell_keys_t;
|
||||
|
||||
/* Key material needed to encode/decode RENDEZVOUS1 cells */
|
||||
typedef struct {
|
||||
typedef struct hs_ntor_rend_cell_keys_t {
|
||||
/* This is the MAC of the HANDSHAKE_INFO field */
|
||||
uint8_t rend_cell_auth_mac[DIGEST256_LEN];
|
||||
/* This is the key seed used to derive further rendezvous crypto keys as
|
||||
|
||||
@@ -16,7 +16,9 @@ lib/net/*.h
|
||||
lib/evloop/*.h
|
||||
lib/geoip/*.h
|
||||
lib/sandbox/*.h
|
||||
lib/smartlist_core/*.h
|
||||
lib/compress/*.h
|
||||
lib/log/*.h
|
||||
|
||||
core/mainloop/*.h
|
||||
core/mainloop/*.inc
|
||||
+110
-82
@@ -12,7 +12,25 @@
|
||||
#ifndef TOR_CONNECTION_H
|
||||
#define TOR_CONNECTION_H
|
||||
|
||||
listener_connection_t *TO_LISTENER_CONN(connection_t *);
|
||||
#include "lib/smartlist_core/smartlist_core.h"
|
||||
#include "lib/log/log.h"
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
struct listener_connection_t;
|
||||
struct connection_t;
|
||||
struct dir_connection_t;
|
||||
struct or_connection_t;
|
||||
struct edge_connection_t;
|
||||
struct entry_connection_t;
|
||||
struct control_connection_t;
|
||||
struct port_cfg_t;
|
||||
struct tor_addr_t;
|
||||
struct or_options_t;
|
||||
|
||||
struct listener_connection_t *TO_LISTENER_CONN(struct connection_t *);
|
||||
|
||||
struct buf_t;
|
||||
|
||||
@@ -56,7 +74,7 @@ struct buf_t;
|
||||
|
||||
#define CONN_TYPE_MAX_ 19
|
||||
/* !!!! If _CONN_TYPE_MAX is ever over 31, we must grow the type field in
|
||||
* connection_t. */
|
||||
* struct connection_t. */
|
||||
|
||||
/* Proxy client handshake states */
|
||||
/* We use a proxy but we haven't even connected to it yet. */
|
||||
@@ -90,34 +108,36 @@ struct buf_t;
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
connection_t *old_conn; /* Old listener connection to be replaced */
|
||||
const port_cfg_t *new_port; /* New port configuration */
|
||||
struct connection_t *old_conn; /* Old listener connection to be replaced */
|
||||
const struct port_cfg_t *new_port; /* New port configuration */
|
||||
} listener_replacement_t;
|
||||
|
||||
const char *conn_type_to_string(int type);
|
||||
const char *conn_state_to_string(int type, int state);
|
||||
int conn_listener_type_supports_af_unix(int type);
|
||||
|
||||
dir_connection_t *dir_connection_new(int socket_family);
|
||||
or_connection_t *or_connection_new(int type, int socket_family);
|
||||
edge_connection_t *edge_connection_new(int type, int socket_family);
|
||||
entry_connection_t *entry_connection_new(int type, int socket_family);
|
||||
control_connection_t *control_connection_new(int socket_family);
|
||||
listener_connection_t *listener_connection_new(int type, int socket_family);
|
||||
connection_t *connection_new(int type, int socket_family);
|
||||
int connection_init_accepted_conn(connection_t *conn,
|
||||
const listener_connection_t *listener);
|
||||
void connection_link_connections(connection_t *conn_a, connection_t *conn_b);
|
||||
MOCK_DECL(void,connection_free_,(connection_t *conn));
|
||||
struct dir_connection_t *dir_connection_new(int socket_family);
|
||||
struct or_connection_t *or_connection_new(int type, int socket_family);
|
||||
struct edge_connection_t *edge_connection_new(int type, int socket_family);
|
||||
struct entry_connection_t *entry_connection_new(int type, int socket_family);
|
||||
struct control_connection_t *control_connection_new(int socket_family);
|
||||
struct listener_connection_t *listener_connection_new(int type,
|
||||
int socket_family);
|
||||
struct connection_t *connection_new(int type, int socket_family);
|
||||
int connection_init_accepted_conn(struct connection_t *conn,
|
||||
const struct listener_connection_t *listener);
|
||||
void connection_link_connections(struct connection_t *conn_a,
|
||||
struct connection_t *conn_b);
|
||||
MOCK_DECL(void,connection_free_,(struct connection_t *conn));
|
||||
#define connection_free(conn) \
|
||||
FREE_AND_NULL(connection_t, connection_free_, (conn))
|
||||
FREE_AND_NULL(struct connection_t, connection_free_, (conn))
|
||||
void connection_free_all(void);
|
||||
void connection_about_to_close_connection(connection_t *conn);
|
||||
void connection_close_immediate(connection_t *conn);
|
||||
void connection_mark_for_close_(connection_t *conn,
|
||||
void connection_about_to_close_connection(struct connection_t *conn);
|
||||
void connection_close_immediate(struct connection_t *conn);
|
||||
void connection_mark_for_close_(struct connection_t *conn,
|
||||
int line, const char *file);
|
||||
MOCK_DECL(void, connection_mark_for_close_internal_,
|
||||
(connection_t *conn, int line, const char *file));
|
||||
(struct connection_t *conn, int line, const char *file));
|
||||
|
||||
#define connection_mark_for_close(c) \
|
||||
connection_mark_for_close_((c), __LINE__, SHORT_FILE__)
|
||||
@@ -132,11 +152,11 @@ MOCK_DECL(void, connection_mark_for_close_internal_,
|
||||
* connection_or_notify_error()), or you actually are the
|
||||
* connection_or_close_for_error() or connection_or_close_normally function.
|
||||
* For all other cases, use connection_mark_and_flush() instead, which
|
||||
* checks for or_connection_t properly, instead. See below.
|
||||
* checks for struct or_connection_t properly, instead. See below.
|
||||
*/
|
||||
#define connection_mark_and_flush_internal_(c,line,file) \
|
||||
do { \
|
||||
connection_t *tmp_conn__ = (c); \
|
||||
struct connection_t *tmp_conn__ = (c); \
|
||||
connection_mark_for_close_internal_(tmp_conn__, (line), (file)); \
|
||||
tmp_conn__->hold_open_until_flushed = 1; \
|
||||
} while (0)
|
||||
@@ -149,7 +169,7 @@ MOCK_DECL(void, connection_mark_for_close_internal_,
|
||||
*/
|
||||
#define connection_mark_and_flush_(c,line,file) \
|
||||
do { \
|
||||
connection_t *tmp_conn_ = (c); \
|
||||
struct connection_t *tmp_conn_ = (c); \
|
||||
if (tmp_conn_->type == CONN_TYPE_OR) { \
|
||||
log_warn(LD_CHANNEL | LD_BUG, \
|
||||
"Something tried to close (and flush) an or_connection_t" \
|
||||
@@ -166,13 +186,13 @@ MOCK_DECL(void, connection_mark_for_close_internal_,
|
||||
|
||||
void connection_expire_held_open(void);
|
||||
|
||||
int connection_connect(connection_t *conn, const char *address,
|
||||
const tor_addr_t *addr,
|
||||
int connection_connect(struct connection_t *conn, const char *address,
|
||||
const struct tor_addr_t *addr,
|
||||
uint16_t port, int *socket_error);
|
||||
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
|
||||
int connection_connect_unix(connection_t *conn, const char *socket_path,
|
||||
int connection_connect_unix(struct connection_t *conn, const char *socket_path,
|
||||
int *socket_error);
|
||||
|
||||
#endif /* defined(HAVE_SYS_UN_H) */
|
||||
@@ -185,78 +205,86 @@ int connection_connect_unix(connection_t *conn, const char *socket_path,
|
||||
username and password fields. */
|
||||
#define MAX_SOCKS5_AUTH_SIZE_TOTAL 2*MAX_SOCKS5_AUTH_FIELD_SIZE
|
||||
|
||||
int connection_proxy_connect(connection_t *conn, int type);
|
||||
int connection_read_proxy_handshake(connection_t *conn);
|
||||
void log_failed_proxy_connection(connection_t *conn);
|
||||
int get_proxy_addrport(tor_addr_t *addr, uint16_t *port, int *proxy_type,
|
||||
int *is_pt_out, const connection_t *conn);
|
||||
int connection_proxy_connect(struct connection_t *conn, int type);
|
||||
int connection_read_proxy_handshake(struct connection_t *conn);
|
||||
void log_failed_proxy_connection(struct connection_t *conn);
|
||||
int get_proxy_addrport(struct tor_addr_t *addr, uint16_t *port,
|
||||
int *proxy_type,
|
||||
int *is_pt_out, const struct connection_t *conn);
|
||||
|
||||
int retry_all_listeners(smartlist_t *new_conns,
|
||||
int retry_all_listeners(struct smartlist_t *new_conns,
|
||||
int close_all_noncontrol);
|
||||
|
||||
void connection_mark_all_noncontrol_listeners(void);
|
||||
void connection_mark_all_noncontrol_connections(void);
|
||||
|
||||
ssize_t connection_bucket_write_limit(connection_t *conn, time_t now);
|
||||
int global_write_bucket_low(connection_t *conn, size_t attempt, int priority);
|
||||
ssize_t connection_bucket_write_limit(struct connection_t *conn, time_t now);
|
||||
int global_write_bucket_low(struct connection_t *conn,
|
||||
size_t attempt, int priority);
|
||||
void connection_bucket_init(void);
|
||||
void connection_bucket_adjust(const or_options_t *options);
|
||||
void connection_bucket_adjust(const struct or_options_t *options);
|
||||
void connection_bucket_refill_all(time_t now,
|
||||
uint32_t now_ts);
|
||||
void connection_read_bw_exhausted(connection_t *conn, bool is_global_bw);
|
||||
void connection_write_bw_exhausted(connection_t *conn, bool is_global_bw);
|
||||
void connection_consider_empty_read_buckets(connection_t *conn);
|
||||
void connection_consider_empty_write_buckets(connection_t *conn);
|
||||
void connection_read_bw_exhausted(struct connection_t *conn,
|
||||
bool is_global_bw);
|
||||
void connection_write_bw_exhausted(struct connection_t *conn,
|
||||
bool is_global_bw);
|
||||
void connection_consider_empty_read_buckets(struct connection_t *conn);
|
||||
void connection_consider_empty_write_buckets(struct connection_t *conn);
|
||||
|
||||
int connection_handle_read(connection_t *conn);
|
||||
int connection_handle_read(struct connection_t *conn);
|
||||
|
||||
int connection_buf_get_bytes(char *string, size_t len, connection_t *conn);
|
||||
int connection_buf_get_line(connection_t *conn, char *data,
|
||||
size_t *data_len);
|
||||
int connection_fetch_from_buf_http(connection_t *conn,
|
||||
int connection_buf_get_bytes(char *string, size_t len,
|
||||
struct connection_t *conn);
|
||||
int connection_buf_get_line(struct connection_t *conn, char *data,
|
||||
size_t *data_len);
|
||||
int connection_fetch_from_buf_http(struct connection_t *conn,
|
||||
char **headers_out, size_t max_headerlen,
|
||||
char **body_out, size_t *body_used,
|
||||
size_t max_bodylen, int force_complete);
|
||||
|
||||
int connection_wants_to_flush(connection_t *conn);
|
||||
int connection_outbuf_too_full(connection_t *conn);
|
||||
int connection_handle_write(connection_t *conn, int force);
|
||||
int connection_flush(connection_t *conn);
|
||||
int connection_wants_to_flush(struct connection_t *conn);
|
||||
int connection_outbuf_too_full(struct connection_t *conn);
|
||||
int connection_handle_write(struct connection_t *conn, int force);
|
||||
int connection_flush(struct connection_t *conn);
|
||||
|
||||
MOCK_DECL(void, connection_write_to_buf_impl_,
|
||||
(const char *string, size_t len, connection_t *conn, int zlib));
|
||||
(const char *string, size_t len, struct connection_t *conn,
|
||||
int zlib));
|
||||
/* DOCDOC connection_write_to_buf */
|
||||
static void connection_buf_add(const char *string, size_t len,
|
||||
connection_t *conn);
|
||||
struct connection_t *conn);
|
||||
void connection_dir_buf_add(const char *string, size_t len,
|
||||
dir_connection_t *dir_conn, int done);
|
||||
struct dir_connection_t *dir_conn, int done);
|
||||
static inline void
|
||||
connection_buf_add(const char *string, size_t len, connection_t *conn)
|
||||
connection_buf_add(const char *string, size_t len, struct connection_t *conn)
|
||||
{
|
||||
connection_write_to_buf_impl_(string, len, conn, 0);
|
||||
}
|
||||
void connection_buf_add_compress(const char *string, size_t len,
|
||||
dir_connection_t *conn, int done);
|
||||
void connection_buf_add_buf(connection_t *conn, struct buf_t *buf);
|
||||
struct dir_connection_t *conn, int done);
|
||||
void connection_buf_add_buf(struct connection_t *conn, struct buf_t *buf);
|
||||
|
||||
size_t connection_get_inbuf_len(connection_t *conn);
|
||||
size_t connection_get_outbuf_len(connection_t *conn);
|
||||
connection_t *connection_get_by_global_id(uint64_t id);
|
||||
size_t connection_get_inbuf_len(struct connection_t *conn);
|
||||
size_t connection_get_outbuf_len(struct connection_t *conn);
|
||||
struct connection_t *connection_get_by_global_id(uint64_t id);
|
||||
|
||||
connection_t *connection_get_by_type(int type);
|
||||
MOCK_DECL(connection_t *,connection_get_by_type_nonlinked,(int type));
|
||||
MOCK_DECL(connection_t *,connection_get_by_type_addr_port_purpose,(int type,
|
||||
const tor_addr_t *addr,
|
||||
uint16_t port, int purpose));
|
||||
connection_t *connection_get_by_type_state(int type, int state);
|
||||
connection_t *connection_get_by_type_state_rendquery(int type, int state,
|
||||
struct connection_t *connection_get_by_type(int type);
|
||||
MOCK_DECL(struct connection_t *,connection_get_by_type_nonlinked,(int type));
|
||||
MOCK_DECL(struct connection_t *,connection_get_by_type_addr_port_purpose,
|
||||
(int type,
|
||||
const struct tor_addr_t *addr,
|
||||
uint16_t port, int purpose));
|
||||
struct connection_t *connection_get_by_type_state(int type, int state);
|
||||
struct connection_t *connection_get_by_type_state_rendquery(
|
||||
int type, int state,
|
||||
const char *rendquery);
|
||||
smartlist_t *connection_list_by_type_state(int type, int state);
|
||||
smartlist_t *connection_list_by_type_purpose(int type, int purpose);
|
||||
smartlist_t *connection_dir_list_by_purpose_and_resource(
|
||||
struct smartlist_t *connection_list_by_type_state(int type, int state);
|
||||
struct smartlist_t *connection_list_by_type_purpose(int type, int purpose);
|
||||
struct smartlist_t *connection_dir_list_by_purpose_and_resource(
|
||||
int purpose,
|
||||
const char *resource);
|
||||
smartlist_t *connection_dir_list_by_purpose_resource_and_state(
|
||||
struct smartlist_t *connection_dir_list_by_purpose_resource_and_state(
|
||||
int purpose,
|
||||
const char *resource,
|
||||
int state);
|
||||
@@ -275,7 +303,7 @@ connection_dir_count_by_purpose_and_resource(
|
||||
int purpose,
|
||||
const char *resource)
|
||||
{
|
||||
smartlist_t *conns = connection_dir_list_by_purpose_and_resource(
|
||||
struct smartlist_t *conns = connection_dir_list_by_purpose_and_resource(
|
||||
purpose,
|
||||
resource);
|
||||
CONN_LEN_AND_FREE_TEMPLATE(conns);
|
||||
@@ -289,7 +317,7 @@ connection_dir_count_by_purpose_resource_and_state(
|
||||
const char *resource,
|
||||
int state)
|
||||
{
|
||||
smartlist_t *conns =
|
||||
struct smartlist_t *conns =
|
||||
connection_dir_list_by_purpose_resource_and_state(
|
||||
purpose,
|
||||
resource,
|
||||
@@ -299,26 +327,26 @@ connection_dir_count_by_purpose_resource_and_state(
|
||||
|
||||
#undef CONN_LEN_AND_FREE_TEMPLATE
|
||||
|
||||
int any_other_active_or_conns(const or_connection_t *this_conn);
|
||||
int any_other_active_or_conns(const struct or_connection_t *this_conn);
|
||||
|
||||
/* || 0 is for -Wparentheses-equality (-Wall?) appeasement under clang */
|
||||
#define connection_speaks_cells(conn) (((conn)->type == CONN_TYPE_OR) || 0)
|
||||
int connection_is_listener(connection_t *conn);
|
||||
int connection_state_is_open(connection_t *conn);
|
||||
int connection_state_is_connecting(connection_t *conn);
|
||||
int connection_is_listener(struct connection_t *conn);
|
||||
int connection_state_is_open(struct connection_t *conn);
|
||||
int connection_state_is_connecting(struct connection_t *conn);
|
||||
|
||||
char *alloc_http_authenticator(const char *authenticator);
|
||||
|
||||
void assert_connection_ok(connection_t *conn, time_t now);
|
||||
int connection_or_nonopen_was_started_here(or_connection_t *conn);
|
||||
void assert_connection_ok(struct connection_t *conn, time_t now);
|
||||
int connection_or_nonopen_was_started_here(struct or_connection_t *conn);
|
||||
void connection_dump_buffer_mem_stats(int severity);
|
||||
|
||||
MOCK_DECL(void, clock_skew_warning,
|
||||
(const connection_t *conn, long apparent_skew, int trusted,
|
||||
(const struct connection_t *conn, long apparent_skew, int trusted,
|
||||
log_domain_mask_t domain, const char *received,
|
||||
const char *source));
|
||||
|
||||
int connection_is_moribund(connection_t *conn);
|
||||
int connection_is_moribund(struct connection_t *conn);
|
||||
void connection_check_oos(int n_socks, int failed);
|
||||
|
||||
/** Execute the statement <b>stmt</b>, which may log events concerning the
|
||||
@@ -340,18 +368,18 @@ void connection_check_oos(int n_socks, int failed);
|
||||
STMT_END
|
||||
|
||||
#ifdef CONNECTION_PRIVATE
|
||||
STATIC void connection_free_minimal(connection_t *conn);
|
||||
STATIC void connection_free_minimal(struct connection_t *conn);
|
||||
|
||||
/* Used only by connection.c and test*.c */
|
||||
MOCK_DECL(STATIC int,connection_connect_sockaddr,
|
||||
(connection_t *conn,
|
||||
(struct connection_t *conn,
|
||||
const struct sockaddr *sa,
|
||||
socklen_t sa_len,
|
||||
const struct sockaddr *bindaddr,
|
||||
socklen_t bindaddr_len,
|
||||
int *socket_error));
|
||||
MOCK_DECL(STATIC void, kill_conn_list_for_oos, (smartlist_t *conns));
|
||||
MOCK_DECL(STATIC smartlist_t *, pick_oos_victims, (int n));
|
||||
MOCK_DECL(STATIC void, kill_conn_list_for_oos, (struct smartlist_t *conns));
|
||||
MOCK_DECL(STATIC struct smartlist_t *, pick_oos_victims, (int n));
|
||||
|
||||
#endif /* defined(CONNECTION_PRIVATE) */
|
||||
|
||||
|
||||
@@ -35,4 +35,6 @@ trunnel/*.h
|
||||
core/mainloop/*.h
|
||||
core/proto/*.h
|
||||
core/crypto/*.h
|
||||
core/or/*.h
|
||||
core/or/*.h
|
||||
|
||||
ext/*.h
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "lib/container/handles.h"
|
||||
#include "lib/crypt_ops/crypto_ed25519.h"
|
||||
|
||||
#include "ext/ht.h"
|
||||
#include "tor_queue.h"
|
||||
|
||||
#define tor_timer_t timeout
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "lib/container/handles.h"
|
||||
|
||||
#include "core/or/cell_queue_st.h"
|
||||
#include "ext/ht.h"
|
||||
|
||||
struct hs_token_t;
|
||||
struct circpad_machine_spec_t;
|
||||
|
||||
@@ -138,6 +138,8 @@ MOCK_DECL(void, scheduler_channel_has_waiting_cells, (channel_t *chan));
|
||||
*****************************************************************************/
|
||||
#ifdef SCHEDULER_PRIVATE
|
||||
|
||||
#include "ext/ht.h"
|
||||
|
||||
/*********************************
|
||||
* Defined in scheduler.c
|
||||
*********************************/
|
||||
@@ -215,4 +217,3 @@ scheduler_t *get_vanilla_scheduler(void);
|
||||
#endif /* defined(SCHEDULER_PRIVATE) */
|
||||
|
||||
#endif /* !defined(TOR_SCHEDULER_H) */
|
||||
|
||||
|
||||
+2
-1
@@ -226,7 +226,8 @@ ht_string_hash(const char *s)
|
||||
(x) = HT_NEXT(name, head, x))
|
||||
|
||||
#ifndef HT_NDEBUG
|
||||
#define HT_ASSERT_(x) tor_assert(x)
|
||||
#include "lib/err/torerr.h"
|
||||
#define HT_ASSERT_(x) raw_assert(x)
|
||||
#else
|
||||
#define HT_ASSERT_(x) (void)0
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef SIPHASH_H
|
||||
#define SIPHASH_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct sipkey {
|
||||
uint64_t k0;
|
||||
uint64_t k1;
|
||||
|
||||
@@ -99,11 +99,11 @@
|
||||
|
||||
/* Assert b, but do not stop the test if b fails. Log msg on failure. */
|
||||
#define tt_want_msg(b, msg) \
|
||||
tt_want_(b, msg, );
|
||||
tt_want_(b, msg, )
|
||||
|
||||
/* Assert b and stop the test if b fails. Log msg on failure. */
|
||||
#define tt_assert_msg(b, msg) \
|
||||
tt_want_(b, msg, TT_EXIT_TEST_FUNCTION);
|
||||
tt_want_(b, msg, TT_EXIT_TEST_FUNCTION)
|
||||
|
||||
/* Assert b, but do not stop the test if b fails. */
|
||||
#define tt_want(b) tt_want_msg( (b), "want("#b")")
|
||||
|
||||
@@ -11,23 +11,24 @@
|
||||
#ifndef TOR_CONTROL_HS_H
|
||||
#define TOR_CONTROL_HS_H
|
||||
|
||||
struct control_connection_t;
|
||||
struct control_cmd_syntax_t;
|
||||
struct control_cmd_args_t;
|
||||
|
||||
extern const struct control_cmd_syntax_t onion_client_auth_add_syntax;
|
||||
extern const struct control_cmd_syntax_t onion_client_auth_remove_syntax;
|
||||
extern const struct control_cmd_syntax_t onion_client_auth_view_syntax;
|
||||
|
||||
int
|
||||
handle_control_onion_client_auth_add(control_connection_t *conn,
|
||||
const control_cmd_args_t *args);
|
||||
handle_control_onion_client_auth_add(struct control_connection_t *conn,
|
||||
const struct control_cmd_args_t *args);
|
||||
|
||||
int
|
||||
handle_control_onion_client_auth_remove(control_connection_t *conn,
|
||||
const control_cmd_args_t *args);
|
||||
handle_control_onion_client_auth_remove(struct control_connection_t *conn,
|
||||
const struct control_cmd_args_t *args);
|
||||
|
||||
int
|
||||
handle_control_onion_client_auth_view(control_connection_t *conn,
|
||||
const control_cmd_args_t *args);
|
||||
handle_control_onion_client_auth_view(struct control_connection_t *conn,
|
||||
const struct control_cmd_args_t *args);
|
||||
|
||||
#endif /* !defined(TOR_CONTROL_HS_H) */
|
||||
|
||||
|
||||
@@ -26,6 +26,15 @@ authdir_mode(const or_options_t *options)
|
||||
{
|
||||
return options->AuthoritativeDir != 0;
|
||||
}
|
||||
|
||||
/* Return true iff we believe ourselves to be a v3 authoritative directory
|
||||
* server. */
|
||||
int
|
||||
authdir_mode_v3(const or_options_t *options)
|
||||
{
|
||||
return authdir_mode(options) && options->V3AuthoritativeDir != 0;
|
||||
}
|
||||
|
||||
/** Return true iff we are an authoritative directory server that is
|
||||
* authoritative about receiving and serving descriptors of type
|
||||
* <b>purpose</b> on its dirport.
|
||||
|
||||
@@ -14,19 +14,12 @@
|
||||
#ifdef HAVE_MODULE_DIRAUTH
|
||||
|
||||
int authdir_mode(const or_options_t *options);
|
||||
int authdir_mode_v3(const or_options_t *options);
|
||||
int authdir_mode_handles_descs(const or_options_t *options, int purpose);
|
||||
int authdir_mode_publishes_statuses(const or_options_t *options);
|
||||
int authdir_mode_tests_reachability(const or_options_t *options);
|
||||
int authdir_mode_bridge(const or_options_t *options);
|
||||
|
||||
/* Return true iff we believe ourselves to be a v3 authoritative directory
|
||||
* server. */
|
||||
static inline int
|
||||
authdir_mode_v3(const or_options_t *options)
|
||||
{
|
||||
return authdir_mode(options) && options->V3AuthoritativeDir != 0;
|
||||
}
|
||||
|
||||
/* Is the dirauth module enabled? */
|
||||
#define have_module_dirauth() (1)
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ int keypin_check_lone_rsa(const uint8_t *rsa_id_digest);
|
||||
|
||||
#ifdef KEYPIN_PRIVATE
|
||||
|
||||
#include "ext/ht.h"
|
||||
|
||||
/**
|
||||
* In-memory representation of a key-pinning table entry.
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
typedef struct consensus_cache_entry_t consensus_cache_entry_t;
|
||||
typedef struct consensus_cache_t consensus_cache_t;
|
||||
|
||||
struct config_line_t;
|
||||
|
||||
HANDLE_DECL(consensus_cache_entry, consensus_cache_entry_t, )
|
||||
#define consensus_cache_entry_handle_free(h) \
|
||||
FREE_AND_NULL(consensus_cache_entry_handle_t, \
|
||||
|
||||
@@ -66,17 +66,19 @@ void consdiffmgr_free_all(void);
|
||||
int consdiffmgr_validate(void);
|
||||
|
||||
#ifdef CONSDIFFMGR_PRIVATE
|
||||
struct consensus_cache_t;
|
||||
struct consensus_cache_entry_t;
|
||||
STATIC unsigned n_diff_compression_methods(void);
|
||||
STATIC unsigned n_consensus_compression_methods(void);
|
||||
STATIC consensus_cache_t *cdm_cache_get(void);
|
||||
STATIC consensus_cache_entry_t *cdm_cache_lookup_consensus(
|
||||
STATIC struct consensus_cache_t *cdm_cache_get(void);
|
||||
STATIC struct consensus_cache_entry_t *cdm_cache_lookup_consensus(
|
||||
consensus_flavor_t flavor, time_t valid_after);
|
||||
STATIC int cdm_entry_get_sha3_value(uint8_t *digest_out,
|
||||
consensus_cache_entry_t *ent,
|
||||
struct consensus_cache_entry_t *ent,
|
||||
const char *label);
|
||||
STATIC int uncompress_or_set_ptr(const char **out, size_t *outlen,
|
||||
char **owned_out,
|
||||
consensus_cache_entry_t *ent);
|
||||
struct consensus_cache_entry_t *ent);
|
||||
#endif /* defined(CONSDIFFMGR_PRIVATE) */
|
||||
|
||||
#ifdef TOR_UNIT_TESTS
|
||||
|
||||
@@ -41,6 +41,7 @@ void routerparse_init(void);
|
||||
void routerparse_free_all(void);
|
||||
|
||||
#ifdef ROUTERDESC_TOKEN_TABLE_PRIVATE
|
||||
#include "feature/dirparse/parsecommon.h"
|
||||
extern const struct token_rule_t routerdesc_token_table[];
|
||||
#endif
|
||||
|
||||
|
||||
@@ -70,13 +70,14 @@ bool hs_circ_is_rend_sent_in_intro1(const origin_circuit_t *circ);
|
||||
|
||||
#ifdef HS_CIRCUIT_PRIVATE
|
||||
|
||||
struct hs_ntor_rend_cell_keys_t;
|
||||
|
||||
STATIC hs_ident_circuit_t *
|
||||
create_rp_circuit_identifier(const hs_service_t *service,
|
||||
const uint8_t *rendezvous_cookie,
|
||||
const curve25519_public_key_t *server_pk,
|
||||
const hs_ntor_rend_cell_keys_t *keys);
|
||||
const struct hs_ntor_rend_cell_keys_t *keys);
|
||||
|
||||
#endif /* defined(HS_CIRCUIT_PRIVATE) */
|
||||
|
||||
#endif /* !defined(TOR_HS_CIRCUIT_H) */
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ typedef HT_HEAD(hs_circuitmap_ht, circuit_t) hs_circuitmap_ht;
|
||||
typedef struct hs_token_t hs_token_t;
|
||||
struct or_circuit_t;
|
||||
struct origin_circuit_t;
|
||||
struct ed25519_public_key_t;
|
||||
|
||||
/** Public HS circuitmap API: */
|
||||
|
||||
@@ -21,7 +22,7 @@ struct origin_circuit_t;
|
||||
|
||||
struct or_circuit_t *
|
||||
hs_circuitmap_get_intro_circ_v3_relay_side(const
|
||||
ed25519_public_key_t *auth_key);
|
||||
struct ed25519_public_key_t *auth_key);
|
||||
struct or_circuit_t *
|
||||
hs_circuitmap_get_intro_circ_v2_relay_side(const uint8_t *digest);
|
||||
struct or_circuit_t *
|
||||
@@ -32,7 +33,7 @@ void hs_circuitmap_register_rend_circ_relay_side(struct or_circuit_t *circ,
|
||||
void hs_circuitmap_register_intro_circ_v2_relay_side(struct or_circuit_t *circ,
|
||||
const uint8_t *digest);
|
||||
void hs_circuitmap_register_intro_circ_v3_relay_side(struct or_circuit_t *circ,
|
||||
const ed25519_public_key_t *auth_key);
|
||||
const struct ed25519_public_key_t *auth_key);
|
||||
|
||||
smartlist_t *hs_circuitmap_get_all_intro_circ_relay_side(void);
|
||||
|
||||
@@ -40,7 +41,7 @@ smartlist_t *hs_circuitmap_get_all_intro_circ_relay_side(void);
|
||||
|
||||
struct origin_circuit_t *
|
||||
hs_circuitmap_get_intro_circ_v3_service_side(const
|
||||
ed25519_public_key_t *auth_key);
|
||||
struct ed25519_public_key_t *auth_key);
|
||||
struct origin_circuit_t *
|
||||
hs_circuitmap_get_intro_circ_v2_service_side(const uint8_t *digest);
|
||||
struct origin_circuit_t *
|
||||
@@ -54,8 +55,8 @@ void hs_circuitmap_register_intro_circ_v2_service_side(
|
||||
struct origin_circuit_t *circ,
|
||||
const uint8_t *digest);
|
||||
void hs_circuitmap_register_intro_circ_v3_service_side(
|
||||
struct origin_circuit_t *circ,
|
||||
const ed25519_public_key_t *auth_key);
|
||||
struct origin_circuit_t *circ,
|
||||
const struct ed25519_public_key_t *auth_key);
|
||||
void hs_circuitmap_register_rend_circ_service_side(
|
||||
struct origin_circuit_t *circ,
|
||||
const uint8_t *cookie);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
/* Trunnel */
|
||||
#include "trunnel/hs/cell_establish_intro.h"
|
||||
|
||||
#include "ext/ht.h"
|
||||
|
||||
/** When loading and configuring a service, this is the default version it will
|
||||
* be configured for as it is possible that no HiddenServiceVersion is
|
||||
* present. */
|
||||
|
||||
@@ -17,6 +17,8 @@ struct ed25519_public_key_t;
|
||||
struct nodefamily_t;
|
||||
struct short_policy_t;
|
||||
|
||||
#include "ext/ht.h"
|
||||
|
||||
/** A microdescriptor is the smallest amount of information needed to build a
|
||||
* circuit through a router. They are generated by the directory authorities,
|
||||
* using information from the uploaded routerinfo documents. They are not
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "feature/hs/hsdir_index_st.h"
|
||||
#include "lib/crypt_ops/crypto_ed25519.h"
|
||||
#include "ext/ht.h"
|
||||
|
||||
/** A node_t represents a Tor router.
|
||||
*
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#ifndef TOR_DNS_STRUCTS_H
|
||||
#define TOR_DNS_STRUCTS_H
|
||||
|
||||
#include "ext/ht.h"
|
||||
|
||||
/** Longest hostname we're willing to resolve. */
|
||||
#define MAX_ADDRESSLEN 256
|
||||
|
||||
@@ -99,4 +101,3 @@ typedef struct cached_resolve_t {
|
||||
} cached_resolve_t;
|
||||
|
||||
#endif /* !defined(TOR_DNS_STRUCTS_H) */
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define TOR_GEOIP_STATS_H
|
||||
|
||||
#include "core/or/dos.h"
|
||||
#include "ext/ht.h"
|
||||
|
||||
/** Indicates an action that we might be noting geoip statistics on.
|
||||
* Note that if we're noticing CONNECT, we're a bridge, and if we're noticing
|
||||
|
||||
@@ -59,8 +59,6 @@
|
||||
|
||||
/* Temporarily enable and disable warnings. */
|
||||
#ifdef __GNUC__
|
||||
# define PRAGMA_STRINGIFY_(s) #s
|
||||
# define PRAGMA_JOIN_STRINGIFY_(a,b) PRAGMA_STRINGIFY_(a ## b)
|
||||
/* Support for macro-generated pragmas (c99) */
|
||||
# define PRAGMA_(x) _Pragma (#x)
|
||||
# ifdef __clang__
|
||||
@@ -72,15 +70,15 @@
|
||||
/* we have push/pop support */
|
||||
# define DISABLE_GCC_WARNING(warningopt) \
|
||||
PRAGMA_DIAGNOSTIC_(push) \
|
||||
PRAGMA_DIAGNOSTIC_(ignored PRAGMA_JOIN_STRINGIFY_(-W,warningopt))
|
||||
PRAGMA_DIAGNOSTIC_(ignored warningopt)
|
||||
# define ENABLE_GCC_WARNING(warningopt) \
|
||||
PRAGMA_DIAGNOSTIC_(pop)
|
||||
#else /* !(defined(__clang__) || GCC_VERSION >= 406) */
|
||||
/* older version of gcc: no push/pop support. */
|
||||
# define DISABLE_GCC_WARNING(warningopt) \
|
||||
PRAGMA_DIAGNOSTIC_(ignored PRAGMA_JOIN_STRINGIFY_(-W,warningopt))
|
||||
PRAGMA_DIAGNOSTIC_(ignored warningopt)
|
||||
# define ENABLE_GCC_WARNING(warningopt) \
|
||||
PRAGMA_DIAGNOSTIC_(warning PRAGMA_JOIN_STRINGIFY_(-W,warningopt))
|
||||
PRAGMA_DIAGNOSTIC_(warning warningopt)
|
||||
#endif /* defined(__clang__) || GCC_VERSION >= 406 */
|
||||
#else /* !defined(__GNUC__) */
|
||||
/* not gcc at all */
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
|
||||
#ifdef HAVE_ZSTD
|
||||
#ifdef HAVE_CFLAG_WUNUSED_CONST_VARIABLE
|
||||
DISABLE_GCC_WARNING(unused-const-variable)
|
||||
DISABLE_GCC_WARNING("-Wunused-const-variable")
|
||||
#endif
|
||||
#include <zstd.h>
|
||||
#ifdef HAVE_CFLAG_WUNUSED_CONST_VARIABLE
|
||||
ENABLE_GCC_WARNING(unused-const-variable)
|
||||
ENABLE_GCC_WARNING("-Wunused-const-variable")
|
||||
#endif
|
||||
#endif /* defined(HAVE_ZSTD) */
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#ifndef TOR_LIB_CONF_CONFTESTING_H
|
||||
#define TOR_LIB_CONF_CONFTESTING_H
|
||||
|
||||
#include "lib/cc/torint.h"
|
||||
|
||||
#ifndef COCCI
|
||||
#ifdef TOR_UNIT_TESTS
|
||||
#define USE_CONF_TESTING
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include "lib/crypt_ops/crypto_util.h"
|
||||
#include "lib/log/util_bug.h"
|
||||
|
||||
DISABLE_GCC_WARNING(strict-prototypes)
|
||||
DISABLE_GCC_WARNING("-Wstrict-prototypes")
|
||||
#include <pk11pub.h>
|
||||
#include <secerr.h>
|
||||
ENABLE_GCC_WARNING(strict-prototypes)
|
||||
ENABLE_GCC_WARNING("-Wstrict-prototypes")
|
||||
|
||||
aes_cnt_cipher_t *
|
||||
aes_new_cipher(const uint8_t *key, const uint8_t *iv,
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#error "We require OpenSSL >= 1.0.0"
|
||||
#endif
|
||||
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -37,7 +37,7 @@ DISABLE_GCC_WARNING(redundant-decls)
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/modes.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include "lib/log/log.h"
|
||||
#include "lib/ctime/di_ops.h"
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
#include "lib/log/log.h"
|
||||
#include "lib/log/util_bug.h"
|
||||
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/dh.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
#include "lib/arch/bytes.h"
|
||||
|
||||
DISABLE_GCC_WARNING(strict-prototypes)
|
||||
DISABLE_GCC_WARNING("-Wstrict-prototypes")
|
||||
#include <pk11pub.h>
|
||||
ENABLE_GCC_WARNING(strict-prototypes)
|
||||
ENABLE_GCC_WARNING("-Wstrict-prototypes")
|
||||
|
||||
/**
|
||||
* Convert a digest_algorithm_t (used by tor) to a HashType (used by NSS).
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
|
||||
#include "lib/crypt_ops/crypto_openssl_mgt.h"
|
||||
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
/* Crypto digest functions */
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "lib/log/util_bug.h"
|
||||
#include "lib/string/printf.h"
|
||||
|
||||
DISABLE_GCC_WARNING(strict-prototypes)
|
||||
DISABLE_GCC_WARNING("-Wstrict-prototypes")
|
||||
#include <nss.h>
|
||||
#include <pk11func.h>
|
||||
#include <ssl.h>
|
||||
@@ -24,7 +24,7 @@ DISABLE_GCC_WARNING(strict-prototypes)
|
||||
#include <prerror.h>
|
||||
#include <prtypes.h>
|
||||
#include <prinit.h>
|
||||
ENABLE_GCC_WARNING(strict-prototypes)
|
||||
ENABLE_GCC_WARNING("-Wstrict-prototypes")
|
||||
|
||||
const char *
|
||||
crypto_nss_get_version_str(void)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "lib/testsupport/testsupport.h"
|
||||
#include "lib/thread/threads.h"
|
||||
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rsa.h>
|
||||
@@ -36,7 +36,7 @@ DISABLE_GCC_WARNING(redundant-decls)
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_OPENSSL
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/sha.h>
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
#endif /* defined(ENABLE_OPENSSL) */
|
||||
|
||||
#ifdef ENABLE_NSS
|
||||
|
||||
@@ -645,7 +645,7 @@ crypto_pk_asn1_decode(const char *str, size_t len)
|
||||
return result;
|
||||
}
|
||||
|
||||
DISABLE_GCC_WARNING(unused-parameter)
|
||||
DISABLE_GCC_WARNING("-Wunused-parameter")
|
||||
|
||||
/** Given a crypto_pk_t <b>pk</b>, allocate a new buffer containing the Base64
|
||||
* encoding of the DER representation of the private key into the
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "lib/log/util_bug.h"
|
||||
#include "lib/fs/files.h"
|
||||
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rsa.h>
|
||||
@@ -27,7 +27,7 @@ DISABLE_GCC_WARNING(redundant-decls)
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/conf.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include "lib/log/log.h"
|
||||
#include "lib/encoding/binascii.h"
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef ENABLE_OPENSSL
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/crypto.h>
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
#endif /* defined(ENABLE_OPENSSL) */
|
||||
|
||||
#include "lib/log/log.h"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "lib/testsupport/testsupport.h"
|
||||
|
||||
struct monotime_t;
|
||||
struct timeval;
|
||||
typedef struct timeout tor_timer_t;
|
||||
typedef void (*timer_cb_fn_t)(tor_timer_t *, void *,
|
||||
const struct monotime_t *);
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#define TOR_FDIO_H
|
||||
|
||||
#include <stddef.h>
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
off_t tor_fd_getpos(int fd);
|
||||
int tor_fd_setpos(int fd, off_t pos);
|
||||
|
||||
+8
-8
@@ -74,7 +74,7 @@ clamp_double_to_int64(double number)
|
||||
branches that are not taken.
|
||||
*/
|
||||
#define PROBLEMATIC_FLOAT_CONVERSION_WARNING
|
||||
DISABLE_GCC_WARNING(float-conversion)
|
||||
DISABLE_GCC_WARNING("-Wfloat-conversion")
|
||||
#endif /* (defined(MINGW_ANY)||defined(__FreeBSD__)) && GCC_VERSION >= 409 */
|
||||
|
||||
/*
|
||||
@@ -84,7 +84,7 @@ DISABLE_GCC_WARNING(float-conversion)
|
||||
#if defined(__clang__)
|
||||
#if __has_warning("-Wdouble-promotion")
|
||||
#define PROBLEMATIC_DOUBLE_PROMOTION_WARNING
|
||||
DISABLE_GCC_WARNING(double-promotion)
|
||||
DISABLE_GCC_WARNING("-Wdouble-promotion")
|
||||
#endif
|
||||
#endif /* defined(__clang__) */
|
||||
|
||||
@@ -115,10 +115,10 @@ DISABLE_GCC_WARNING(double-promotion)
|
||||
return signbit(number) ? INT64_MIN : INT64_MAX;
|
||||
|
||||
#ifdef PROBLEMATIC_DOUBLE_PROMOTION_WARNING
|
||||
ENABLE_GCC_WARNING(double-promotion)
|
||||
ENABLE_GCC_WARNING("-Wdouble-promotion")
|
||||
#endif
|
||||
#ifdef PROBLEMATIC_FLOAT_CONVERSION_WARNING
|
||||
ENABLE_GCC_WARNING(float-conversion)
|
||||
ENABLE_GCC_WARNING("-Wfloat-conversion")
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -128,16 +128,16 @@ tor_isinf(double x)
|
||||
{
|
||||
/* Same as above, work around the "double promotion" warnings */
|
||||
#ifdef PROBLEMATIC_FLOAT_CONVERSION_WARNING
|
||||
DISABLE_GCC_WARNING(float-conversion)
|
||||
DISABLE_GCC_WARNING("-Wfloat-conversion")
|
||||
#endif
|
||||
#ifdef PROBLEMATIC_DOUBLE_PROMOTION_WARNING
|
||||
DISABLE_GCC_WARNING(double-promotion)
|
||||
DISABLE_GCC_WARNING("-Wdouble-promotion")
|
||||
#endif
|
||||
return isinf(x);
|
||||
#ifdef PROBLEMATIC_DOUBLE_PROMOTION_WARNING
|
||||
ENABLE_GCC_WARNING(double-promotion)
|
||||
ENABLE_GCC_WARNING("-Wdouble-promotion")
|
||||
#endif
|
||||
#ifdef PROBLEMATIC_FLOAT_CONVERSION_WARNING
|
||||
ENABLE_GCC_WARNING(float-conversion)
|
||||
ENABLE_GCC_WARNING("-Wfloat-conversion")
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
DISABLE_GCC_WARNING(aggregate-return)
|
||||
DISABLE_GCC_WARNING("-Waggregate-return")
|
||||
/** Call the platform malloc info function, and dump the results to the log at
|
||||
* level <b>severity</b>. If no such function exists, do nothing. */
|
||||
void
|
||||
@@ -58,7 +58,7 @@ tor_log_mallinfo(int severity)
|
||||
(void)severity;
|
||||
#endif /* defined(HAVE_MALLINFO) */
|
||||
}
|
||||
ENABLE_GCC_WARNING(aggregate-return)
|
||||
ENABLE_GCC_WARNING("-Waggregate-return")
|
||||
|
||||
#if defined(HW_PHYSMEM64)
|
||||
/* OpenBSD and NetBSD define this */
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "lib/malloc/malloc.h"
|
||||
#include "lib/string/printf.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/** Maximum number of bytes to write to a process' stdin. */
|
||||
#define PROCESS_MAX_WRITE (1024)
|
||||
|
||||
@@ -127,18 +129,19 @@ void process_notify_event_exit(process_t *process,
|
||||
process_exit_code_t);
|
||||
|
||||
#ifdef PROCESS_PRIVATE
|
||||
MOCK_DECL(STATIC int, process_read_stdout, (process_t *, buf_t *));
|
||||
MOCK_DECL(STATIC int, process_read_stderr, (process_t *, buf_t *));
|
||||
MOCK_DECL(STATIC void, process_write_stdin, (process_t *, buf_t *));
|
||||
struct buf_t;
|
||||
MOCK_DECL(STATIC int, process_read_stdout, (process_t *, struct buf_t *));
|
||||
MOCK_DECL(STATIC int, process_read_stderr, (process_t *, struct buf_t *));
|
||||
MOCK_DECL(STATIC void, process_write_stdin, (process_t *, struct buf_t *));
|
||||
|
||||
STATIC void process_read_data(process_t *process,
|
||||
buf_t *buffer,
|
||||
struct buf_t *buffer,
|
||||
process_read_callback_t callback);
|
||||
STATIC void process_read_buffer(process_t *process,
|
||||
buf_t *buffer,
|
||||
struct buf_t *buffer,
|
||||
process_read_callback_t callback);
|
||||
STATIC void process_read_lines(process_t *process,
|
||||
buf_t *buffer,
|
||||
struct buf_t *buffer,
|
||||
process_read_callback_t callback);
|
||||
#endif /* defined(PROCESS_PRIVATE) */
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#ifndef TORTLS_INTERNAL_H
|
||||
#define TORTLS_INTERNAL_H
|
||||
|
||||
#include "lib/tls/x509.h"
|
||||
|
||||
int tor_errno_to_tls_error(int e);
|
||||
#ifdef ENABLE_OPENSSL
|
||||
int tor_tls_get_error(tor_tls_t *tls, int r, int extra,
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "lib/tls/nss_countbytes.h"
|
||||
#include "lib/log/util_bug.h"
|
||||
|
||||
DISABLE_GCC_WARNING(strict-prototypes)
|
||||
DISABLE_GCC_WARNING("-Wstrict-prototypes")
|
||||
#include <prio.h>
|
||||
// For access to rar sockets.
|
||||
#include <private/pprio.h>
|
||||
@@ -42,7 +42,7 @@ DISABLE_GCC_WARNING(strict-prototypes)
|
||||
#include <sslt.h>
|
||||
#include <sslproto.h>
|
||||
#include <certt.h>
|
||||
ENABLE_GCC_WARNING(strict-prototypes)
|
||||
ENABLE_GCC_WARNING("-Wstrict-prototypes")
|
||||
|
||||
static SECStatus always_accept_cert_cb(void *, PRFileDesc *, PRBool, PRBool);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
/* Some versions of OpenSSL declare SSL_get_selected_srtp_profile twice in
|
||||
* srtp.h. Suppress the GCC warning so we can build with -Wredundant-decl. */
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
@@ -54,7 +54,7 @@ DISABLE_GCC_WARNING(redundant-decls)
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/rsa.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include "lib/tls/tortls.h"
|
||||
#include "lib/tls/tortls_st.h"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
/* Some versions of OpenSSL declare SSL_get_selected_srtp_profile twice in
|
||||
* srtp.h. Suppress the GCC warning so we can build with -Wredundant-decl. */
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
@@ -36,7 +36,7 @@ DISABLE_GCC_WARNING(redundant-decls)
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include "lib/log/log.h"
|
||||
#include "lib/log/util_bug.h"
|
||||
|
||||
@@ -33,7 +33,7 @@ int a_tangled_web(int x) NOINLINE;
|
||||
int we_weave(int x) NOINLINE;
|
||||
|
||||
#ifdef HAVE_CFLAG_WNULL_DEREFERENCE
|
||||
DISABLE_GCC_WARNING(null-dereference)
|
||||
DISABLE_GCC_WARNING("-Wnull-dereference")
|
||||
#endif
|
||||
int
|
||||
crash(int x)
|
||||
@@ -55,7 +55,7 @@ crash(int x)
|
||||
return crashtype;
|
||||
}
|
||||
#ifdef HAVE_CFLAG_WNULL_DEREFERENCE
|
||||
ENABLE_GCC_WARNING(null-dereference)
|
||||
ENABLE_GCC_WARNING("-Wnull-dereference")
|
||||
#endif
|
||||
|
||||
int
|
||||
|
||||
@@ -136,7 +136,7 @@ test_clist_maps(void *arg)
|
||||
channel_note_destroy_pending(ch2, 200);
|
||||
channel_note_destroy_pending(ch2, 205);
|
||||
channel_note_destroy_pending(ch1, 100);
|
||||
tt_assert(circuit_id_in_use_on_channel(205, ch2))
|
||||
tt_assert(circuit_id_in_use_on_channel(205, ch2));
|
||||
tt_assert(circuit_id_in_use_on_channel(200, ch2));
|
||||
tt_assert(circuit_id_in_use_on_channel(100, ch1));
|
||||
|
||||
|
||||
@@ -4726,7 +4726,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
||||
port_cfg = (port_cfg_t *)smartlist_get(slout, 0);
|
||||
tt_int_op(port_cfg->port, OP_EQ, CFG_AUTO_PORT);
|
||||
tor_addr_parse(&addr, "127.0.0.46");
|
||||
tt_assert(tor_addr_eq(&port_cfg->addr, &addr))
|
||||
tt_assert(tor_addr_eq(&port_cfg->addr, &addr));
|
||||
|
||||
// Test success with a port of auto in mixed case
|
||||
config_free_lines(config_port_valid); config_port_valid = NULL;
|
||||
@@ -4740,7 +4740,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
||||
port_cfg = (port_cfg_t *)smartlist_get(slout, 0);
|
||||
tt_int_op(port_cfg->port, OP_EQ, CFG_AUTO_PORT);
|
||||
tor_addr_parse(&addr, "127.0.0.46");
|
||||
tt_assert(tor_addr_eq(&port_cfg->addr, &addr))
|
||||
tt_assert(tor_addr_eq(&port_cfg->addr, &addr));
|
||||
|
||||
// Test success with parsing both an address and an auto port
|
||||
config_free_lines(config_port_valid); config_port_valid = NULL;
|
||||
@@ -4754,7 +4754,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
||||
port_cfg = (port_cfg_t *)smartlist_get(slout, 0);
|
||||
tt_int_op(port_cfg->port, OP_EQ, CFG_AUTO_PORT);
|
||||
tor_addr_parse(&addr, "127.0.0.122");
|
||||
tt_assert(tor_addr_eq(&port_cfg->addr, &addr))
|
||||
tt_assert(tor_addr_eq(&port_cfg->addr, &addr));
|
||||
|
||||
// Test failure when asked to parse an invalid address followed by auto
|
||||
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
||||
@@ -4777,7 +4777,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
||||
port_cfg = (port_cfg_t *)smartlist_get(slout, 0);
|
||||
tt_int_op(port_cfg->port, OP_EQ, 656);
|
||||
tor_addr_parse(&addr, "127.0.0.123");
|
||||
tt_assert(tor_addr_eq(&port_cfg->addr, &addr))
|
||||
tt_assert(tor_addr_eq(&port_cfg->addr, &addr));
|
||||
|
||||
// Test failure if we can't parse anything at all
|
||||
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
#if defined(ENABLE_OPENSSL)
|
||||
#include "lib/crypt_ops/compat_openssl.h"
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
#include <openssl/dh.h>
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
#endif /* defined(ENABLE_OPENSSL) */
|
||||
|
||||
/** Run unit tests for Diffie-Hellman functionality. */
|
||||
|
||||
@@ -55,13 +55,13 @@
|
||||
#endif /* defined(_WIN32) */
|
||||
|
||||
#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
|
||||
DISABLE_GCC_WARNING(overlength-strings)
|
||||
DISABLE_GCC_WARNING("-Woverlength-strings")
|
||||
/* We allow huge string constants in the unit tests, but not in the code
|
||||
* at large. */
|
||||
#endif
|
||||
#include "vote_descriptors.inc"
|
||||
#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
|
||||
ENABLE_GCC_WARNING(overlength-strings)
|
||||
ENABLE_GCC_WARNING("-Woverlength-strings")
|
||||
#endif
|
||||
|
||||
#define NS_MODULE dir_handle_get
|
||||
@@ -258,7 +258,7 @@ test_dir_handle_get_rendezvous2_not_found_if_not_encrypted(void *data)
|
||||
conn = new_dir_conn();
|
||||
|
||||
// connection is not encrypted
|
||||
tt_assert(!connection_dir_is_encrypted(conn))
|
||||
tt_assert(!connection_dir_is_encrypted(conn));
|
||||
|
||||
tt_int_op(directory_handle_command_get(conn, RENDEZVOUS2_GET(), NULL, 0),
|
||||
OP_EQ, 0);
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
#include "test/test_connection.h"
|
||||
|
||||
#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
|
||||
DISABLE_GCC_WARNING(overlength-strings)
|
||||
DISABLE_GCC_WARNING("-Woverlength-strings")
|
||||
/* We allow huge string constants in the unit tests, but not in the code
|
||||
* at large. */
|
||||
#endif
|
||||
#include "test_descriptors.inc"
|
||||
#include "core/or/circuitlist.h"
|
||||
#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
|
||||
ENABLE_GCC_WARNING(overlength-strings)
|
||||
ENABLE_GCC_WARNING("-Woverlength-strings")
|
||||
#endif
|
||||
|
||||
/* Return a statically allocated string representing yesterday's date
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
#include "test/rng_test_helpers.h"
|
||||
|
||||
#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
|
||||
DISABLE_GCC_WARNING(overlength-strings)
|
||||
DISABLE_GCC_WARNING("-Woverlength-strings")
|
||||
/* We allow huge string constants in the unit tests, but not in the code
|
||||
* at large. */
|
||||
#endif
|
||||
#include "test_hs_descriptor.inc"
|
||||
ENABLE_GCC_WARNING(overlength-strings)
|
||||
ENABLE_GCC_WARNING("-Woverlength-strings")
|
||||
|
||||
/* Test certificate encoding put in a descriptor. */
|
||||
static void
|
||||
|
||||
@@ -491,7 +491,7 @@ test_md_generate(void *arg)
|
||||
}
|
||||
|
||||
#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
|
||||
DISABLE_GCC_WARNING(overlength-strings)
|
||||
DISABLE_GCC_WARNING("-Woverlength-strings")
|
||||
/* We allow huge string constants in the unit tests, but not in the code
|
||||
* at large. */
|
||||
#endif
|
||||
@@ -686,7 +686,7 @@ static const char MD_PARSE_TEST_DATA[] =
|
||||
"id rsa1024 2A8wYpHxnkKJ92orocvIQBzeHlE\n"
|
||||
;
|
||||
#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
|
||||
ENABLE_GCC_WARNING(overlength-strings)
|
||||
ENABLE_GCC_WARNING("-Woverlength-strings")
|
||||
#endif
|
||||
|
||||
/** More tests for parsing different kinds of microdescriptors, and getting
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
/* Some versions of OpenSSL declare SSL_get_selected_srtp_profile twice in
|
||||
* srtp.h. Suppress the GCC warning so we can build with -Wredundant-decl. */
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
@@ -29,7 +29,7 @@ DISABLE_GCC_WARNING(redundant-decls)
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include "core/or/or.h"
|
||||
#include "lib/log/log.h"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/* Some versions of OpenSSL declare X509_STORE_CTX_set_verify_cb twice in
|
||||
* x509.h and x509_vfy.h. Suppress the GCC warning so we can build with
|
||||
* -Wredundant-decl. */
|
||||
DISABLE_GCC_WARNING(redundant-decls)
|
||||
DISABLE_GCC_WARNING("-Wredundant-decls")
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
@@ -30,7 +30,7 @@ DISABLE_GCC_WARNING(redundant-decls)
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
ENABLE_GCC_WARNING(redundant-decls)
|
||||
ENABLE_GCC_WARNING("-Wredundant-decls")
|
||||
#endif /* defined(ENABLE_OPENSSL) */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
Reference in New Issue
Block a user