[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Move extra_info_digest256 into signed_descriptor_t



commit 44da47d3c1e4809d5aaf91cd708c6f02b01a5396
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue May 17 12:53:12 2016 -0400

    Move extra_info_digest256 into signed_descriptor_t
    
    This patch includes no semantic changes; it's just a field movement.
    
    It's prerequisite for a fix to 19017/17150.
---
 src/or/or.h          | 4 ++--
 src/or/router.c      | 6 +++---
 src/or/routerlist.c  | 4 ++--
 src/or/routerparse.c | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/or/or.h b/src/or/or.h
index 431927c..e0f2eb4 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1993,6 +1993,8 @@ typedef struct signed_descriptor_t {
   time_t published_on;
   /** For routerdescs only: digest of the corresponding extrainfo. */
   char extra_info_digest[DIGEST_LEN];
+  /** For routerdescs only: A SHA256-digest of the extrainfo (if any) */
+  char extra_info_digest256[DIGEST256_LEN];
   /** For routerdescs only: Status of downloading the corresponding
    * extrainfo. */
   download_status_t ei_dl_status;
@@ -2024,8 +2026,6 @@ typedef int16_t country_t;
 /** Information about another onion router in the network. */
 typedef struct {
   signed_descriptor_t cache_info;
-  /** A SHA256-digest of the extrainfo (if any) */
-  char extra_info_digest256[DIGEST256_LEN];
   char *nickname; /**< Human-readable OR name. */
 
   uint32_t addr; /**< IPv4 address of OR, in host order. */
diff --git a/src/or/router.c b/src/or/router.c
index 841f6fd..3943643 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -2028,7 +2028,7 @@ router_build_fresh_descriptor(routerinfo_t **r, extrainfo_t **e)
     memcpy(ri->cache_info.extra_info_digest,
            ei->cache_info.signed_descriptor_digest,
            DIGEST_LEN);
-    memcpy(ri->extra_info_digest256,
+    memcpy(ri->cache_info.extra_info_digest256,
            ei->digest256,
            DIGEST256_LEN);
   } else {
@@ -2543,9 +2543,9 @@ router_dump_router_to_string(routerinfo_t *router,
     char extra_info_digest[HEX_DIGEST_LEN+1];
     base16_encode(extra_info_digest, sizeof(extra_info_digest),
                   router->cache_info.extra_info_digest, DIGEST_LEN);
-    if (!tor_digest256_is_zero(router->extra_info_digest256)) {
+    if (!tor_digest256_is_zero(router->cache_info.extra_info_digest256)) {
       char d256_64[BASE64_DIGEST256_LEN+1];
-      digest256_to_base64(d256_64, router->extra_info_digest256);
+      digest256_to_base64(d256_64, router->cache_info.extra_info_digest256);
       tor_asprintf(&extra_info_line, "extra-info-digest %s %s\n",
                    extra_info_digest, d256_64);
     } else {
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 79a5bb3..3d85d86 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -4926,9 +4926,9 @@ routerinfo_incompatible_with_extrainfo(const routerinfo_t *ri,
   /* Set digest256_matches to 1 if the digest is correct, or if no
    * digest256 was in the ri. */
   digest256_matches = tor_memeq(ei->digest256,
-                                ri->extra_info_digest256, DIGEST256_LEN);
+                                ri->cache_info.extra_info_digest256, DIGEST256_LEN);
   digest256_matches |=
-    tor_mem_is_zero(ri->extra_info_digest256, DIGEST256_LEN);
+    tor_mem_is_zero(ri->cache_info.extra_info_digest256, DIGEST256_LEN);
 
   /* The identity must match exactly to have been generated at the same time
    * by the same router. */
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 6b6e21d..bc6c35f 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -1597,7 +1597,7 @@ router_parse_entry_from_string(const char *s, const char *end,
     }
 
     if (tok->n_args >= 2) {
-      if (digest256_from_base64(router->extra_info_digest256, tok->args[1])
+      if (digest256_from_base64(router->cache_info.extra_info_digest256, tok->args[1])
           < 0) {
         log_warn(LD_DIR, "Invalid extra info digest256 %s",
                  escaped(tok->args[1]));



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits