diff options
-rw-r--r-- | src/common/aes.c | 4 | ||||
-rw-r--r-- | src/common/crypto.c | 29 | ||||
-rw-r--r-- | src/common/mempool.c | 2 | ||||
-rw-r--r-- | src/common/mempool.h | 6 | ||||
-rw-r--r-- | src/common/tortls.c | 2 | ||||
-rw-r--r-- | src/common/util.c | 2 | ||||
-rw-r--r-- | src/or/circuitbuild.c | 12 | ||||
-rw-r--r-- | src/or/connection_or.c | 3 | ||||
-rw-r--r-- | src/or/directory.c | 2 | ||||
-rw-r--r-- | src/or/networkstatus.c | 2 | ||||
-rw-r--r-- | src/or/rephist.c | 4 | ||||
-rw-r--r-- | src/or/test.c | 23 |
12 files changed, 51 insertions, 40 deletions
diff --git a/src/common/aes.c b/src/common/aes.c index cd8317dd11..96d5ca4126 100644 --- a/src/common/aes.c +++ b/src/common/aes.c @@ -286,7 +286,7 @@ aes_crypt(aes_cnt_cipher_t *cipher, const char *input, size_t len, /* XXXX This function is up to 5% of our runtime in some profiles; * we should look into unrolling some of the loops; taking advantage - * of alignmement, using a bigger buffer, and so on. Not till after 0.1.2.x, + * of alignment, using a bigger buffer, and so on. Not till after 0.1.2.x, * though. */ int c = cipher->pos; if (PREDICT_UNLIKELY(!len)) return; @@ -322,7 +322,7 @@ aes_crypt_inplace(aes_cnt_cipher_t *cipher, char *data, size_t len) /* XXXX This function is up to 5% of our runtime in some profiles; * we should look into unrolling some of the loops; taking advantage - * of alignmement, using a bigger buffer, and so on. Not till after 0.1.2.x, + * of alignment, using a bigger buffer, and so on. Not till after 0.1.2.x, * though. */ int c = cipher->pos; if (PREDICT_UNLIKELY(!len)) return; diff --git a/src/common/crypto.c b/src/common/crypto.c index 01e32524c6..cd10e649c4 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -1550,12 +1550,12 @@ crypto_dh_compute_secret(crypto_dh_env_t *dh, goto error; } secret_len = result; - /* sometimes secret_len might be less than 128, e.g., 127. that's ok. */ + /* sometimes secret_len might be less than 128, e.g., 127. that's ok. -RD */ /* Actually, http://www.faqs.org/rfcs/rfc2631.html says: * Leading zeros MUST be preserved, so that ZZ occupies as many * octets as p. For instance, if p is 1024 bits, ZZ should be 128 * bytes long. - * What are the security implications here? + * XXX021 What are the security implications here? -NM */ if (crypto_expand_key_material(secret_tmp, secret_len, secret_out, secret_bytes_out)<0) @@ -1578,7 +1578,7 @@ crypto_dh_compute_secret(crypto_dh_env_t *dh, /** Given <b>key_in_len</b> bytes of negotiated randomness in <b>key_in</b> * ("K"), expand it into <b>key_out_len</b> bytes of negotiated key material in - * <b>key_out</b> by taking the first key_out_len bytes of + * <b>key_out</b> by taking the first <b>key_out_len</b> bytes of * H(K | [00]) | H(K | [01]) | .... * * Return 0 on success, -1 on failure. @@ -1710,7 +1710,7 @@ crypto_seed_rng(void) #endif } -/** Write n bytes of strong random data to <b>to</b>. Return 0 on +/** Write <b>n</b> bytes of strong random data to <b>to</b>. Return 0 on * success, -1 on failure. */ int @@ -1725,7 +1725,7 @@ crypto_rand(char *to, size_t n) } /** Return a pseudorandom integer, chosen uniformly from the values - * between 0 and max-1. */ + * between 0 and <b>max</b>-1. */ int crypto_rand_int(unsigned int max) { @@ -1746,8 +1746,8 @@ crypto_rand_int(unsigned int max) } } -/** Return a pseudorandom integer, chosen uniformly from the values - * between 0 and max-1. */ +/** Return a pseudorandom 64-bit integer, chosen uniformly from the values + * between 0 and <b>max</b>-1. */ uint64_t crypto_rand_uint64(uint64_t max) { @@ -1768,9 +1768,10 @@ crypto_rand_uint64(uint64_t max) } } -/** Generate and return a new random hostname starting with prefix, ending - * with suffix, and containing between min_rand_len and max_rand_len random - * base32 characters between. */ +/** Generate and return a new random hostname starting with <b>prefix</b>, + * ending with <b>suffix</b>, and containing no less than + * <b>min_rand_len</b> and no more than <b>max_rand_len</b> random base32 + * characters between. */ char * crypto_random_hostname(int min_rand_len, int max_rand_len, const char *prefix, const char *suffix) @@ -1799,8 +1800,8 @@ crypto_random_hostname(int min_rand_len, int max_rand_len, const char *prefix, return result; } -/** Return a randomly chosen element of sl; or NULL if sl is empty. - */ +/** Return a randomly chosen element of <b>sl</b>; or NULL if <b>sl</b> + * is empty. */ void * smartlist_choose(const smartlist_t *sl) { @@ -1811,7 +1812,7 @@ smartlist_choose(const smartlist_t *sl) return NULL; /* no elements to choose from */ } -/** Scramble the elements of sl into a random order. */ +/** Scramble the elements of <b>sl</b> into a random order. */ void smartlist_shuffle(smartlist_t *sl) { @@ -1834,7 +1835,7 @@ smartlist_shuffle(smartlist_t *sl) int base64_encode(char *dest, size_t destlen, const char *src, size_t srclen) { - /* XXXX we might want to rewrite this along the lines of base64_decode, if + /* FFFF we might want to rewrite this along the lines of base64_decode, if * it ever shows up in the profile. */ EVP_ENCODE_CTX ctx; int len, ret; diff --git a/src/common/mempool.c b/src/common/mempool.c index 43f10c1e44..7e2369fc43 100644 --- a/src/common/mempool.c +++ b/src/common/mempool.c @@ -204,7 +204,7 @@ add_newly_used_chunk_to_used_list(mp_pool_t *pool, mp_chunk_t *chunk) ASSERT(!chunk->prev); } -/** Return an newly allocated item from <b>pool</b>. */ +/** Return a newly allocated item from <b>pool</b>. */ void * mp_pool_get(mp_pool_t *pool) { diff --git a/src/common/mempool.h b/src/common/mempool.h index 2c5c925f77..2344c01cba 100644 --- a/src/common/mempool.h +++ b/src/common/mempool.h @@ -50,11 +50,11 @@ struct mp_pool_t { * padding. */ size_t item_alloc_size; #ifdef MEMPOOL_STATS - /** Total number of items allocated ever */ + /** Total number of items allocated ever. */ uint64_t total_items_allocated; - /** Total number of chunks allocated ever */ + /** Total number of chunks allocated ever. */ uint64_t total_chunks_allocated; - /** Total number of chunks freed ever */ + /** Total number of chunks freed ever. */ uint64_t total_chunks_freed; #endif }; diff --git a/src/common/tortls.c b/src/common/tortls.c index 55bdfcd763..51ce4a6c3a 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -322,7 +322,7 @@ always_accept_verify_cb(int preverify_ok, return 1; } -/** Return a newly allocated X509 name with commonName <b>cname</b> */ +/** Return a newly allocated X509 name with commonName <b>cname</b>. */ static X509_NAME * tor_x509_name_new(const char *cname) { diff --git a/src/common/util.c b/src/common/util.c index 0631fdcb8f..8d1d08a8be 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -707,7 +707,7 @@ tor_parse_long(const char *s, int base, long min, long max, CHECK_STRTOX_RESULT(); } -/** As tor_parse_long, but return an unsigned long. */ +/** As tor_parse_long(), but return an unsigned long. */ unsigned long tor_parse_ulong(const char *s, int base, unsigned long min, unsigned long max, int *ok, char **next) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index c295d8aada..3216433a80 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2822,15 +2822,23 @@ getinfo_helper_entry_guards(control_connection_t *conn, return 0; } -/** DOCDOC arma */ +/** Information about a configured bridge. Currently this just matches the + * ones in the torrc file, but one day we may be able to learn about new + * bridges on our own, and remember them in the state file. */ typedef struct { + /** IPv4 address of the bridge. */ uint32_t addr; + /** TLS port for the bridge. */ uint16_t port; + /** Expected identity digest, or all \0's if we don't know what the + * digest should be. */ char identity[DIGEST_LEN]; + /** When should we next try to fetch a descriptor for this bridge? */ download_status_t fetch_status; } bridge_info_t; -/** A list of known bridges. */ +/** A list of configured bridges. Whenever we actually get a descriptor + * for one, we add it as an entry guard. */ static smartlist_t *bridge_list = NULL; /** Initialize the bridge list to empty, creating it if needed. */ diff --git a/src/or/connection_or.c b/src/or/connection_or.c index f2bd54a494..79e7be2c21 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -174,13 +174,14 @@ var_cell_new(uint16_t payload_len) return cell; } -/** Release all space held by <b>cell</b> */ +/** Release all space held by <b>cell</b>. */ void var_cell_free(var_cell_t *cell) { tor_free(cell); } +/** We've received an EOF from <b>conn</b>. Mark it for close and return. */ int connection_or_reached_eof(or_connection_t *conn) { diff --git a/src/or/directory.c b/src/or/directory.c index 31e4d67d6c..8ca183cfe6 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1876,7 +1876,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) return 0; } -/** Called when a directory connection reaches EOF */ +/** Called when a directory connection reaches EOF. */ int connection_dir_reached_eof(dir_connection_t *conn) { diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 972b16e0f2..6ac4e2c6ad 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -786,7 +786,7 @@ networkstatus_vote_find_entry(networkstatus_t *ns, const char *digest) /*XXXX make this static once functions are moved into this file. */ /** Search the routerstatuses in <b>ns</b> for one whose identity digest is * <b>digest</b>. Return value and set *<b>found_out</b> as for - * smartlist_besearch_idx(). */ + * smartlist_bsearch_idx(). */ int networkstatus_vote_find_entry_idx(networkstatus_t *ns, const char *digest, int *found_out) diff --git a/src/or/rephist.c b/src/or/rephist.c index 6f973be61b..edeb43444f 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -19,9 +19,9 @@ static void bw_arrays_init(void); static void predicted_ports_init(void); static void hs_usage_init(void); -/** Total number of bytes currently allocated in fields used by rephist.c */ +/** Total number of bytes currently allocated in fields used by rephist.c. */ uint64_t rephist_total_alloc=0; -/** Number of or_history_t obects currently allocated */ +/** Number of or_history_t objects currently allocated. */ uint32_t rephist_total_num=0; /** If the total weighted run count of all runs for a router ever falls diff --git a/src/or/test.c b/src/or/test.c index 4b8081bf0f..d390009b8f 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -1081,20 +1081,20 @@ _test_eq_ip6(struct in6_addr *a, struct in6_addr *b, const char *e1, #define test_eq_ip6(a,b) _test_eq_ip6((a),(b),#a,#b,__LINE__) /** Helper: Assert that two strings both decode as IPv6 addresses with - * tor_inet_pton, and both decode to the same address. */ + * tor_inet_pton(), and both decode to the same address. */ #define test_pton6_same(a,b) STMT_BEGIN \ test_eq(tor_inet_pton(AF_INET6, a, &a1), 1); \ test_eq(tor_inet_pton(AF_INET6, b, &a2), 1); \ _test_eq_ip6(&a1,&a2,#a,#b,__LINE__); \ STMT_END -/** Helper: Assert that <b>a</b> is recognized as a bed IPv6 address by - * tor_inet_pton. */ +/** Helper: Assert that <b>a</b> is recognized as a bad IPv6 address by + * tor_inet_pton(). */ #define test_pton6_bad(a) \ test_eq(0, tor_inet_pton(AF_INET6, a, &a1)) -/** Helper: assert that <b>a</b> when parsed by tor_inet_pton and displayed - * with tor_inet_ntop, yields <b>b</b>. Also assert that <b>b</b> parses to +/** Helper: assert that <b>a</b>, when parsed by tor_inet_pton() and displayed + * with tor_inet_ntop(), yields <b>b</b>. Also assert that <b>b</b> parses to * the same value as <b>a</b>. */ #define test_ntop6_reduces(a,b) STMT_BEGIN \ test_eq(tor_inet_pton(AF_INET6, a, &a1), 1); \ @@ -1103,8 +1103,8 @@ _test_eq_ip6(struct in6_addr *a, struct in6_addr *b, const char *e1, _test_eq_ip6(&a1, &a2, a, b, __LINE__); \ STMT_END -/** Helper: assert that <b>a</a> parses by tor_inet_pton into a address that - * passes tor_addr_is_internal with for_listening */ +/** Helper: assert that <b>a</a> parses by tor_inet_pton() into a address that + * passes tor_addr_is_internal() with <b>for_listening</b> */ #define test_internal_ip(a,for_listening) STMT_BEGIN \ test_eq(tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr), 1); \ t1.family = AF_INET6; \ @@ -1112,8 +1112,8 @@ _test_eq_ip6(struct in6_addr *a, struct in6_addr *b, const char *e1, test_fail_msg( a "was not internal."); \ STMT_END -/** Helper: assert that <b>a</a> parses by tor_inet_pton into a address that - * does not pass tor_addr_is_internal with for_listening. */ +/** Helper: assert that <b>a</a> parses by tor_inet_pton() into a address that + * does not pass tor_addr_is_internal() with <b>for_listening</b>. */ #define test_external_ip(a,for_listening) STMT_BEGIN \ test_eq(tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr), 1); \ t1.family = AF_INET6; \ @@ -1121,8 +1121,9 @@ _test_eq_ip6(struct in6_addr *a, struct in6_addr *b, const char *e1, test_fail_msg(a "was not external."); \ STMT_END -/** Helper: Assert that a and b, when parsed by tor_inet_pton, give addresses - * that compare in the order defined by op with tor_addr_compare(). */ +/** Helper: Assert that <b>a</b> and <b>b</b>, when parsed by + * tor_inet_pton(), give addresses that compare in the order defined by + * <b>op</b> with tor_addr_compare(). */ #define test_addr_compare(a, op, b) STMT_BEGIN \ test_eq(tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr), 1); \ test_eq(tor_inet_pton(AF_INET6, b, &t2.addr.in6_addr), 1); \ |