mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
rip out rend_id_is_in_interval()
it was used by hid_serv_responsible_for_desc_id(), which we no longer use.
This commit is contained in:
@@ -688,37 +688,6 @@ rend_get_service_id(crypto_pk_t *pk, char *out)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Determines whether <b>a</b> is in the interval of <b>b</b> (excluded) and
|
||||
* <b>c</b> (included) in a circular digest ring; returns 1 if this is the
|
||||
* case, and 0 otherwise.
|
||||
*/
|
||||
int
|
||||
rend_id_is_in_interval(const char *a, const char *b, const char *c)
|
||||
{
|
||||
int a_b, b_c, c_a;
|
||||
tor_assert(a);
|
||||
tor_assert(b);
|
||||
tor_assert(c);
|
||||
|
||||
/* There are five cases in which a is outside the interval ]b,c]: */
|
||||
a_b = tor_memcmp(a,b,DIGEST_LEN);
|
||||
if (a_b == 0)
|
||||
return 0; /* 1. a == b (b is excluded) */
|
||||
b_c = tor_memcmp(b,c,DIGEST_LEN);
|
||||
if (b_c == 0)
|
||||
return 0; /* 2. b == c (interval is empty) */
|
||||
else if (a_b <= 0 && b_c < 0)
|
||||
return 0; /* 3. a b c */
|
||||
c_a = tor_memcmp(c,a,DIGEST_LEN);
|
||||
if (c_a < 0 && a_b <= 0)
|
||||
return 0; /* 4. c a b */
|
||||
else if (b_c < 0 && c_a < 0)
|
||||
return 0; /* 5. b c a */
|
||||
|
||||
/* In the other cases (a c b; b a c; c b a), a is inside the interval. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Return true iff <b>query</b> is a syntactically valid service ID (as
|
||||
* generated by rend_get_service_id). */
|
||||
int
|
||||
|
||||
@@ -53,7 +53,6 @@ int rend_encode_v2_descriptors(smartlist_t *descs_out,
|
||||
int rend_compute_v2_desc_id(char *desc_id_out, const char *service_id,
|
||||
const char *descriptor_cookie,
|
||||
time_t now, uint8_t replica);
|
||||
int rend_id_is_in_interval(const char *a, const char *b, const char *c);
|
||||
void rend_get_descriptor_id_bytes(char *descriptor_id_out,
|
||||
const char *service_id,
|
||||
const char *secret_id_part);
|
||||
|
||||
Reference in New Issue
Block a user