More cleanups noticed by weasel; also, remove macros that nobody uses.

svn:r6143
This commit is contained in:
Nick Mathewson 2006-03-12 23:31:16 +00:00
parent 474c60b743
commit bd8ffccae7
12 changed files with 13 additions and 45 deletions

View File

@ -48,8 +48,6 @@ typedef uint32_t u32;
typedef uint8_t u8; typedef uint8_t u8;
#ifndef USE_OPENSSL_AES #ifndef USE_OPENSSL_AES
#define MAXKC (256/32)
#define MAXKB (256/8)
#define MAXNR 14 #define MAXNR 14
static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/],

View File

@ -63,28 +63,14 @@ const char crypto_c_id[] =
#if OPENSSL_VERSION_NUMBER < 0x00905000l #if OPENSSL_VERSION_NUMBER < 0x00905000l
#error "We require openssl >= 0.9.5" #error "We require openssl >= 0.9.5"
#elif OPENSSL_VERSION_NUMBER < 0x00906000l
#define OPENSSL_095
#endif #endif
#if OPENSSL_VERSION_NUMBER < 0x00907000l #if OPENSSL_VERSION_NUMBER < 0x00907000l
#define OPENSSL_PRE_097
#define NO_ENGINES #define NO_ENGINES
#else #else
#include <openssl/engine.h> #include <openssl/engine.h>
#endif #endif
/* Certain functions that return a success code in OpenSSL 0.9.6 return void
* (and don't indicate errors) in OpenSSL version 0.9.5.
*
* [OpenSSL 0.9.5 matters, because it ships with Redhat 6.2.]
*/
#ifdef OPENSSL_095
#define RETURN_SSL_OUTCOME(exp) (exp); return 0
#else
#define RETURN_SSL_OUTCOME(exp) return !(exp)
#endif
/** Macro: is k a valid RSA public or private key? */ /** Macro: is k a valid RSA public or private key? */
#define PUBLIC_KEY_OK(k) ((k) && (k)->key && (k)->key->n) #define PUBLIC_KEY_OK(k) ((k) && (k)->key && (k)->key->n)
/** Macro: is k a valid RSA private key? */ /** Macro: is k a valid RSA private key? */

View File

@ -69,7 +69,6 @@ uint64_t buf_total_alloc = 0;
/** Size, in bytes, for minimum 'shrink' size for buffers. Buffers may start /** Size, in bytes, for minimum 'shrink' size for buffers. Buffers may start
* out smaller than this, but they will never autoshrink to less * out smaller than this, but they will never autoshrink to less
* than this size. */ * than this size. */
#define MIN_GREEDY_SHRINK_SIZE (16*1024)
#define MIN_LAZY_SHRINK_SIZE (4*1024) #define MIN_LAZY_SHRINK_SIZE (4*1024)
static INLINE void peek_from_buf(char *string, size_t string_len, buf_t *buf); static INLINE void peek_from_buf(char *string, size_t string_len, buf_t *buf);
@ -1156,8 +1155,6 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
} }
} }
#define CONTROL_CMD_FRAGMENTHEADER 0x0010
#define CONTROL_CMD_FRAGMENT 0x0011
/** If there is a complete version 0 control message waiting on buf, then store /** If there is a complete version 0 control message waiting on buf, then store
* its contents into *<b>type_out</b>, store its body's length into * its contents into *<b>type_out</b>, store its body's length into
* *<b>len_out</b>, allocate and store a string for its body into * *<b>len_out</b>, allocate and store a string for its body into

View File

@ -336,9 +336,6 @@ typedef struct {
*(uint32_t*)STRUCT_VAR_P(cfg,fmt->magic_offset)); \ *(uint32_t*)STRUCT_VAR_P(cfg,fmt->magic_offset)); \
} while (0) } while (0)
/** Largest allowed config line */
#define CONFIG_LINE_T_MAXLEN 4096
static void config_line_append(config_line_t **lst, static void config_line_append(config_line_t **lst,
const char *key, const char *val); const char *key, const char *val);
static void option_clear(config_format_t *fmt, or_options_t *options, static void option_clear(config_format_t *fmt, or_options_t *options,
@ -4140,6 +4137,9 @@ config_getinfo_helper(const char *question, char **answer)
return 0; return 0;
} }
#include "../common/ht.h"
#include "../common/test.h"
/** Dump the version of every file to the log. */ /** Dump the version of every file to the log. */
static void static void
print_cvs_version(void) print_cvs_version(void)
@ -4184,6 +4184,8 @@ print_cvs_version(void)
puts(COMPAT_H_ID); puts(COMPAT_H_ID);
puts(CONTAINER_H_ID); puts(CONTAINER_H_ID);
puts(CRYPTO_H_ID); puts(CRYPTO_H_ID);
puts(HT_H_ID);
puts(TEST_H_ID);
puts(LOG_H_ID); puts(LOG_H_ID);
puts(TORGZIP_H_ID); puts(TORGZIP_H_ID);
puts(TORINT_H_ID); puts(TORINT_H_ID);

