Constify crypto_pk_get_digest().
Add better support to obfuscate statistics.
Fix: call circuit_has_opened() for rendezvous circuit

In circuit_get_open_circ_or_launch(), for a rendezvous circuit,
rend_client_rendcirc_has_opened() but circuit_has_opened() is preferred here
since it will call the right function for a specific circuit purpose.

Furthermore, a controller event is triggered where the former did not.

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Merge remote-tracking branch 'dgoulet/bug13936_025_v2'
Add two hidden-service related statistics.

The two statistics are:
 1. number of RELAY cells observed on successfully established
    rendezvous circuits; and
 2. number of .onion addresses observed as hidden-service
    directory.

Both statistics are accumulated over 24 hours, obfuscated by rounding
up to the next multiple of a given number and adding random noise,
and written to local file stats/hidserv-stats.

Notably, no statistics will be gathered on clients or services, but
only on relays.
HS stats: Add changes file and improve man page.
Merge branch 'asn-karsten-task-13192-5-squashed'
Fix unit test.

Looks like we forgot to update unit tests when we switched from 32-bit to
64-bit ints while tweaking 7cd53b7.
Define an int64_min when it is missing
LLONG_MIN => INT64_MIN.
Avoid building exit circuits unless we have a consensus that can build exit paths

Stop requiring a consensus containing exits, before new nodes
can test their ORPort reachability. Instead, allow tor to create
internal circuits when it receives a consensus with no exits.

This assists in bootstrapping a testing Tor network.

Fixes bugs 13718 & 13814.
Makes bug 13161's TestingDirAuthVoteExit non-essential.
Fix TestingMinExitFlagThreshold 0

Stop requiring exits to have non-zero bandwithcapacity in a
TestingTorNetwork. Instead, when TestingMinExitFlagThreshold is 0,
ignore exit bandwidthcapacity.

This assists in bootstrapping a testing Tor network.
Fixes bugs 13718 & 13839.
Makes bug 13161's TestingDirAuthVoteExit non-essential.
Fix Reachability when DirAllowPrivateAddresses is 1

Stop assuming that DirAllowPrivateAddresses is 0 when checking
reachability. Instead, if DirAllowPrivateAddresses is 1, assume
all OR connections are remote. (This is necessary due to many test
scenarios running all nodes on localhost.)

This assists in bootstrapping a testing Tor network.

Fixes bugs 13718 & 13924.
Allow consensus interval of 10 seconds when testing

Decrease minimum consensus interval to 10 seconds
when TestingTorNetwork is set. (Or 5 seconds for
the first consensus.)

Fix code that assumes larger interval values.

This assists in quickly bootstrapping a testing
Tor network.

Fixes bugs 13718 & 13823.
Fix clang warning, IPv6 address comment, buffer size typo

The address of an array in the middle of a structure will
always be non-NULL. clang recognises this and complains.
Disable the tautologous and redundant check to silence
this warning.

A comment about an IPv6 address string incorrectly refers
to an IPv4 address format.

A log buffer is sized 10024 rather than 10240.

Fixes bug 14001.
Fix transparent proxy checks to allow OS X to use ipfw or pf

OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent
proxy option checks to allow for both ipfw and pf on OS X.

Fixes bug 14002.
Increase reachability testing rate in faster Tor networks

Increase reachability testing rate proportionally when
TestingAuthDirTimeToLearnReachability has a low value.

Refactor the relevant function.

This assists in bootstrapping a testing Tor network.

Fixes bugs 13718 & 13929.
Fix If-Modified-Since in rapidly updating Tor networks

When V3AuthVotingInterval is low, decrease the delay on the
If-Modified-Since header passed to directory servers.
This allows us to obtain consensuses promptly when the consensus
interval is very short.

This assists in bootstrapping a testing Tor network.

Fixes bugs 13718 & 13963.
Randomise Authority Reachability Testing Sequence

Tor authorities' reachability testing of relays is predictable,
as it is sequential, always starts at the lowest fingerprints, and
checks fingerprints in numeric order. This means that authorities
that start in the same 10-second period, check the reachability
of the same relays at the same time.
(This is more of an issue in testing networks.)

To fix this, each authority picks a random start point and
sequence order when it starts reachability testing.

This may improve the accuracy, reliability, and/or security
of reachability testing.

Fixes bug 13928. Relies on fixes in bug 13929.
Merge branch 'bug14001-clang-warning' into bug13718-bug13928-bug14001-reachability-no-warning