Faster circuit_get_by_rend_token_and_purpose()

On busy servers, this function takes up something like 3-7% in
different profiles, and gets invoked every time we need to participate
as the midpoint in a hidden service.

So maybe walking through a linked list of all the circuits here wasn't
a good idea.
Merge remote-tracking branch 'public/bug9841_024_v2' into bug9841_025

Conflicts:
	src/or/circuitlist.c
Tweak sign of rend_token params for consistency
Tests for rend_token maps

This gets coverage of everything except for the cases which should be
impossible.
Log descriptor-download bootstrapping messages less verbosely

This is a fix for 9963.  I say this is a feature, but if it's a
bugfix, it's a bugfix on 0.2.4.18-rc.

Old behavior:

    Mar 27 11:02:19.000 [notice] Bootstrapped 50%: Loading relay descriptors.
    Mar 27 11:02:20.000 [notice] Bootstrapped 51%: Loading relay descriptors.
    Mar 27 11:02:20.000 [notice] Bootstrapped 52%: Loading relay descriptors.
    ... [Many lines omitted] ...
    Mar 27 11:02:29.000 [notice] Bootstrapped 78%: Loading relay descriptors.
    Mar 27 11:02:33.000 [notice] We now have enough directory information to build circuits.

New behavior:

    Mar 27 11:16:17.000 [notice] Bootstrapped 50%: Loading relay descriptors
    Mar 27 11:16:19.000 [notice] Bootstrapped 55%: Loading relay descriptors
    Mar 27 11:16:21.000 [notice] Bootstrapped 60%: Loading relay descriptors
    Mar 27 11:16:21.000 [notice] Bootstrapped 65%: Loading relay descriptors
    Mar 27 11:16:21.000 [notice] Bootstrapped 70%: Loading relay descriptors
    Mar 27 11:16:21.000 [notice] Bootstrapped 75%: Loading relay descriptors
    Mar 27 11:16:21.000 [notice] We now have enough directory information to build circuits.
Report only the first bootstrap failure from an orconn

Otherwise, when we report "identity mismatch", we then later report
DONE when the connection gets closed.

Fixes bug 10431; bugfix on 0.2.1.1-alpha.
Drop MAX_REND_FAILURES to 8
Fix to 9841 fix: setting a token to NULL should clear it

Found by testing with chutney.  The old behavior was "fail an
assertion", which obviously isn't optimal.

Bugfix on 8b9a2cb68b290e550695124d7ef0511225b451d5; bug not in any
released version.
Merge remote-tracking branch 'public/bug9841_024_v2' into bug9841_025
Test for circuit_set_rend_token(.,.,NULL)
Protocol_Warn when a rendezvous cookie is used twice.
Make csiphash use the proper endian-converter on solaris

fixes bug 11426; bugfix on 0.2.5.3-alpha, where csiphash was
introduced.
Fix bug9665
Forward-port bug9665 fix to work with our fix for 11069
For missing transport, say "PT_MISSING" not "NO_ROUTE"
Changes file for bug9665
Merge branch 'bug9665_redux'
Fix undefined behavior with pointer addition in channeltls.c

In C, it's a bad idea to do this:

   char *cp = array;
   char *end = array + array_len;

   /* .... */

   if (cp + 3 >= end) { /* out of bounds */ }

because cp+3 might be more than one off the end of the array, and
you are only allowed to construct pointers to the array elements,
and to an element one past the end.  Instead you have to say

   if (cp - array + 3 >= array_len) { /* ... */ }

or something like that.

This patch fixes two of these: one in process_versions_cell
introduced in 0.2.0.10-alpha, and one in process_certs_cell
introduced in 0.2.3.6-alpha.  These are both tracked under bug
10363. "bobnomnom" found and reported both. See also 10313.

In our code, this is likely to be a problem as we used it only if we
get a nasty allocator that makes allocations end close to (void*)-1.
But it's best not to have to worry about such things at all, so
let's just fix all of these we can find.
Another 10363 instance: this one in tor_memmem fallback code
Another 10363 instance -- this one in the eventdns.c code