Nick Mathewson 8 rokov pred
rodič
commit
b750a77e3f
3 zmenil súbory, kde vykonal 5 pridanie a 5 odobranie
  1. 2 2
      src/or/dirserv.c
  2. 1 1
      src/or/entrynodes.c
  3. 2 2
      src/or/routerparse.c

+ 2 - 2
src/or/dirserv.c

@@ -2062,8 +2062,8 @@ routers_make_ed_keys_unique(smartlist_t *routers)
       const time_t ri2_pub = ri2->cache_info.published_on;
       if (ri2_pub < ri_pub ||
           (ri2_pub == ri_pub &&
-           memcmp(ri->cache_info.signed_descriptor_digest,
-                  ri2->cache_info.signed_descriptor_digest,DIGEST_LEN)<0)) {
+           fast_memcmp(ri->cache_info.signed_descriptor_digest,
+                     ri2->cache_info.signed_descriptor_digest,DIGEST_LEN)<0)) {
         digest256map_set(by_ed_key, pk, ri);
         ri2->omit_from_vote = 1;
       } else {

+ 1 - 1
src/or/entrynodes.c

@@ -2452,7 +2452,7 @@ get_bridge_dl_status_by_id, (const char *digest))
 
   if (digest && get_options()->UseBridges && bridge_list) {
     SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, b) {
-      if (memcmp(digest, b->identity, DIGEST_LEN) == 0) {
+      if (tor_memeq(digest, b->identity, DIGEST_LEN)) {
         dl = &(b->fetch_status);
         break;
       }

+ 2 - 2
src/or/routerparse.c

@@ -773,7 +773,7 @@ dump_desc_fifo_bump_hash(const uint8_t *digest_sha256)
     /* Find a match if one exists */
     SMARTLIST_FOREACH_BEGIN(descs_dumped, dumped_desc_t *, ent) {
       if (ent &&
-          memcmp(ent->digest_sha256, digest_sha256, DIGEST256_LEN) == 0) {
+          tor_memeq(ent->digest_sha256, digest_sha256, DIGEST256_LEN)) {
         /*
          * Save a pointer to the match and remove it from its current
          * position.
@@ -919,7 +919,7 @@ dump_desc_populate_one_file, (const char *dirname, const char *f))
   }
 
   /* Compare the digests */
-  if (memcmp(digest, content_digest, DIGEST256_LEN) != 0) {
+  if (tor_memneq(digest, content_digest, DIGEST256_LEN)) {
     /* No match */
     log_info(LD_DIR,
              "Hash of %s from unparseable descriptors directory didn't "