View File

@ -2113,6 +2113,8 @@ assert_connection_ok(connection_t *conn, time_t now)
case CONN_TYPE_EXIT: case CONN_TYPE_EXIT:
tor_assert(conn->state >= _EXIT_CONN_STATE_MIN); tor_assert(conn->state >= _EXIT_CONN_STATE_MIN);
tor_assert(conn->state <= _EXIT_CONN_STATE_MAX); tor_assert(conn->state <= _EXIT_CONN_STATE_MAX);
tor_assert(conn->purpose >= _EXIT_PURPOSE_MIN);
tor_assert(conn->purpose <= _EXIT_PURPOSE_MAX);
break; break;
case CONN_TYPE_AP: case CONN_TYPE_AP:
tor_assert(conn->state >= _AP_CONN_STATE_MIN); tor_assert(conn->state >= _AP_CONN_STATE_MIN);
@ -2126,8 +2128,8 @@ assert_connection_ok(connection_t *conn, time_t now)
tor_assert(conn->purpose <= _DIR_PURPOSE_MAX); tor_assert(conn->purpose <= _DIR_PURPOSE_MAX);
break; break;
case CONN_TYPE_DNSWORKER: case CONN_TYPE_DNSWORKER:
tor_assert(conn->state == DNSWORKER_STATE_IDLE || tor_assert(conn->state >= _DNSWORKER_STATE_MIN);
conn->state == DNSWORKER_STATE_BUSY); tor_assert(conn->state <= _DNSWORKER_STATE_MAX);
break; break;
case CONN_TYPE_CPUWORKER: case CONN_TYPE_CPUWORKER:
tor_assert(conn->state >= _CPUWORKER_STATE_MIN); tor_assert(conn->state >= _CPUWORKER_STATE_MIN);

View File

@ -16,6 +16,7 @@ const char connection_or_c_id[] =
/** How much clock skew do we tolerate when checking certificates for /** How much clock skew do we tolerate when checking certificates for
* known routers? (sec) */ * known routers? (sec) */
#define TIGHT_CERT_ALLOW_SKEW (90*60) #define TIGHT_CERT_ALLOW_SKEW (90*60)
static int connection_tls_finish_handshake(connection_t *conn); static int connection_tls_finish_handshake(connection_t *conn);

View File

@ -23,8 +23,6 @@ const char cpuworker_c_id[] =
/** The tag specifies which circuit this onionskin was from. */ /** The tag specifies which circuit this onionskin was from. */
#define TAG_LEN 8 #define TAG_LEN 8
/** How many bytes are sent from tor to the cpuworker? */
#define LEN_ONION_QUESTION (1+TAG_LEN+ONIONSKIN_CHALLENGE_LEN)
/** How many bytes are sent from the cpuworker back to tor? */ /** How many bytes are sent from the cpuworker back to tor? */
#define LEN_ONION_RESPONSE \ #define LEN_ONION_RESPONSE \
(1+TAG_LEN+ONIONSKIN_REPLY_LEN+CPATH_KEY_MATERIAL_LEN) (1+TAG_LEN+ONIONSKIN_REPLY_LEN+CPATH_KEY_MATERIAL_LEN)

View File

@ -96,7 +96,7 @@ static char* nt_strerror(uint32_t errnum);
* that would require an upload? */ * that would require an upload? */
#define CHECK_DESCRIPTOR_INTERVAL (60) #define CHECK_DESCRIPTOR_INTERVAL (60)
/** How often do we (as a router) check whether our IP address has changed? */ /** How often do we (as a router) check whether our IP address has changed? */
#define CHECK_IPADDRESS_INTERVAL (15*60) /* 15 minutes */ #define CHECK_IPADDRESS_INTERVAL (15*60)
/** How often do we check buffers for empty space that can be deallocated? */ /** How often do we check buffers for empty space that can be deallocated? */
#define BUF_SHRINK_INTERVAL (60) #define BUF_SHRINK_INTERVAL (60)
/** How often do we check for router descriptors that we should download? */ /** How often do we check for router descriptors that we should download? */

