mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Re-run "make autostyle" with improved annotate_ifdef_directives
This commit is contained in:
parent
de66bed604
commit
53116ca0b7
@ -3518,7 +3518,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
|
|||||||
REJECT("Cannot use TransProxyType without any valid TransPort.");
|
REJECT("Cannot use TransProxyType without any valid TransPort.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* !(defined(USE_TRANSPARENT)) */
|
#else /* !defined(USE_TRANSPARENT) */
|
||||||
if (options->TransPort_set)
|
if (options->TransPort_set)
|
||||||
REJECT("TransPort is disabled in this build.");
|
REJECT("TransPort is disabled in this build.");
|
||||||
#endif /* defined(USE_TRANSPARENT) */
|
#endif /* defined(USE_TRANSPARENT) */
|
||||||
@ -7795,7 +7795,7 @@ get_data_directory(const char *val)
|
|||||||
} else {
|
} else {
|
||||||
return tor_strdup(get_windows_conf_root());
|
return tor_strdup(get_windows_conf_root());
|
||||||
}
|
}
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
const char *d = val;
|
const char *d = val;
|
||||||
if (!d)
|
if (!d)
|
||||||
d = "~/.tor";
|
d = "~/.tor";
|
||||||
@ -8341,7 +8341,7 @@ config_load_geoip_file_(sa_family_t family,
|
|||||||
}
|
}
|
||||||
r = geoip_load_file(family, fname, severity);
|
r = geoip_load_file(family, fname, severity);
|
||||||
tor_free(free_fname);
|
tor_free(free_fname);
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
(void)default_fname;
|
(void)default_fname;
|
||||||
r = geoip_load_file(family, fname, severity);
|
r = geoip_load_file(family, fname, severity);
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
|
@ -1192,7 +1192,7 @@ make_win32_socket_exclusive(tor_socket_t sock)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#else /* !(defined(SO_EXCLUSIVEADDRUSE)) */
|
#else /* !defined(SO_EXCLUSIVEADDRUSE) */
|
||||||
(void) sock;
|
(void) sock;
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* defined(SO_EXCLUSIVEADDRUSE) */
|
#endif /* defined(SO_EXCLUSIVEADDRUSE) */
|
||||||
@ -3957,7 +3957,7 @@ update_send_buffer_size(tor_socket_t sock)
|
|||||||
&isb, sizeof(isb), &bytesReturned, NULL, NULL)) {
|
&isb, sizeof(isb), &bytesReturned, NULL, NULL)) {
|
||||||
setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (const char*)&isb, sizeof(isb));
|
setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (const char*)&isb, sizeof(isb));
|
||||||
}
|
}
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
(void) sock;
|
(void) sock;
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
}
|
}
|
||||||
|
@ -1033,7 +1033,7 @@ channel_tls_time_process_cell(cell_t *cell, channel_tls_t *chan, int *time,
|
|||||||
channel_tls_time_process_cell(cl, cn, & tp ## time , \
|
channel_tls_time_process_cell(cl, cn, & tp ## time , \
|
||||||
channel_tls_process_ ## tp ## _cell); \
|
channel_tls_process_ ## tp ## _cell); \
|
||||||
} STMT_END
|
} STMT_END
|
||||||
#else /* !(defined(KEEP_TIMING_STATS)) */
|
#else /* !defined(KEEP_TIMING_STATS) */
|
||||||
#define PROCESS_CELL(tp, cl, cn) channel_tls_process_ ## tp ## _cell(cl, cn)
|
#define PROCESS_CELL(tp, cl, cn) channel_tls_process_ ## tp ## _cell(cl, cn)
|
||||||
#endif /* defined(KEEP_TIMING_STATS) */
|
#endif /* defined(KEEP_TIMING_STATS) */
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ command_process_cell(channel_t *chan, cell_t *cell)
|
|||||||
command_time_process_cell(cl, cn, & tp ## time , \
|
command_time_process_cell(cl, cn, & tp ## time , \
|
||||||
command_process_ ## tp ## _cell); \
|
command_process_ ## tp ## _cell); \
|
||||||
} STMT_END
|
} STMT_END
|
||||||
#else /* !(defined(KEEP_TIMING_STATS)) */
|
#else /* !defined(KEEP_TIMING_STATS) */
|
||||||
#define PROCESS_CELL(tp, cl, cn) command_process_ ## tp ## _cell(cl, cn)
|
#define PROCESS_CELL(tp, cl, cn) command_process_ ## tp ## _cell(cl, cn)
|
||||||
#endif /* defined(KEEP_TIMING_STATS) */
|
#endif /* defined(KEEP_TIMING_STATS) */
|
||||||
|
|
||||||
|
@ -1224,7 +1224,7 @@ connection_ap_rescan_and_attach_pending(void)
|
|||||||
entry_conn->marked_pending_circ_line = 0; \
|
entry_conn->marked_pending_circ_line = 0; \
|
||||||
entry_conn->marked_pending_circ_file = 0; \
|
entry_conn->marked_pending_circ_file = 0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else /* !(defined(DEBUGGING_17659)) */
|
#else /* !defined(DEBUGGING_17659) */
|
||||||
#define UNMARK() do { } while (0)
|
#define UNMARK() do { } while (0)
|
||||||
#endif /* defined(DEBUGGING_17659) */
|
#endif /* defined(DEBUGGING_17659) */
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ select_scheduler(void)
|
|||||||
log_notice(LD_SCHED, "Scheduler type KIST has been disabled by "
|
log_notice(LD_SCHED, "Scheduler type KIST has been disabled by "
|
||||||
"the consensus or no kernel support.");
|
"the consensus or no kernel support.");
|
||||||
}
|
}
|
||||||
#else /* !(defined(HAVE_KIST_SUPPORT)) */
|
#else /* !defined(HAVE_KIST_SUPPORT) */
|
||||||
log_info(LD_SCHED, "Scheduler type KIST not built in");
|
log_info(LD_SCHED, "Scheduler type KIST not built in");
|
||||||
#endif /* defined(HAVE_KIST_SUPPORT) */
|
#endif /* defined(HAVE_KIST_SUPPORT) */
|
||||||
continue;
|
continue;
|
||||||
|
@ -104,7 +104,7 @@ static unsigned int kist_lite_mode = 0;
|
|||||||
* changed and it doesn't recognized the values passed to the syscalls needed
|
* changed and it doesn't recognized the values passed to the syscalls needed
|
||||||
* by KIST. In that case, fallback to the naive approach. */
|
* by KIST. In that case, fallback to the naive approach. */
|
||||||
static unsigned int kist_no_kernel_support = 0;
|
static unsigned int kist_no_kernel_support = 0;
|
||||||
#else /* !(defined(HAVE_KIST_SUPPORT)) */
|
#else /* !defined(HAVE_KIST_SUPPORT) */
|
||||||
static unsigned int kist_lite_mode = 1;
|
static unsigned int kist_lite_mode = 1;
|
||||||
#endif /* defined(HAVE_KIST_SUPPORT) */
|
#endif /* defined(HAVE_KIST_SUPPORT) */
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ update_socket_info_impl, (socket_table_ent_t *ent))
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#else /* !(defined(HAVE_KIST_SUPPORT)) */
|
#else /* !defined(HAVE_KIST_SUPPORT) */
|
||||||
goto fallback;
|
goto fallback;
|
||||||
#endif /* defined(HAVE_KIST_SUPPORT) */
|
#endif /* defined(HAVE_KIST_SUPPORT) */
|
||||||
|
|
||||||
@ -833,7 +833,7 @@ scheduler_can_use_kist(void)
|
|||||||
return run_interval > 0;
|
return run_interval > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !(defined(HAVE_KIST_SUPPORT)) */
|
#else /* !defined(HAVE_KIST_SUPPORT) */
|
||||||
|
|
||||||
int
|
int
|
||||||
scheduler_can_use_kist(void)
|
scheduler_can_use_kist(void)
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#define raw_socketpair tor_ersatz_socketpair
|
#define raw_socketpair tor_ersatz_socketpair
|
||||||
#define raw_closesocket closesocket
|
#define raw_closesocket closesocket
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
#define raw_socketpair socketpair
|
#define raw_socketpair socketpair
|
||||||
#define raw_closesocket close
|
#define raw_closesocket close
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
|
@ -303,7 +303,7 @@ pathbias_is_new_circ_attempt(origin_circuit_t *circ)
|
|||||||
return circ->cpath &&
|
return circ->cpath &&
|
||||||
circ->cpath->next != circ->cpath &&
|
circ->cpath->next != circ->cpath &&
|
||||||
circ->cpath->next->state == CPATH_STATE_AWAITING_KEYS;
|
circ->cpath->next->state == CPATH_STATE_AWAITING_KEYS;
|
||||||
#else /* !(defined(N2N_TAGGING_IS_POSSIBLE)) */
|
#else /* !defined(N2N_TAGGING_IS_POSSIBLE) */
|
||||||
/* If tagging attacks are no longer possible, we probably want to
|
/* If tagging attacks are no longer possible, we probably want to
|
||||||
* count bias from the first hop. However, one could argue that
|
* count bias from the first hop. However, one could argue that
|
||||||
* timing-based tagging is still more useful than per-hop failure.
|
* timing-based tagging is still more useful than per-hop failure.
|
||||||
|
@ -238,7 +238,7 @@ dnsserv_launch_request(const char *name, int reverse,
|
|||||||
TO_CONN(conn)->port = control_conn->base_.port;
|
TO_CONN(conn)->port = control_conn->base_.port;
|
||||||
TO_CONN(conn)->address = tor_addr_to_str_dup(&control_conn->base_.addr);
|
TO_CONN(conn)->address = tor_addr_to_str_dup(&control_conn->base_.addr);
|
||||||
}
|
}
|
||||||
#else /* !(defined(AF_UNIX)) */
|
#else /* !defined(AF_UNIX) */
|
||||||
TO_CONN(conn)->port = control_conn->base_.port;
|
TO_CONN(conn)->port = control_conn->base_.port;
|
||||||
TO_CONN(conn)->address = tor_addr_to_str_dup(&control_conn->base_.addr);
|
TO_CONN(conn)->address = tor_addr_to_str_dup(&control_conn->base_.addr);
|
||||||
#endif /* defined(AF_UNIX) */
|
#endif /* defined(AF_UNIX) */
|
||||||
|
@ -29,7 +29,7 @@ authdir_mode_v3(const or_options_t *options)
|
|||||||
|
|
||||||
#define have_module_dirauth() (1)
|
#define have_module_dirauth() (1)
|
||||||
|
|
||||||
#else /* !(defined(HAVE_MODULE_DIRAUTH)) */
|
#else /* !defined(HAVE_MODULE_DIRAUTH) */
|
||||||
|
|
||||||
#define authdir_mode(options) (((void)(options)),0)
|
#define authdir_mode(options) (((void)(options)),0)
|
||||||
#define authdir_mode_handles_descs(options,purpose) \
|
#define authdir_mode_handles_descs(options,purpose) \
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
void dirauth_register_periodic_events(void);
|
void dirauth_register_periodic_events(void);
|
||||||
void reschedule_dirvote(const or_options_t *options);
|
void reschedule_dirvote(const or_options_t *options);
|
||||||
|
|
||||||
#else /* !(defined(HAVE_MODULE_DIRAUTH)) */
|
#else /* !defined(HAVE_MODULE_DIRAUTH) */
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
reschedule_dirvote(const or_options_t *options)
|
reschedule_dirvote(const or_options_t *options)
|
||||||
|
@ -128,7 +128,7 @@ struct config_line_t;
|
|||||||
char *format_recommended_version_list(const struct config_line_t *line,
|
char *format_recommended_version_list(const struct config_line_t *line,
|
||||||
int warn);
|
int warn);
|
||||||
|
|
||||||
#else /* !(defined(HAVE_MODULE_DIRAUTH)) */
|
#else /* !defined(HAVE_MODULE_DIRAUTH) */
|
||||||
|
|
||||||
static inline time_t
|
static inline time_t
|
||||||
dirvote_act(const or_options_t *options, time_t now)
|
dirvote_act(const or_options_t *options, time_t now)
|
||||||
|
@ -38,7 +38,7 @@ uint32_t dirserv_router_get_status(const routerinfo_t *router,
|
|||||||
int severity);
|
int severity);
|
||||||
void dirserv_set_node_flags_from_authoritative_status(node_t *node,
|
void dirserv_set_node_flags_from_authoritative_status(node_t *node,
|
||||||
uint32_t authstatus);
|
uint32_t authstatus);
|
||||||
#else /* !(defined(HAVE_MODULE_DIRAUTH)) */
|
#else /* !defined(HAVE_MODULE_DIRAUTH) */
|
||||||
static inline int
|
static inline int
|
||||||
dirserv_load_fingerprint_file(void)
|
dirserv_load_fingerprint_file(void)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ void dirserv_orconn_tls_done(const tor_addr_t *addr,
|
|||||||
uint16_t or_port,
|
uint16_t or_port,
|
||||||
const char *digest_rcvd,
|
const char *digest_rcvd,
|
||||||
const struct ed25519_public_key_t *ed_id_rcvd);
|
const struct ed25519_public_key_t *ed_id_rcvd);
|
||||||
#else /* !(defined(HAVE_MODULE_DIRAUTH)) */
|
#else /* !defined(HAVE_MODULE_DIRAUTH) */
|
||||||
static inline int
|
static inline int
|
||||||
dirserv_should_launch_reachability_test(const routerinfo_t *ri,
|
dirserv_should_launch_reachability_test(const routerinfo_t *ri,
|
||||||
const routerinfo_t *ri_old)
|
const routerinfo_t *ri_old)
|
||||||
|
@ -110,7 +110,7 @@ int sr_init(int save_to_disk);
|
|||||||
void sr_save_and_cleanup(void);
|
void sr_save_and_cleanup(void);
|
||||||
void sr_act_post_consensus(const networkstatus_t *consensus);
|
void sr_act_post_consensus(const networkstatus_t *consensus);
|
||||||
|
|
||||||
#else /* !(defined(HAVE_MODULE_DIRAUTH)) */
|
#else /* !defined(HAVE_MODULE_DIRAUTH) */
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
sr_init(int save_to_disk)
|
sr_init(int save_to_disk)
|
||||||
|
@ -92,7 +92,7 @@ consensus_cache_open(const char *subdir, int max_entries)
|
|||||||
*/
|
*/
|
||||||
#define VERY_LARGE_STORAGEDIR_LIMIT (1000*1000)
|
#define VERY_LARGE_STORAGEDIR_LIMIT (1000*1000)
|
||||||
storagedir_max_entries = VERY_LARGE_STORAGEDIR_LIMIT;
|
storagedir_max_entries = VERY_LARGE_STORAGEDIR_LIMIT;
|
||||||
#else /* !(defined(MUST_UNMAP_TO_UNLINK)) */
|
#else /* !defined(MUST_UNMAP_TO_UNLINK) */
|
||||||
/* Otherwise, we can just tell the storagedir to use the same limits
|
/* Otherwise, we can just tell the storagedir to use the same limits
|
||||||
* as this cache. */
|
* as this cache. */
|
||||||
storagedir_max_entries = max_entries;
|
storagedir_max_entries = max_entries;
|
||||||
|
@ -26,7 +26,7 @@ void dump_desc_init(void);
|
|||||||
log_debug(LD_MM, "Area for %s has %lu allocated; using %lu.", \
|
log_debug(LD_MM, "Area for %s has %lu allocated; using %lu.", \
|
||||||
name, (unsigned long)alloc, (unsigned long)used); \
|
name, (unsigned long)alloc, (unsigned long)used); \
|
||||||
STMT_END
|
STMT_END
|
||||||
#else /* !(defined(DEBUG_AREA_ALLOC)) */
|
#else /* !defined(DEBUG_AREA_ALLOC) */
|
||||||
#define DUMP_AREA(a,name) STMT_NIL
|
#define DUMP_AREA(a,name) STMT_NIL
|
||||||
#endif /* defined(DEBUG_AREA_ALLOC) */
|
#endif /* defined(DEBUG_AREA_ALLOC) */
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ set_unix_port(edge_connection_t *conn, rend_service_port_config_t *p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !(defined(HAVE_SYS_UN_H)) */
|
#else /* !defined(HAVE_SYS_UN_H) */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
set_unix_port(edge_connection_t *conn, rend_service_port_config_t *p)
|
set_unix_port(edge_connection_t *conn, rend_service_port_config_t *p)
|
||||||
|
@ -129,7 +129,7 @@ tor_ntohll(uint64_t a)
|
|||||||
{
|
{
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
#else /* !(defined(WORDS_BIGENDIAN)) */
|
#else /* !defined(WORDS_BIGENDIAN) */
|
||||||
static inline uint16_t
|
static inline uint16_t
|
||||||
tor_htons(uint16_t a)
|
tor_htons(uint16_t a)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
# define ENABLE_GCC_WARNING(warningopt) \
|
# define ENABLE_GCC_WARNING(warningopt) \
|
||||||
PRAGMA_DIAGNOSTIC_(warning PRAGMA_JOIN_STRINGIFY_(-W,warningopt))
|
PRAGMA_DIAGNOSTIC_(warning PRAGMA_JOIN_STRINGIFY_(-W,warningopt))
|
||||||
#endif /* defined(__clang__) || GCC_VERSION >= 406 */
|
#endif /* defined(__clang__) || GCC_VERSION >= 406 */
|
||||||
#else /* !(defined(__GNUC__)) */
|
#else /* !defined(__GNUC__) */
|
||||||
/* not gcc at all */
|
/* not gcc at all */
|
||||||
# define DISABLE_GCC_WARNING(warning)
|
# define DISABLE_GCC_WARNING(warning)
|
||||||
# define ENABLE_GCC_WARNING(warning)
|
# define ENABLE_GCC_WARNING(warning)
|
||||||
|
@ -96,7 +96,7 @@ typedef int32_t ssize_t;
|
|||||||
# else
|
# else
|
||||||
# define TOR_PRIuSZ PRIu32
|
# define TOR_PRIuSZ PRIu32
|
||||||
# endif
|
# endif
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
# define TOR_PRIuSZ "zu"
|
# define TOR_PRIuSZ "zu"
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ typedef int32_t ssize_t;
|
|||||||
# else
|
# else
|
||||||
# define TOR_PRIdSZ PRId32
|
# define TOR_PRIdSZ PRId32
|
||||||
# endif
|
# endif
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
# define TOR_PRIdSZ "zd"
|
# define TOR_PRIdSZ "zd"
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ tor_lzma_compress_new(int compress,
|
|||||||
tor_free(result);
|
tor_free(result);
|
||||||
return NULL;
|
return NULL;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
#else /* !(defined(HAVE_LZMA)) */
|
#else /* !defined(HAVE_LZMA) */
|
||||||
(void)compress;
|
(void)compress;
|
||||||
(void)method;
|
(void)method;
|
||||||
(void)level;
|
(void)level;
|
||||||
@ -312,7 +312,7 @@ tor_lzma_compress_process(tor_lzma_compress_state_t *state,
|
|||||||
lzma_error_str(retval));
|
lzma_error_str(retval));
|
||||||
return TOR_COMPRESS_ERROR;
|
return TOR_COMPRESS_ERROR;
|
||||||
}
|
}
|
||||||
#else /* !(defined(HAVE_LZMA)) */
|
#else /* !defined(HAVE_LZMA) */
|
||||||
(void)state;
|
(void)state;
|
||||||
(void)out;
|
(void)out;
|
||||||
(void)out_len;
|
(void)out_len;
|
||||||
|
@ -93,7 +93,7 @@ tor_zstd_get_version_str(void)
|
|||||||
ZSTD_versionNumber());
|
ZSTD_versionNumber());
|
||||||
|
|
||||||
return version_str;
|
return version_str;
|
||||||
#else /* !(defined(HAVE_ZSTD)) */
|
#else /* !defined(HAVE_ZSTD) */
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif /* defined(HAVE_ZSTD) */
|
#endif /* defined(HAVE_ZSTD) */
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ tor_zstd_compress_new(int compress,
|
|||||||
tor_free(result);
|
tor_free(result);
|
||||||
return NULL;
|
return NULL;
|
||||||
// LCOV_EXCL_STOP
|
// LCOV_EXCL_STOP
|
||||||
#else /* !(defined(HAVE_ZSTD)) */
|
#else /* !defined(HAVE_ZSTD) */
|
||||||
(void)compress;
|
(void)compress;
|
||||||
(void)method;
|
(void)method;
|
||||||
(void)level;
|
(void)level;
|
||||||
@ -454,7 +454,7 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state,
|
|||||||
return TOR_COMPRESS_OK;
|
return TOR_COMPRESS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !(defined(HAVE_ZSTD)) */
|
#else /* !defined(HAVE_ZSTD) */
|
||||||
(void)state;
|
(void)state;
|
||||||
(void)out;
|
(void)out;
|
||||||
(void)out_len;
|
(void)out_len;
|
||||||
|
@ -73,7 +73,7 @@ typedef union {
|
|||||||
#define DUMMY_TYPECHECK_INSTANCE(tp) \
|
#define DUMMY_TYPECHECK_INSTANCE(tp) \
|
||||||
static tp tp ## _dummy
|
static tp tp ## _dummy
|
||||||
|
|
||||||
#else /* !(defined(TOR_UNIT_TESTS)) */
|
#else /* !defined(TOR_UNIT_TESTS) */
|
||||||
|
|
||||||
#define CONF_TEST_MEMBERS(tp, conftype, member)
|
#define CONF_TEST_MEMBERS(tp, conftype, member)
|
||||||
/* Repeatedly declarable incomplete struct to absorb redundant semicolons */
|
/* Repeatedly declarable incomplete struct to absorb redundant semicolons */
|
||||||
|
@ -148,7 +148,7 @@ evaluate_ctr_for_aes(void)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else /* !(defined(USE_EVP_AES_CTR)) */
|
#else /* !defined(USE_EVP_AES_CTR) */
|
||||||
|
|
||||||
/*======================================================================*/
|
/*======================================================================*/
|
||||||
/* Interface to AES code, and counter implementation */
|
/* Interface to AES code, and counter implementation */
|
||||||
|
@ -68,7 +68,7 @@ crypto_validate_dh_params(const BIGNUM *p, const BIGNUM *g)
|
|||||||
goto out;
|
goto out;
|
||||||
if (!DH_set0_pqg(dh, dh_p, NULL, dh_g))
|
if (!DH_set0_pqg(dh, dh_p, NULL, dh_g))
|
||||||
goto out;
|
goto out;
|
||||||
#else /* !(defined(OPENSSL_1_1_API)) */
|
#else /* !defined(OPENSSL_1_1_API) */
|
||||||
if (!(dh->p = BN_dup(p)))
|
if (!(dh->p = BN_dup(p)))
|
||||||
goto out;
|
goto out;
|
||||||
if (!(dh->g = BN_dup(g)))
|
if (!(dh->g = BN_dup(g)))
|
||||||
@ -231,7 +231,7 @@ new_openssl_dh_from_params(BIGNUM *p, BIGNUM *g)
|
|||||||
|
|
||||||
if (!DH_set_length(res_dh, DH_PRIVATE_KEY_BITS))
|
if (!DH_set_length(res_dh, DH_PRIVATE_KEY_BITS))
|
||||||
goto err;
|
goto err;
|
||||||
#else /* !(defined(OPENSSL_1_1_API)) */
|
#else /* !defined(OPENSSL_1_1_API) */
|
||||||
res_dh->p = dh_p;
|
res_dh->p = dh_p;
|
||||||
res_dh->g = dh_g;
|
res_dh->g = dh_g;
|
||||||
res_dh->length = DH_PRIVATE_KEY_BITS;
|
res_dh->length = DH_PRIVATE_KEY_BITS;
|
||||||
@ -298,7 +298,7 @@ crypto_dh_generate_public(crypto_dh_t *dh)
|
|||||||
"the-universe chances really do happen. Treating as a failure.");
|
"the-universe chances really do happen. Treating as a failure.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else /* !(defined(OPENSSL_1_1_API)) */
|
#else /* !defined(OPENSSL_1_1_API) */
|
||||||
if (tor_check_dh_key(LOG_WARN, dh->dh->pub_key)<0) {
|
if (tor_check_dh_key(LOG_WARN, dh->dh->pub_key)<0) {
|
||||||
/* LCOV_EXCL_START
|
/* LCOV_EXCL_START
|
||||||
* If this happens, then openssl's DH implementation is busted. */
|
* If this happens, then openssl's DH implementation is busted. */
|
||||||
|
@ -149,7 +149,7 @@ struct crypto_xof_t {
|
|||||||
* outside the tests yet.
|
* outside the tests yet.
|
||||||
*/
|
*/
|
||||||
EVP_MD_CTX *ctx;
|
EVP_MD_CTX *ctx;
|
||||||
#else /* !(defined(OPENSSL_HAS_SHAKE3_EVP)) */
|
#else /* !defined(OPENSSL_HAS_SHAKE3_EVP) */
|
||||||
keccak_state s;
|
keccak_state s;
|
||||||
#endif /* defined(OPENSSL_HAS_SHAKE3_EVP) */
|
#endif /* defined(OPENSSL_HAS_SHAKE3_EVP) */
|
||||||
};
|
};
|
||||||
@ -169,7 +169,7 @@ crypto_xof_new(void)
|
|||||||
tor_assert(xof->ctx);
|
tor_assert(xof->ctx);
|
||||||
int r = EVP_DigestInit(xof->ctx, EVP_shake256());
|
int r = EVP_DigestInit(xof->ctx, EVP_shake256());
|
||||||
tor_assert(r == 1);
|
tor_assert(r == 1);
|
||||||
#else /* !(defined(OPENSSL_HAS_SHAKE256)) */
|
#else /* !defined(OPENSSL_HAS_SHAKE256) */
|
||||||
keccak_xof_init(&xof->s, 256);
|
keccak_xof_init(&xof->s, 256);
|
||||||
#endif /* defined(OPENSSL_HAS_SHAKE256) */
|
#endif /* defined(OPENSSL_HAS_SHAKE256) */
|
||||||
return xof;
|
return xof;
|
||||||
@ -236,7 +236,7 @@ crypto_xof(uint8_t *output, size_t output_len,
|
|||||||
r = EVP_DigestFinalXOF(ctx, output, output_len);
|
r = EVP_DigestFinalXOF(ctx, output, output_len);
|
||||||
tor_assert(r == 1);
|
tor_assert(r == 1);
|
||||||
EVP_MD_CTX_free(ctx);
|
EVP_MD_CTX_free(ctx);
|
||||||
#else /* !(defined(OPENSSL_HAS_SHA3)) */
|
#else /* !defined(OPENSSL_HAS_SHA3) */
|
||||||
crypto_xof_t *xof = crypto_xof_new();
|
crypto_xof_t *xof = crypto_xof_new();
|
||||||
crypto_xof_add_bytes(xof, input, input_len);
|
crypto_xof_add_bytes(xof, input, input_len);
|
||||||
crypto_xof_squeeze_bytes(xof, output, output_len);
|
crypto_xof_squeeze_bytes(xof, output, output_len);
|
||||||
|
@ -212,7 +212,7 @@ crypto_digest_new_internal(digest_algorithm_t algorithm)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#else /* !(defined(OPENSSL_HAS_SHA3)) */
|
#else /* !defined(OPENSSL_HAS_SHA3) */
|
||||||
case DIGEST_SHA3_256:
|
case DIGEST_SHA3_256:
|
||||||
keccak_digest_init(&r->d.sha3, 256);
|
keccak_digest_init(&r->d.sha3, 256);
|
||||||
break;
|
break;
|
||||||
@ -310,7 +310,7 @@ crypto_digest_add_bytes(crypto_digest_t *digest, const char *data,
|
|||||||
tor_assert(r);
|
tor_assert(r);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#else /* !(defined(OPENSSL_HAS_SHA3)) */
|
#else /* !defined(OPENSSL_HAS_SHA3) */
|
||||||
case DIGEST_SHA3_256: /* FALLSTHROUGH */
|
case DIGEST_SHA3_256: /* FALLSTHROUGH */
|
||||||
case DIGEST_SHA3_512:
|
case DIGEST_SHA3_512:
|
||||||
keccak_digest_update(&digest->d.sha3, (const uint8_t *)data, len);
|
keccak_digest_update(&digest->d.sha3, (const uint8_t *)data, len);
|
||||||
@ -354,7 +354,7 @@ crypto_digest_get_digest(crypto_digest_t *digest,
|
|||||||
EVP_MD_CTX_free(tmp);
|
EVP_MD_CTX_free(tmp);
|
||||||
tor_assert(res == 1);
|
tor_assert(res == 1);
|
||||||
goto done;
|
goto done;
|
||||||
#else /* !(defined(OPENSSL_HAS_SHA3)) */
|
#else /* !defined(OPENSSL_HAS_SHA3) */
|
||||||
/* Tiny-Keccak handles copying into a temporary ctx, and also can handle
|
/* Tiny-Keccak handles copying into a temporary ctx, and also can handle
|
||||||
* short output buffers by truncating appropriately. */
|
* short output buffers by truncating appropriately. */
|
||||||
keccak_digest_sum(&digest->d.sha3, (uint8_t *)out, out_len);
|
keccak_digest_sum(&digest->d.sha3, (uint8_t *)out, out_len);
|
||||||
|
@ -109,7 +109,7 @@ crypto_expand_key_material_rfc5869_sha256_openssl(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !(defined(HAVE_OPENSSL_HKDF)) */
|
#else /* !defined(HAVE_OPENSSL_HKDF) */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform RFC5869 HKDF computation using our own legacy implementation.
|
* Perform RFC5869 HKDF computation using our own legacy implementation.
|
||||||
@ -191,7 +191,7 @@ crypto_expand_key_material_rfc5869_sha256(
|
|||||||
salt_in_len, info_in,
|
salt_in_len, info_in,
|
||||||
info_in_len,
|
info_in_len,
|
||||||
key_out, key_out_len);
|
key_out, key_out_len);
|
||||||
#else /* !(defined(HAVE_OPENSSL_HKDF)) */
|
#else /* !defined(HAVE_OPENSSL_HKDF) */
|
||||||
return crypto_expand_key_material_rfc5869_sha256_legacy(key_in,
|
return crypto_expand_key_material_rfc5869_sha256_legacy(key_in,
|
||||||
key_in_len, salt_in,
|
key_in_len, salt_in,
|
||||||
salt_in_len, info_in,
|
salt_in_len, info_in,
|
||||||
|
@ -57,7 +57,7 @@ ope_val_from_le(ope_val_t x)
|
|||||||
((x) >> 8) |
|
((x) >> 8) |
|
||||||
(((x)&0xff) << 8);
|
(((x)&0xff) << 8);
|
||||||
}
|
}
|
||||||
#else /* !(defined(WORDS_BIGENDIAN)) */
|
#else /* !defined(WORDS_BIGENDIAN) */
|
||||||
#define ope_val_from_le(x) (x)
|
#define ope_val_from_le(x) (x)
|
||||||
#endif /* defined(WORDS_BIGENDIAN) */
|
#endif /* defined(WORDS_BIGENDIAN) */
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ crypto_openssl_early_init(void)
|
|||||||
OPENSSL_INIT_LOAD_CRYPTO_STRINGS |
|
OPENSSL_INIT_LOAD_CRYPTO_STRINGS |
|
||||||
OPENSSL_INIT_ADD_ALL_CIPHERS |
|
OPENSSL_INIT_ADD_ALL_CIPHERS |
|
||||||
OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
|
OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
|
||||||
#else /* !(defined(OPENSSL_1_1_API)) */
|
#else /* !defined(OPENSSL_1_1_API) */
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
OpenSSL_add_all_algorithms();
|
OpenSSL_add_all_algorithms();
|
||||||
#endif /* defined(OPENSSL_1_1_API) */
|
#endif /* defined(OPENSSL_1_1_API) */
|
||||||
|
@ -248,7 +248,7 @@ crypto_strongest_rand_fallback(uint8_t *out, size_t out_len)
|
|||||||
(void)out;
|
(void)out;
|
||||||
(void)out_len;
|
(void)out_len;
|
||||||
return -1;
|
return -1;
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
static const char *filenames[] = {
|
static const char *filenames[] = {
|
||||||
"/dev/srandom", "/dev/urandom", "/dev/random", NULL
|
"/dev/srandom", "/dev/urandom", "/dev/random", NULL
|
||||||
};
|
};
|
||||||
@ -520,7 +520,7 @@ crypto_rand_unmocked(char *to, size_t n)
|
|||||||
|
|
||||||
#undef BUFLEN
|
#undef BUFLEN
|
||||||
}
|
}
|
||||||
#else /* !(defined(ENABLE_NSS)) */
|
#else /* !defined(ENABLE_NSS) */
|
||||||
int r = RAND_bytes((unsigned char*)to, (int)n);
|
int r = RAND_bytes((unsigned char*)to, (int)n);
|
||||||
/* We consider a PRNG failure non-survivable. Let's assert so that we get a
|
/* We consider a PRNG failure non-survivable. Let's assert so that we get a
|
||||||
* stack trace about where it happened.
|
* stack trace about where it happened.
|
||||||
|
@ -53,7 +53,7 @@ crypto_pk_key_is_private(const crypto_pk_t *k)
|
|||||||
const BIGNUM *p, *q;
|
const BIGNUM *p, *q;
|
||||||
RSA_get0_factors(k->key, &p, &q);
|
RSA_get0_factors(k->key, &p, &q);
|
||||||
return p != NULL; /* XXX/yawning: Should we check q? */
|
return p != NULL; /* XXX/yawning: Should we check q? */
|
||||||
#else /* !(defined(OPENSSL_1_1_API)) */
|
#else /* !defined(OPENSSL_1_1_API) */
|
||||||
return k && k->key && k->key->p;
|
return k && k->key && k->key->p;
|
||||||
#endif /* defined(OPENSSL_1_1_API) */
|
#endif /* defined(OPENSSL_1_1_API) */
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ crypto_pk_num_bits(crypto_pk_t *env)
|
|||||||
tor_assert(n != NULL);
|
tor_assert(n != NULL);
|
||||||
|
|
||||||
return RSA_bits(env->key);
|
return RSA_bits(env->key);
|
||||||
#else /* !(defined(OPENSSL_1_1_API)) */
|
#else /* !defined(OPENSSL_1_1_API) */
|
||||||
tor_assert(env->key->n);
|
tor_assert(env->key->n);
|
||||||
return BN_num_bits(env->key->n);
|
return BN_num_bits(env->key->n);
|
||||||
#endif /* defined(OPENSSL_1_1_API) */
|
#endif /* defined(OPENSSL_1_1_API) */
|
||||||
|
@ -285,7 +285,7 @@ secret_to_key_compute_key(uint8_t *key_out, size_t key_out_len,
|
|||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return S2K_FAILED;
|
return S2K_FAILED;
|
||||||
return (int)key_out_len;
|
return (int)key_out_len;
|
||||||
#else /* !(defined(ENABLE_OPENSSL)) */
|
#else /* !defined(ENABLE_OPENSSL) */
|
||||||
SECItem passItem = { .type = siBuffer,
|
SECItem passItem = { .type = siBuffer,
|
||||||
.data = (unsigned char *) secret,
|
.data = (unsigned char *) secret,
|
||||||
.len = (int)secret_len };
|
.len = (int)secret_len };
|
||||||
@ -348,7 +348,7 @@ secret_to_key_compute_key(uint8_t *key_out, size_t key_out_len,
|
|||||||
if (rv != 0)
|
if (rv != 0)
|
||||||
return S2K_FAILED;
|
return S2K_FAILED;
|
||||||
return (int)key_out_len;
|
return (int)key_out_len;
|
||||||
#else /* !(defined(HAVE_SCRYPT)) */
|
#else /* !defined(HAVE_SCRYPT) */
|
||||||
return S2K_NO_SCRYPT_SUPPORT;
|
return S2K_NO_SCRYPT_SUPPORT;
|
||||||
#endif /* defined(HAVE_SCRYPT) */
|
#endif /* defined(HAVE_SCRYPT) */
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
stack[n] = (void*) ctx->PC_FROM_UCONTEXT;
|
stack[n] = (void*) ctx->PC_FROM_UCONTEXT;
|
||||||
#else /* !(defined(PC_FROM_UCONTEXT)) */
|
#else /* !defined(PC_FROM_UCONTEXT) */
|
||||||
(void) depth;
|
(void) depth;
|
||||||
(void) ctx;
|
(void) ctx;
|
||||||
(void) stack;
|
(void) stack;
|
||||||
|
@ -303,7 +303,7 @@ tor_process_monitor_poll_cb(periodic_timer_t *event, void *procmon_)
|
|||||||
tor_free(errmsg);
|
tor_free(errmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
/* Unix makes this part easy, if a bit racy. */
|
/* Unix makes this part easy, if a bit racy. */
|
||||||
its_dead_jim = kill(procmon->pid, 0);
|
its_dead_jim = kill(procmon->pid, 0);
|
||||||
its_dead_jim = its_dead_jim && (errno == ESRCH);
|
its_dead_jim = its_dead_jim && (errno == ESRCH);
|
||||||
|
@ -347,7 +347,7 @@ tor_listdir, (const char *dirname))
|
|||||||
}
|
}
|
||||||
FindClose(handle);
|
FindClose(handle);
|
||||||
tor_free(pattern);
|
tor_free(pattern);
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
const char *prot_dname = sandbox_intern_string(dirname);
|
const char *prot_dname = sandbox_intern_string(dirname);
|
||||||
DIR *d;
|
DIR *d;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
@ -123,7 +123,7 @@ ssize_t compat_getdelim_(char **lineptr, size_t *n, int delim, FILE *stream);
|
|||||||
*/
|
*/
|
||||||
#define tor_getdelim(lineptr, n, delim, stream) \
|
#define tor_getdelim(lineptr, n, delim, stream) \
|
||||||
getdelim((lineptr), (n), (delim), (stream))
|
getdelim((lineptr), (n), (delim), (stream))
|
||||||
#else /* !(defined(HAVE_GETDELIM)) */
|
#else /* !defined(HAVE_GETDELIM) */
|
||||||
#define tor_getdelim(lineptr, n, delim, stream) \
|
#define tor_getdelim(lineptr, n, delim, stream) \
|
||||||
compat_getdelim_((lineptr), (n), (delim), (stream))
|
compat_getdelim_((lineptr), (n), (delim), (stream))
|
||||||
#endif /* defined(HAVE_GETDELIM) */
|
#endif /* defined(HAVE_GETDELIM) */
|
||||||
@ -137,7 +137,7 @@ ssize_t compat_getdelim_(char **lineptr, size_t *n, int delim, FILE *stream);
|
|||||||
*/
|
*/
|
||||||
#define tor_getline(lineptr, n, stream) \
|
#define tor_getline(lineptr, n, stream) \
|
||||||
getline((lineptr), (n), (stream))
|
getline((lineptr), (n), (stream))
|
||||||
#else /* !(defined(HAVE_GETLINE)) */
|
#else /* !defined(HAVE_GETLINE) */
|
||||||
#define tor_getline(lineptr, n, stream) \
|
#define tor_getline(lineptr, n, stream) \
|
||||||
tor_getdelim((lineptr), (n), '\n', (stream))
|
tor_getdelim((lineptr), (n), '\n', (stream))
|
||||||
#endif /* defined(HAVE_GETLINE) */
|
#endif /* defined(HAVE_GETLINE) */
|
||||||
|
@ -72,7 +72,7 @@ expand_filename(const char *filename)
|
|||||||
* Chapter+3.+Input+Validation/3.7+Validating+Filenames+and+Paths/
|
* Chapter+3.+Input+Validation/3.7+Validating+Filenames+and+Paths/
|
||||||
*/
|
*/
|
||||||
return tor_strdup(filename);
|
return tor_strdup(filename);
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
if (*filename == '~') {
|
if (*filename == '~') {
|
||||||
char *home, *result=NULL;
|
char *home, *result=NULL;
|
||||||
const char *rest;
|
const char *rest;
|
||||||
@ -102,7 +102,7 @@ expand_filename(const char *filename)
|
|||||||
}
|
}
|
||||||
tor_free(username);
|
tor_free(username);
|
||||||
rest = slash ? (slash+1) : "";
|
rest = slash ? (slash+1) : "";
|
||||||
#else /* !(defined(HAVE_PWD_H)) */
|
#else /* !defined(HAVE_PWD_H) */
|
||||||
log_warn(LD_CONFIG, "Couldn't expand homedir on system without pwd.h");
|
log_warn(LD_CONFIG, "Couldn't expand homedir on system without pwd.h");
|
||||||
return tor_strdup(filename);
|
return tor_strdup(filename);
|
||||||
#endif /* defined(HAVE_PWD_H) */
|
#endif /* defined(HAVE_PWD_H) */
|
||||||
@ -153,7 +153,7 @@ clean_fname_for_stat(char *name)
|
|||||||
return;
|
return;
|
||||||
name[len-1]='\0';
|
name[len-1]='\0';
|
||||||
}
|
}
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
(void)name;
|
(void)name;
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ alloc_getcwd(void)
|
|||||||
raw_free(cwd); // alias for free to avoid tripping check-spaces.
|
raw_free(cwd); // alias for free to avoid tripping check-spaces.
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
#else /* !(defined(HAVE_GET_CURRENT_DIR_NAME)) */
|
#else /* !defined(HAVE_GET_CURRENT_DIR_NAME) */
|
||||||
size_t size = 1024;
|
size_t size = 1024;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
char *ptr = NULL;
|
char *ptr = NULL;
|
||||||
@ -268,7 +268,7 @@ make_path_absolute(char *fname)
|
|||||||
if (absfname_malloced) raw_free(absfname_malloced);
|
if (absfname_malloced) raw_free(absfname_malloced);
|
||||||
|
|
||||||
return absfname;
|
return absfname;
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
char *absfname = NULL, *path = NULL;
|
char *absfname = NULL, *path = NULL;
|
||||||
|
|
||||||
tor_assert(fname);
|
tor_assert(fname);
|
||||||
|
@ -532,7 +532,7 @@ logfile_deliver(logfile_t *lf, const char *buf, size_t msg_len,
|
|||||||
if (m != msg_after_prefix) {
|
if (m != msg_after_prefix) {
|
||||||
tor_free(m);
|
tor_free(m);
|
||||||
}
|
}
|
||||||
#else /* !(defined(MAXLINE)) */
|
#else /* !defined(MAXLINE) */
|
||||||
/* We have syslog but not MAXLINE. That's promising! */
|
/* We have syslog but not MAXLINE. That's promising! */
|
||||||
syslog(severity, "%s", msg_after_prefix);
|
syslog(severity, "%s", msg_after_prefix);
|
||||||
#endif /* defined(MAXLINE) */
|
#endif /* defined(MAXLINE) */
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#error "Your syslog.h thinks high numbers are more important. " \
|
#error "Your syslog.h thinks high numbers are more important. " \
|
||||||
"We aren't prepared to deal with that."
|
"We aren't prepared to deal with that."
|
||||||
#endif
|
#endif
|
||||||
#else /* !(defined(HAVE_SYSLOG_H)) */
|
#else /* !defined(HAVE_SYSLOG_H) */
|
||||||
/* Note: Syslog's logging code refers to priorities, with 0 being the most
|
/* Note: Syslog's logging code refers to priorities, with 0 being the most
|
||||||
* important. Thus, all our comparisons needed to be reversed when we added
|
* important. Thus, all our comparisons needed to be reversed when we added
|
||||||
* syslog support.
|
* syslog support.
|
||||||
|
@ -64,7 +64,7 @@ tor_set_failed_assertion_callback(void (*fn)(void))
|
|||||||
{
|
{
|
||||||
failed_assertion_cb = fn;
|
failed_assertion_cb = fn;
|
||||||
}
|
}
|
||||||
#else /* !(defined(TOR_UNIT_TESTS)) */
|
#else /* !defined(TOR_UNIT_TESTS) */
|
||||||
#define capturing_bugs() (0)
|
#define capturing_bugs() (0)
|
||||||
#define add_captured_bug(s) do { } while (0)
|
#define add_captured_bug(s) do { } while (0)
|
||||||
#endif /* defined(TOR_UNIT_TESTS) */
|
#endif /* defined(TOR_UNIT_TESTS) */
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
(void)(a); \
|
(void)(a); \
|
||||||
(void)(fmt); \
|
(void)(fmt); \
|
||||||
STMT_END
|
STMT_END
|
||||||
#else /* !(defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TES... */
|
#else /* !(defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_T...)) */
|
||||||
/** Like assert(3), but send assertion failures to the log as well as to
|
/** Like assert(3), but send assertion failures to the log as well as to
|
||||||
* stderr. */
|
* stderr. */
|
||||||
#define tor_assert(expr) tor_assertf(expr, NULL)
|
#define tor_assert(expr) tor_assertf(expr, NULL)
|
||||||
@ -211,7 +211,7 @@
|
|||||||
"!("#cond")", 1, NULL); \
|
"!("#cond")", 1, NULL); \
|
||||||
} \
|
} \
|
||||||
bool_result; } ))
|
bool_result; } ))
|
||||||
#else /* !(defined(__GNUC__)) */
|
#else /* !defined(__GNUC__) */
|
||||||
#define IF_BUG_ONCE__(cond,var) \
|
#define IF_BUG_ONCE__(cond,var) \
|
||||||
static int var = 0; \
|
static int var = 0; \
|
||||||
if ((cond) ? \
|
if ((cond) ? \
|
||||||
|
@ -47,7 +47,7 @@ format_win32_error(DWORD err)
|
|||||||
result = tor_malloc(len);
|
result = tor_malloc(len);
|
||||||
wcstombs(result,str,len);
|
wcstombs(result,str,len);
|
||||||
result[len-1] = '\0';
|
result[len-1] = '\0';
|
||||||
#else /* !(defined(UNICODE)) */
|
#else /* !defined(UNICODE) */
|
||||||
result = tor_strdup(str);
|
result = tor_strdup(str);
|
||||||
#endif /* defined(UNICODE) */
|
#endif /* defined(UNICODE) */
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,7 +48,7 @@ void tor_free_(void *mem);
|
|||||||
raw_free(*tor_free__tmpvar); \
|
raw_free(*tor_free__tmpvar); \
|
||||||
*tor_free__tmpvar=NULL; \
|
*tor_free__tmpvar=NULL; \
|
||||||
STMT_END
|
STMT_END
|
||||||
#else /* !(defined(__GNUC__)) */
|
#else /* !defined(__GNUC__) */
|
||||||
#define tor_free(p) STMT_BEGIN \
|
#define tor_free(p) STMT_BEGIN \
|
||||||
raw_free(p); \
|
raw_free(p); \
|
||||||
(p)=NULL; \
|
(p)=NULL; \
|
||||||
|
@ -122,7 +122,7 @@ nodump_mem(void *mem, size_t sz)
|
|||||||
NULL);
|
NULL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else /* !(defined(MADV_DONTDUMP)) */
|
#else /* !defined(MADV_DONTDUMP) */
|
||||||
(void) mem;
|
(void) mem;
|
||||||
(void) sz;
|
(void) sz;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
uint32_t sent_val = get_uint32(&(chunk)->U_MEM[chunk->mem_size]); \
|
uint32_t sent_val = get_uint32(&(chunk)->U_MEM[chunk->mem_size]); \
|
||||||
tor_assert(sent_val == SENTINEL_VAL); \
|
tor_assert(sent_val == SENTINEL_VAL); \
|
||||||
STMT_END
|
STMT_END
|
||||||
#else /* !(defined(USE_SENTINELS)) */
|
#else /* !defined(USE_SENTINELS) */
|
||||||
#define SENTINEL_LEN 0
|
#define SENTINEL_LEN 0
|
||||||
#define SET_SENTINEL(chunk) STMT_NIL
|
#define SET_SENTINEL(chunk) STMT_NIL
|
||||||
#define CHECK_SENTINEL(chunk) STMT_NIL
|
#define CHECK_SENTINEL(chunk) STMT_NIL
|
||||||
|
@ -54,7 +54,7 @@ tor_log_mallinfo(int severity)
|
|||||||
mi.arena, mi.ordblks, mi.smblks, mi.hblks,
|
mi.arena, mi.ordblks, mi.smblks, mi.hblks,
|
||||||
mi.hblkhd, mi.usmblks, mi.fsmblks, mi.uordblks, mi.fordblks,
|
mi.hblkhd, mi.usmblks, mi.fsmblks, mi.uordblks, mi.fordblks,
|
||||||
mi.keepcost);
|
mi.keepcost);
|
||||||
#else /* !(defined(HAVE_MALLINFO)) */
|
#else /* !defined(HAVE_MALLINFO) */
|
||||||
(void)severity;
|
(void)severity;
|
||||||
#endif /* defined(HAVE_MALLINFO) */
|
#endif /* defined(HAVE_MALLINFO) */
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ typedef int socklen_t;
|
|||||||
#define TOR_SOCKET_T_FORMAT "%"PRIuPTR
|
#define TOR_SOCKET_T_FORMAT "%"PRIuPTR
|
||||||
#define SOCKET_OK(s) ((SOCKET)(s) != INVALID_SOCKET)
|
#define SOCKET_OK(s) ((SOCKET)(s) != INVALID_SOCKET)
|
||||||
#define TOR_INVALID_SOCKET INVALID_SOCKET
|
#define TOR_INVALID_SOCKET INVALID_SOCKET
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
/** Type used for a network socket. */
|
/** Type used for a network socket. */
|
||||||
#define tor_socket_t int
|
#define tor_socket_t int
|
||||||
#define TOR_SOCKET_T_FORMAT "%d"
|
#define TOR_SOCKET_T_FORMAT "%d"
|
||||||
|
@ -118,7 +118,7 @@ tor_addr_lookup_host_getaddrinfo(const char *name,
|
|||||||
return (err == EAI_AGAIN) ? 1 : -1;
|
return (err == EAI_AGAIN) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !(defined(HAVE_GETADDRINFO)) */
|
#else /* !defined(HAVE_GETADDRINFO) */
|
||||||
|
|
||||||
/* Host lookup helper for tor_addr_lookup(), which calls getaddrinfo().
|
/* Host lookup helper for tor_addr_lookup(), which calls getaddrinfo().
|
||||||
* Used when gethostbyname() is not available on this system.
|
* Used when gethostbyname() is not available on this system.
|
||||||
@ -506,7 +506,7 @@ tor_make_getaddrinfo_cache_active(void)
|
|||||||
{
|
{
|
||||||
sandbox_getaddrinfo_is_active = 1;
|
sandbox_getaddrinfo_is_active = 1;
|
||||||
}
|
}
|
||||||
#else /* !(defined(USE_SANDBOX_GETADDRINFO)) */
|
#else /* !defined(USE_SANDBOX_GETADDRINFO) */
|
||||||
void
|
void
|
||||||
sandbox_disable_getaddrinfo_cache(void)
|
sandbox_disable_getaddrinfo_cache(void)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ int tor_getaddrinfo(const char *name, const char *servname,
|
|||||||
struct addrinfo **res);
|
struct addrinfo **res);
|
||||||
void tor_freeaddrinfo(struct addrinfo *addrinfo);
|
void tor_freeaddrinfo(struct addrinfo *addrinfo);
|
||||||
void tor_free_getaddrinfo_cache(void);
|
void tor_free_getaddrinfo_cache(void);
|
||||||
#else /* !(defined(USE_SANDBOX_GETADDRINFO)) */
|
#else /* !defined(USE_SANDBOX_GETADDRINFO) */
|
||||||
#define tor_getaddrinfo(name, servname, hints, res) \
|
#define tor_getaddrinfo(name, servname, hints, res) \
|
||||||
getaddrinfo((name),(servname), (hints),(res))
|
getaddrinfo((name),(servname), (hints),(res))
|
||||||
#define tor_add_addrinfo(name) \
|
#define tor_add_addrinfo(name) \
|
||||||
|
@ -84,7 +84,7 @@ check_network_configuration(bool server_mode)
|
|||||||
"so your relay makes it harder to figure out how busy it is.");
|
"so your relay makes it harder to figure out how busy it is.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* !(defined(__FreeBSD__)) */
|
#else /* !defined(__FreeBSD__) */
|
||||||
(void) server_mode;
|
(void) server_mode;
|
||||||
#endif /* defined(__FreeBSD__) */
|
#endif /* defined(__FreeBSD__) */
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ mark_socket_closed(tor_socket_t s)
|
|||||||
bitarray_clear(open_sockets, s);
|
bitarray_clear(open_sockets, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* !(defined(DEBUG_SOCKET_COUNTING)) */
|
#else /* !defined(DEBUG_SOCKET_COUNTING) */
|
||||||
#define mark_socket_open(s) ((void) (s))
|
#define mark_socket_open(s) ((void) (s))
|
||||||
#define mark_socket_closed(s) ((void) (s))
|
#define mark_socket_closed(s) ((void) (s))
|
||||||
#endif /* defined(DEBUG_SOCKET_COUNTING) */
|
#endif /* defined(DEBUG_SOCKET_COUNTING) */
|
||||||
@ -308,7 +308,7 @@ tor_open_socket_with_extensions(int domain, int type, int protocol,
|
|||||||
return TOR_INVALID_SOCKET;
|
return TOR_INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* !(defined(FD_CLOEXEC)) */
|
#else /* !defined(FD_CLOEXEC) */
|
||||||
(void)cloexec;
|
(void)cloexec;
|
||||||
#endif /* defined(FD_CLOEXEC) */
|
#endif /* defined(FD_CLOEXEC) */
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ tor_accept_socket_with_extensions(tor_socket_t sockfd, struct sockaddr *addr,
|
|||||||
return TOR_INVALID_SOCKET;
|
return TOR_INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* !(defined(FD_CLOEXEC)) */
|
#else /* !defined(FD_CLOEXEC) */
|
||||||
(void)cloexec;
|
(void)cloexec;
|
||||||
#endif /* defined(FD_CLOEXEC) */
|
#endif /* defined(FD_CLOEXEC) */
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ ssize_t read_all_from_socket(tor_socket_t fd, char *buf, size_t count);
|
|||||||
#define ERRNO_IS_EINTR(e) ((e) == WSAEINTR || 0)
|
#define ERRNO_IS_EINTR(e) ((e) == WSAEINTR || 0)
|
||||||
int tor_socket_errno(tor_socket_t sock);
|
int tor_socket_errno(tor_socket_t sock);
|
||||||
const char *tor_socket_strerror(int e);
|
const char *tor_socket_strerror(int e);
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
#define SOCK_ERRNO(e) e
|
#define SOCK_ERRNO(e) e
|
||||||
#if EAGAIN == EWOULDBLOCK
|
#if EAGAIN == EWOULDBLOCK
|
||||||
/* || 0 is for -Wparentheses-equality (-Wall?) appeasement under clang */
|
/* || 0 is for -Wparentheses-equality (-Wall?) appeasement under clang */
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define socket_errno() (WSAGetLastError())
|
#define socket_errno() (WSAGetLastError())
|
||||||
#define SOCKET_EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
#define SOCKET_EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
#define closesocket(x) close(x)
|
#define closesocket(x) close(x)
|
||||||
#define socket_errno() (errno)
|
#define socket_errno() (errno)
|
||||||
#define SOCKET_EPROTONOSUPPORT EPROTONOSUPPORT
|
#define SOCKET_EPROTONOSUPPORT EPROTONOSUPPORT
|
||||||
|
@ -137,7 +137,7 @@ get_uname,(void))
|
|||||||
if (!is_server && !is_client) {
|
if (!is_server && !is_client) {
|
||||||
strlcat(uname_result, " [client or server]", sizeof(uname_result));
|
strlcat(uname_result, " [client or server]", sizeof(uname_result));
|
||||||
}
|
}
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
/* LCOV_EXCL_START -- can't provoke uname failure */
|
/* LCOV_EXCL_START -- can't provoke uname failure */
|
||||||
strlcpy(uname_result, "Unknown platform", sizeof(uname_result));
|
strlcpy(uname_result, "Unknown platform", sizeof(uname_result));
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
@ -47,7 +47,7 @@ get_environment(void)
|
|||||||
* when we do a mostly-static build on OSX 10.7, the resulting binary won't
|
* when we do a mostly-static build on OSX 10.7, the resulting binary won't
|
||||||
* work on OSX 10.6. */
|
* work on OSX 10.6. */
|
||||||
return *_NSGetEnviron();
|
return *_NSGetEnviron();
|
||||||
#else /* !(defined(HAVE__NSGETENVIRON)) */
|
#else /* !defined(HAVE__NSGETENVIRON) */
|
||||||
return environ;
|
return environ;
|
||||||
#endif /* defined(HAVE__NSGETENVIRON) */
|
#endif /* defined(HAVE__NSGETENVIRON) */
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ process_unix_exec(process_t *process)
|
|||||||
"Cannot find maximum file descriptor, assuming: %d", max_fd);
|
"Cannot find maximum file descriptor, assuming: %d", max_fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* !(defined(_SC_OPEN_MAX)) */
|
#else /* !defined(_SC_OPEN_MAX) */
|
||||||
max_fd = DEFAULT_MAX_FD;
|
max_fd = DEFAULT_MAX_FD;
|
||||||
#endif /* defined(_SC_OPEN_MAX) */
|
#endif /* defined(_SC_OPEN_MAX) */
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ tor_mlockall(void)
|
|||||||
"pages: %s", strerror(errno));
|
"pages: %s", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else /* !(defined(HAVE_UNIX_MLOCKALL)) */
|
#else /* !defined(HAVE_UNIX_MLOCKALL) */
|
||||||
log_warn(LD_GENERAL, "Unable to lock memory pages. mlockall() unsupported?");
|
log_warn(LD_GENERAL, "Unable to lock memory pages. mlockall() unsupported?");
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* defined(HAVE_UNIX_MLOCKALL) */
|
#endif /* defined(HAVE_UNIX_MLOCKALL) */
|
||||||
|
@ -72,7 +72,7 @@ log_credential_status(void)
|
|||||||
"UID is %u (real), %u (effective), %u (saved)",
|
"UID is %u (real), %u (effective), %u (saved)",
|
||||||
(unsigned)ruid, (unsigned)euid, (unsigned)suid);
|
(unsigned)ruid, (unsigned)euid, (unsigned)suid);
|
||||||
}
|
}
|
||||||
#else /* !(defined(HAVE_GETRESUID)) */
|
#else /* !defined(HAVE_GETRESUID) */
|
||||||
/* getresuid is not present on MacOS X, so we can't get the saved (E)UID */
|
/* getresuid is not present on MacOS X, so we can't get the saved (E)UID */
|
||||||
ruid = getuid();
|
ruid = getuid();
|
||||||
euid = geteuid();
|
euid = geteuid();
|
||||||
@ -93,7 +93,7 @@ log_credential_status(void)
|
|||||||
"GID is %u (real), %u (effective), %u (saved)",
|
"GID is %u (real), %u (effective), %u (saved)",
|
||||||
(unsigned)rgid, (unsigned)egid, (unsigned)sgid);
|
(unsigned)rgid, (unsigned)egid, (unsigned)sgid);
|
||||||
}
|
}
|
||||||
#else /* !(defined(HAVE_GETRESGID)) */
|
#else /* !defined(HAVE_GETRESGID) */
|
||||||
/* getresgid is not present on MacOS X, so we can't get the saved (E)GID */
|
/* getresgid is not present on MacOS X, so we can't get the saved (E)GID */
|
||||||
rgid = getgid();
|
rgid = getgid();
|
||||||
egid = getegid();
|
egid = getegid();
|
||||||
@ -154,7 +154,7 @@ have_capability_support(void)
|
|||||||
return 0;
|
return 0;
|
||||||
cap_free(caps);
|
cap_free(caps);
|
||||||
return 1;
|
return 1;
|
||||||
#else /* !(defined(HAVE_LINUX_CAPABILITIES)) */
|
#else /* !defined(HAVE_LINUX_CAPABILITIES) */
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* defined(HAVE_LINUX_CAPABILITIES) */
|
#endif /* defined(HAVE_LINUX_CAPABILITIES) */
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ switch_id(const char *user, const unsigned flags)
|
|||||||
if (drop_capabilities(1))
|
if (drop_capabilities(1))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else /* !(defined(HAVE_LINUX_CAPABILITIES)) */
|
#else /* !defined(HAVE_LINUX_CAPABILITIES) */
|
||||||
(void) keep_bindlow;
|
(void) keep_bindlow;
|
||||||
if (warn_if_no_caps) {
|
if (warn_if_no_caps) {
|
||||||
log_warn(LD_CONFIG, "KeepBindCapabilities set, but no capability support "
|
log_warn(LD_CONFIG, "KeepBindCapabilities set, but no capability support "
|
||||||
|
@ -51,7 +51,7 @@ subsys_winprocess_initialize(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
#define WINPROCESS_SYS_ENABLED false
|
#define WINPROCESS_SYS_ENABLED false
|
||||||
#define subsys_winprocess_initialize NULL
|
#define subsys_winprocess_initialize NULL
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
|
@ -444,7 +444,7 @@ libc_uses_openat_for_everything(void)
|
|||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
#else /* !(defined(CHECK_LIBC_VERSION)) */
|
#else /* !defined(CHECK_LIBC_VERSION) */
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* defined(CHECK_LIBC_VERSION) */
|
#endif /* defined(CHECK_LIBC_VERSION) */
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ typedef struct {
|
|||||||
* it matches the parameter.
|
* it matches the parameter.
|
||||||
*/
|
*/
|
||||||
const char* sandbox_intern_string(const char *param);
|
const char* sandbox_intern_string(const char *param);
|
||||||
#else /* !(defined(USE_LIBSECCOMP)) */
|
#else /* !defined(USE_LIBSECCOMP) */
|
||||||
#define sandbox_intern_string(s) (s)
|
#define sandbox_intern_string(s) (s)
|
||||||
#endif /* defined(USE_LIBSECCOMP) */
|
#endif /* defined(USE_LIBSECCOMP) */
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ static inline void smartlist_set(smartlist_t *sl, int idx, void *val) {
|
|||||||
raw_assert(sl->num_used > idx);
|
raw_assert(sl->num_used > idx);
|
||||||
sl->list[idx] = val;
|
sl->list[idx] = val;
|
||||||
}
|
}
|
||||||
#else /* !(defined(DEBUG_SMARTLIST)) */
|
#else /* !defined(DEBUG_SMARTLIST) */
|
||||||
#define smartlist_len(sl) ((sl)->num_used)
|
#define smartlist_len(sl) ((sl)->num_used)
|
||||||
#define smartlist_get(sl, idx) ((sl)->list[idx])
|
#define smartlist_get(sl, idx) ((sl)->list[idx])
|
||||||
#define smartlist_set(sl, idx, val) ((sl)->list[idx] = (val))
|
#define smartlist_set(sl, idx, val) ((sl)->list[idx] = (val))
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* tests. */
|
* tests. */
|
||||||
#define STATIC
|
#define STATIC
|
||||||
#define EXTERN(type, name) extern type name;
|
#define EXTERN(type, name) extern type name;
|
||||||
#else /* !(defined(TOR_UNIT_TESTS)) */
|
#else /* !defined(TOR_UNIT_TESTS) */
|
||||||
#define STATIC static
|
#define STATIC static
|
||||||
#define EXTERN(type, name)
|
#define EXTERN(type, name)
|
||||||
#endif /* defined(TOR_UNIT_TESTS) */
|
#endif /* defined(TOR_UNIT_TESTS) */
|
||||||
@ -90,7 +90,7 @@
|
|||||||
do { \
|
do { \
|
||||||
func = func ##__real; \
|
func = func ##__real; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else /* !(defined(TOR_UNIT_TESTS)) */
|
#else /* !defined(TOR_UNIT_TESTS) */
|
||||||
#define MOCK_DECL(rv, funcname, arglist) \
|
#define MOCK_DECL(rv, funcname, arglist) \
|
||||||
rv funcname arglist
|
rv funcname arglist
|
||||||
#define MOCK_DECL_ATTR(rv, funcname, arglist, attr) \
|
#define MOCK_DECL_ATTR(rv, funcname, arglist, attr) \
|
||||||
|
@ -107,7 +107,7 @@ typedef struct atomic_counter_t {
|
|||||||
atomic_size_t val;
|
atomic_size_t val;
|
||||||
} atomic_counter_t;
|
} atomic_counter_t;
|
||||||
#define ATOMIC_LINKAGE static
|
#define ATOMIC_LINKAGE static
|
||||||
#else /* !(defined(HAVE_WORKING_STDATOMIC)) */
|
#else /* !defined(HAVE_WORKING_STDATOMIC) */
|
||||||
typedef struct atomic_counter_t {
|
typedef struct atomic_counter_t {
|
||||||
tor_mutex_t mutex;
|
tor_mutex_t mutex;
|
||||||
size_t val;
|
size_t val;
|
||||||
@ -172,7 +172,7 @@ atomic_counter_exchange(atomic_counter_t *counter, size_t newval)
|
|||||||
return atomic_exchange(&counter->val, newval);
|
return atomic_exchange(&counter->val, newval);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !(defined(HAVE_WORKING_STDATOMIC)) */
|
#else /* !defined(HAVE_WORKING_STDATOMIC) */
|
||||||
#endif /* defined(HAVE_WORKING_STDATOMIC) */
|
#endif /* defined(HAVE_WORKING_STDATOMIC) */
|
||||||
|
|
||||||
#endif /* !defined(TOR_COMPAT_THREADS_H) */
|
#endif /* !defined(TOR_COMPAT_THREADS_H) */
|
||||||
|
@ -833,7 +833,7 @@ monotime_coarse_absolute_msec(void)
|
|||||||
{
|
{
|
||||||
return monotime_coarse_absolute_nsec() / ONE_MILLION;
|
return monotime_coarse_absolute_nsec() / ONE_MILLION;
|
||||||
}
|
}
|
||||||
#else /* !(defined(MONOTIME_COARSE_FN_IS_DIFFERENT)) */
|
#else /* !defined(MONOTIME_COARSE_FN_IS_DIFFERENT) */
|
||||||
#define initialized_at_coarse initialized_at
|
#define initialized_at_coarse initialized_at
|
||||||
#endif /* defined(MONOTIME_COARSE_FN_IS_DIFFERENT) */
|
#endif /* defined(MONOTIME_COARSE_FN_IS_DIFFERENT) */
|
||||||
|
|
||||||
@ -865,7 +865,7 @@ monotime_msec_to_approx_coarse_stamp_units(uint64_t msec)
|
|||||||
mach_time_info.numer;
|
mach_time_info.numer;
|
||||||
return abstime_val >> monotime_shift;
|
return abstime_val >> monotime_shift;
|
||||||
}
|
}
|
||||||
#else /* !(defined(__APPLE__)) */
|
#else /* !defined(__APPLE__) */
|
||||||
uint64_t
|
uint64_t
|
||||||
monotime_coarse_stamp_units_to_approx_msec(uint64_t units)
|
monotime_coarse_stamp_units_to_approx_msec(uint64_t units)
|
||||||
{
|
{
|
||||||
|
@ -259,7 +259,7 @@ void monotime_coarse_get(monotime_coarse_t *out);
|
|||||||
uint64_t monotime_coarse_absolute_nsec(void);
|
uint64_t monotime_coarse_absolute_nsec(void);
|
||||||
uint64_t monotime_coarse_absolute_usec(void);
|
uint64_t monotime_coarse_absolute_usec(void);
|
||||||
uint64_t monotime_coarse_absolute_msec(void);
|
uint64_t monotime_coarse_absolute_msec(void);
|
||||||
#else /* !(defined(MONOTIME_COARSE_FN_IS_DIFFERENT)) */
|
#else /* !defined(MONOTIME_COARSE_FN_IS_DIFFERENT) */
|
||||||
#define monotime_coarse_get monotime_get
|
#define monotime_coarse_get monotime_get
|
||||||
#define monotime_coarse_absolute_nsec monotime_absolute_nsec
|
#define monotime_coarse_absolute_nsec monotime_absolute_nsec
|
||||||
#define monotime_coarse_absolute_usec monotime_absolute_usec
|
#define monotime_coarse_absolute_usec monotime_absolute_usec
|
||||||
@ -304,7 +304,7 @@ void monotime_coarse_zero(monotime_coarse_t *out);
|
|||||||
int monotime_coarse_is_zero(const monotime_coarse_t *val);
|
int monotime_coarse_is_zero(const monotime_coarse_t *val);
|
||||||
void monotime_coarse_add_msec(monotime_coarse_t *out,
|
void monotime_coarse_add_msec(monotime_coarse_t *out,
|
||||||
const monotime_coarse_t *val, uint32_t msec);
|
const monotime_coarse_t *val, uint32_t msec);
|
||||||
#else /* !(defined(MONOTIME_COARSE_TYPE_IS_DIFFERENT)) */
|
#else /* !defined(MONOTIME_COARSE_TYPE_IS_DIFFERENT) */
|
||||||
#define monotime_coarse_diff_nsec monotime_diff_nsec
|
#define monotime_coarse_diff_nsec monotime_diff_nsec
|
||||||
#define monotime_coarse_diff_usec monotime_diff_usec
|
#define monotime_coarse_diff_usec monotime_diff_usec
|
||||||
#define monotime_coarse_diff_msec monotime_diff_msec
|
#define monotime_coarse_diff_msec monotime_diff_msec
|
||||||
|
@ -25,7 +25,7 @@ struct ssl_ctx_st;
|
|||||||
struct ssl_session_st;
|
struct ssl_session_st;
|
||||||
typedef struct ssl_ctx_st tor_tls_context_impl_t;
|
typedef struct ssl_ctx_st tor_tls_context_impl_t;
|
||||||
typedef struct ssl_st tor_tls_impl_t;
|
typedef struct ssl_st tor_tls_impl_t;
|
||||||
#else /* !(defined(ENABLE_OPENSSL)) */
|
#else /* !defined(ENABLE_OPENSSL) */
|
||||||
struct PRFileDesc;
|
struct PRFileDesc;
|
||||||
typedef struct PRFileDesc tor_tls_context_impl_t;
|
typedef struct PRFileDesc tor_tls_context_impl_t;
|
||||||
typedef struct PRFileDesc tor_tls_impl_t;
|
typedef struct PRFileDesc tor_tls_impl_t;
|
||||||
@ -144,7 +144,7 @@ void check_no_tls_errors_(const char *fname, int line);
|
|||||||
|
|
||||||
void tor_tls_log_one_error(tor_tls_t *tls, unsigned long err,
|
void tor_tls_log_one_error(tor_tls_t *tls, unsigned long err,
|
||||||
int severity, int domain, const char *doing);
|
int severity, int domain, const char *doing);
|
||||||
#else /* !(defined(ENABLE_OPENSSL)) */
|
#else /* !defined(ENABLE_OPENSSL) */
|
||||||
#define check_no_tls_errors() STMT_NIL
|
#define check_no_tls_errors() STMT_NIL
|
||||||
#endif /* defined(ENABLE_OPENSSL) */
|
#endif /* defined(ENABLE_OPENSSL) */
|
||||||
|
|
||||||
|
@ -657,7 +657,7 @@ tor_tls_context_new(crypto_pk_t *identity, unsigned int key_lifetime,
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#else /* !(defined(SSL_CTX_set1_groups_list) || defined(HAVE_SSL_CTX_SET1... */
|
#else /* !(defined(SSL_CTX_set1_groups_list) || defined(HAVE_SSL_CTX_SE...)) */
|
||||||
if (! is_client) {
|
if (! is_client) {
|
||||||
int nid;
|
int nid;
|
||||||
EC_KEY *ec_key;
|
EC_KEY *ec_key;
|
||||||
@ -673,7 +673,7 @@ tor_tls_context_new(crypto_pk_t *identity, unsigned int key_lifetime,
|
|||||||
SSL_CTX_set_tmp_ecdh(result->ctx, ec_key);
|
SSL_CTX_set_tmp_ecdh(result->ctx, ec_key);
|
||||||
EC_KEY_free(ec_key);
|
EC_KEY_free(ec_key);
|
||||||
}
|
}
|
||||||
#endif /* defined(SSL_CTX_set1_groups_list) || defined(HAVE_SSL_CTX_SET1_... */
|
#endif /* defined(SSL_CTX_set1_groups_list) || defined(HAVE_SSL_CTX_SET1...) */
|
||||||
SSL_CTX_set_verify(result->ctx, SSL_VERIFY_PEER,
|
SSL_CTX_set_verify(result->ctx, SSL_VERIFY_PEER,
|
||||||
always_accept_verify_cb);
|
always_accept_verify_cb);
|
||||||
/* let us realloc bufs that we're writing from */
|
/* let us realloc bufs that we're writing from */
|
||||||
@ -764,7 +764,7 @@ find_cipher_by_id(const SSL *ssl, const SSL_METHOD *m, uint16_t cipher)
|
|||||||
tor_assert((SSL_CIPHER_get_id(c) & 0xffff) == cipher);
|
tor_assert((SSL_CIPHER_get_id(c) & 0xffff) == cipher);
|
||||||
return c != NULL;
|
return c != NULL;
|
||||||
}
|
}
|
||||||
#else /* !(defined(HAVE_SSL_CIPHER_FIND)) */
|
#else /* !defined(HAVE_SSL_CIPHER_FIND) */
|
||||||
|
|
||||||
# if defined(HAVE_STRUCT_SSL_METHOD_ST_GET_CIPHER_BY_CHAR)
|
# if defined(HAVE_STRUCT_SSL_METHOD_ST_GET_CIPHER_BY_CHAR)
|
||||||
if (m && m->get_cipher_by_char) {
|
if (m && m->get_cipher_by_char) {
|
||||||
|
@ -59,7 +59,7 @@ ENABLE_GCC_WARNING(redundant-decls)
|
|||||||
#define X509_get_notAfter(cert) \
|
#define X509_get_notAfter(cert) \
|
||||||
X509_getm_notAfter(cert)
|
X509_getm_notAfter(cert)
|
||||||
#endif
|
#endif
|
||||||
#else /* !(defined(OPENSSL_1_1_API)) */
|
#else /* !defined(OPENSSL_1_1_API) */
|
||||||
#define X509_get_notBefore_const(cert) \
|
#define X509_get_notBefore_const(cert) \
|
||||||
((const ASN1_TIME*) X509_get_notBefore((X509 *)cert))
|
((const ASN1_TIME*) X509_get_notBefore((X509 *)cert))
|
||||||
#define X509_get_notAfter_const(cert) \
|
#define X509_get_notAfter_const(cert) \
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "lib/trace/debug.h"
|
#include "lib/trace/debug.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* !(defined(TOR_EVENT_TRACING_ENABLED)) */
|
#else /* !defined(TOR_EVENT_TRACING_ENABLED) */
|
||||||
|
|
||||||
/* Reaching this point, we NOP every event declaration because event tracing
|
/* Reaching this point, we NOP every event declaration because event tracing
|
||||||
* is not been enabled at compile time. */
|
* is not been enabled at compile time. */
|
||||||
|
@ -138,7 +138,7 @@ LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
|||||||
return fuzz_main(Data, Size);
|
return fuzz_main(Data, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !(defined(LLVM_FUZZ)) */
|
#else /* !defined(LLVM_FUZZ) */
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
|
@ -1923,7 +1923,7 @@ test_crypto_curve25519_impl(void *arg)
|
|||||||
"e0544770bc7de853b38f9100489e3e79";
|
"e0544770bc7de853b38f9100489e3e79";
|
||||||
const char e1e2k_expected[] = "cd6e8269104eb5aaee886bd2071fba88"
|
const char e1e2k_expected[] = "cd6e8269104eb5aaee886bd2071fba88"
|
||||||
"bd13861475516bc2cd2b6e005e805064";
|
"bd13861475516bc2cd2b6e005e805064";
|
||||||
#else /* !(defined(SLOW_CURVE25519_TEST)) */
|
#else /* !defined(SLOW_CURVE25519_TEST) */
|
||||||
const int loop_max=200;
|
const int loop_max=200;
|
||||||
const char e1_expected[] = "bc7112cde03f97ef7008cad1bdc56be3"
|
const char e1_expected[] = "bc7112cde03f97ef7008cad1bdc56be3"
|
||||||
"c6a1037d74cceb3712e9206871dcf654";
|
"c6a1037d74cceb3712e9206871dcf654";
|
||||||
|
@ -1172,7 +1172,7 @@ test_options_validate__transproxy(void *ignored)
|
|||||||
// Assert that a test has run for some TransProxyType
|
// Assert that a test has run for some TransProxyType
|
||||||
tt_assert(tdata);
|
tt_assert(tdata);
|
||||||
|
|
||||||
#else /* !(defined(USE_TRANSPARENT)) */
|
#else /* !defined(USE_TRANSPARENT) */
|
||||||
tdata = get_options_test_data("TransPort 127.0.0.1:555\n");
|
tdata = get_options_test_data("TransPort 127.0.0.1:555\n");
|
||||||
|
|
||||||
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
|
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
|
||||||
|
@ -22,7 +22,7 @@ test_protover_parse(void *arg)
|
|||||||
tt_skip();
|
tt_skip();
|
||||||
done:
|
done:
|
||||||
;
|
;
|
||||||
#else /* !(defined(HAVE_RUST)) */
|
#else /* !defined(HAVE_RUST) */
|
||||||
char *re_encoded = NULL;
|
char *re_encoded = NULL;
|
||||||
|
|
||||||
const char *orig = "Foo=1,3 Bar=3 Baz= Quux=9-12,14,15-16,900";
|
const char *orig = "Foo=1,3 Bar=3 Baz= Quux=9-12,14,15-16,900";
|
||||||
|
@ -87,7 +87,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
fprintf(stderr, "This test is not supported on your OS.\n");
|
fprintf(stderr, "This test is not supported on your OS.\n");
|
||||||
return 77;
|
return 77;
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
const char *username;
|
const char *username;
|
||||||
const char *testname;
|
const char *testname;
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
|
@ -6123,7 +6123,7 @@ test_util_log_mallinfo(void *arg)
|
|||||||
} else {
|
} else {
|
||||||
tt_u64_op(mem1, OP_LT, mem2);
|
tt_u64_op(mem1, OP_LT, mem2);
|
||||||
}
|
}
|
||||||
#else /* !(defined(HAVE_MALLINFO)) */
|
#else /* !defined(HAVE_MALLINFO) */
|
||||||
tt_skip();
|
tt_skip();
|
||||||
#endif /* defined(HAVE_MALLINFO) */
|
#endif /* defined(HAVE_MALLINFO) */
|
||||||
done:
|
done:
|
||||||
@ -6182,7 +6182,7 @@ test_util_map_anon_nofork(void *arg)
|
|||||||
tt_skip();
|
tt_skip();
|
||||||
done:
|
done:
|
||||||
;
|
;
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
/* We have the right OS support. We're going to try marking the buffer as
|
/* We have the right OS support. We're going to try marking the buffer as
|
||||||
* either zero-on-fork or as drop-on-fork, whichever is supported. Then we
|
* either zero-on-fork or as drop-on-fork, whichever is supported. Then we
|
||||||
* will fork and send a byte back to the parent process. This will either
|
* will fork and send a byte back to the parent process. This will either
|
||||||
|
@ -63,7 +63,7 @@ mark_handled(int serial)
|
|||||||
tor_assert(! bitarray_is_set(handled, serial));
|
tor_assert(! bitarray_is_set(handled, serial));
|
||||||
bitarray_set(handled, serial);
|
bitarray_set(handled, serial);
|
||||||
tor_mutex_release(&bitmap_mutex);
|
tor_mutex_release(&bitmap_mutex);
|
||||||
#else /* !(defined(TRACK_RESPONSES)) */
|
#else /* !defined(TRACK_RESPONSES) */
|
||||||
(void)serial;
|
(void)serial;
|
||||||
#endif /* defined(TRACK_RESPONSES) */
|
#endif /* defined(TRACK_RESPONSES) */
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ setup_directory(void)
|
|||||||
(int)getpid(), rnd32);
|
(int)getpid(), rnd32);
|
||||||
r = mkdir(temp_dir);
|
r = mkdir(temp_dir);
|
||||||
}
|
}
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !defined(_WIN32) */
|
||||||
tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d_%s",
|
tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d_%s",
|
||||||
(int) getpid(), rnd32);
|
(int) getpid(), rnd32);
|
||||||
r = mkdir(temp_dir, 0700);
|
r = mkdir(temp_dir, 0700);
|
||||||
|
@ -468,7 +468,7 @@ pk_generate_internal(int bits)
|
|||||||
*idxp += crypto_rand_int_range(1,3);
|
*idxp += crypto_rand_int_range(1,3);
|
||||||
*idxp %= n_pregen;
|
*idxp %= n_pregen;
|
||||||
return crypto_pk_dup_key(pregen_array[*idxp]);
|
return crypto_pk_dup_key(pregen_array[*idxp]);
|
||||||
#else /* !(defined(USE_PREGENERATED_RSA_KEYS)) */
|
#else /* !defined(USE_PREGENERATED_RSA_KEYS) */
|
||||||
crypto_pk_t *result;
|
crypto_pk_t *result;
|
||||||
int res;
|
int res;
|
||||||
result = crypto_pk_new();
|
result = crypto_pk_new();
|
||||||
|
Loading…
Reference in New Issue
Block a user