[tor-commits] [tor/master] rip out rend_id_is_in_interval()

nickm at torproject.org nickm at torproject.org
Mon Mar 21 14:41:31 UTC 2016


commit dc500c8cb4dc7643230d160d1b458a0acdadd242
Author: Roger Dingledine <arma at torproject.org>
Date:   Fri Mar 11 10:46:21 2016 -0500

    rip out rend_id_is_in_interval()
    
    it was used by hid_serv_responsible_for_desc_id(), which we no
    longer use.
---
 src/or/rendcommon.c | 31 -------------------------------
 src/or/rendcommon.h |  1 -
 2 files changed, 32 deletions(-)

diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 79aba80..438fbc4 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -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
diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h
index bab53fc..c520c06 100644
--- a/src/or/rendcommon.h
+++ b/src/or/rendcommon.h
@@ -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);





More information about the tor-commits mailing list