View File

@ -534,10 +534,6 @@ typedef enum {
/** How long to test reachability before complaining to the user. */ /** How long to test reachability before complaining to the user. */
#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) #define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60)
/* people behind fascist firewalls use only these ports */
#define REQUIRED_FIREWALL_DIRPORT 80
#define REQUIRED_FIREWALL_ORPORT 443
/* legal characters in a nickname */ /* legal characters in a nickname */
#define LEGAL_NICKNAME_CHARACTERS \ #define LEGAL_NICKNAME_CHARACTERS \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
@ -1689,10 +1685,6 @@ connection_t *connection_get_by_type_state_rendquery(int type, int state,
const char *rendquery); const char *rendquery);
#define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR) #define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR)
#define connection_has_pending_tls_data(conn) \
((conn)->type == CONN_TYPE_OR && \
(conn)->state == OR_CONN_STATE_OPEN && \
tor_tls_get_pending_bytes((conn)->tls))
int connection_is_listener(connection_t *conn); int connection_is_listener(connection_t *conn);
int connection_state_is_open(connection_t *conn); int connection_state_is_open(connection_t *conn);
int connection_state_is_connecting(connection_t *conn); int connection_state_is_connecting(connection_t *conn);

View File

@ -233,7 +233,7 @@ rend_get_service_id(crypto_pk_env_t *pk, char *out)
/** How old do we let hidden service descriptors get discarding them as too /** How old do we let hidden service descriptors get discarding them as too
* old? */ * old? */
#define REND_CACHE_MAX_AGE (48*60*60) #define REND_CACHE_MAX_AGE (2*24*60*60)
/** How wrong to we assume our clock may be when checking whether hidden /** How wrong to we assume our clock may be when checking whether hidden
* services are too old or too new? */ * services are too old or too new? */
#define REND_CACHE_MAX_SKEW (24*60*60) #define REND_CACHE_MAX_SKEW (24*60*60)

View File

@ -27,7 +27,7 @@ typedef struct rend_service_port_config_t {
#define NUM_INTRO_POINTS 3 #define NUM_INTRO_POINTS 3
/** If we can't build our intro circuits, don't retry for this long. */ /** If we can't build our intro circuits, don't retry for this long. */
#define INTRO_CIRC_RETRY_PERIOD 60*5 #define INTRO_CIRC_RETRY_PERIOD (60*5)
/** Don't try to build more than this many circuits before giving up /** Don't try to build more than this many circuits before giving up
* for a while.*/ * for a while.*/
#define MAX_INTRO_CIRCS_PER_PERIOD 10 #define MAX_INTRO_CIRCS_PER_PERIOD 10
@ -927,10 +927,6 @@ upload_service_descriptor(rend_service_t *service, int version)
service->desc_is_dirty = 0; service->desc_is_dirty = 0;
} }
/* XXXX Make this longer once directories remember service descriptors across
* restarts.*/
#define MAX_SERVICE_PUBLICATION_INTERVAL (15*60)
/** For every service, check how many intro points it currently has, and: /** For every service, check how many intro points it currently has, and:
* - Pick new intro points as necessary. * - Pick new intro points as necessary.
* - Launch circuits to any new intro points. * - Launch circuits to any new intro points.

View File

@ -3437,10 +3437,6 @@ update_router_descriptor_client_downloads(time_t now)
/** When directory clients have only a few servers to request, they batch /** When directory clients have only a few servers to request, they batch
* them until they have more, or until this amount of time has passed. */ * them until they have more, or until this amount of time has passed. */
#define MAX_CLIENT_INTERVAL_WITHOUT_REQUEST (10*60) #define MAX_CLIENT_INTERVAL_WITHOUT_REQUEST (10*60)
/** When directory caches and authorities have only a few servers to
* request, they batch them until they have more, or until this amount of
* time has passed. */
#define MAX_SERVER_INTERVAL_WITHOUT_REQUEST (60)
smartlist_t *downloadable = NULL; smartlist_t *downloadable = NULL;
int should_delay, n_downloadable; int should_delay, n_downloadable;
or_options_t *options = get_options(); or_options_t *options = get_options();