Browse Source

Add some temporary log calls to try to debug the "Hash of session info was not as expected" problem

svn:r1479
Nick Mathewson 21 years ago
parent
commit
1e2b008700
2 changed files with 16 additions and 0 deletions
  1. 9 0
      src/or/rendmid.c
  2. 7 0
      src/or/rendservice.c

+ 9 - 0
src/or/rendmid.c

@@ -17,6 +17,7 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
   int asn1len;
   circuit_t *c;
   char hexid[9];
+  char hexdigest[20*2+1];
 
   log_fn(LOG_INFO,
          "Received an ESTABLISH_INTRO request on circuit %d", circ->p_circ_id);
@@ -39,6 +40,10 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
     goto err;
   }
 
+  /* XXX remove after debuggin */
+  hex_encode(circ->handshake_digest, 20, hexdigest);
+  log_fn(LOG_INFO, "Handshake information is: %s", hexdigest);
+
   /* Next 20 bytes: Hash of handshake_digest | "INTRODUCE" */
   memcpy(buf, circ->handshake_digest, 20);
   memcpy(buf+20, "INTRODUCE", 9);
@@ -46,6 +51,10 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
     log_fn(LOG_WARN, "Error computing digest");
     goto err;
   }
+  hex_encode(expected_digest, 20, hexdigest);
+  log_fn(LOG_INFO, "Expected digest is: %s", hexdigest);
+  hex_encode(buf+2+asn1len, 20, hexdigest);
+  log_fn(LOG_INFO, "Received digest is: %s", hexdigest);
   if (memcmp(expected_digest, buf+2+asn1len, 20)) {
     log_fn(LOG_WARN, "Hash of session info was not as expected");
     goto err;

+ 7 - 0
src/or/rendservice.c

@@ -458,6 +458,7 @@ rend_service_intro_is_ready(circuit_t *circuit)
   char buf[RELAY_PAYLOAD_SIZE];
   char auth[DIGEST_LEN + 10];
   char hexid[9];
+  char hexdigest[DIGEST_LEN*2+1];
 
   assert(circuit->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO);
   assert(circuit->cpath);
@@ -480,9 +481,15 @@ rend_service_intro_is_ready(circuit_t *circuit)
   set_uint16(buf, len);
   len += 2;
   memcpy(auth, circuit->cpath->prev->handshake_digest, DIGEST_LEN);
+  /* XXXX remove me once we've debugged this; this info should not be logged.
+   */
+  hex_encode(circuit->cpath->prev->handshake_digest, DIGEST_LEN, hexdigest);
+  log_fn(LOG_INFO,"Handshake information is: %s", hexdigest);
   memcpy(auth+DIGEST_LEN, "INTRODUCE", 9);
   if (crypto_digest(auth, DIGEST_LEN+9, buf+len))
     goto err;
+  hex_encode(buf+len, DIGEST_LEN, hexdigest);
+  log_fn(LOG_INFO,"Authentication is: %s", hexdigest);
   len += 20;
   r = crypto_pk_private_sign_digest(service->private_key, buf, len, buf+len);
   if (r<0) {