[or-cvs] Add some temporary log calls to try to debug the "Hash of s...

Nick Mathewson nickm at seul.org
Mon Apr 5 17:20:59 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv9429/src/or

Modified Files:
	rendmid.c rendservice.c 
Log Message:
Add some temporary log calls to try to debug the "Hash of session info was not as expected" problem

Index: rendmid.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendmid.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- rendmid.c	5 Apr 2004 07:41:31 -0000	1.9
+++ rendmid.c	5 Apr 2004 17:20:57 -0000	1.10
@@ -17,6 +17,7 @@
   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 @@
     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 @@
     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;

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- rendservice.c	3 Apr 2004 04:55:22 -0000	1.20
+++ rendservice.c	5 Apr 2004 17:20:57 -0000	1.21
@@ -458,6 +458,7 @@
   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 @@
   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) {



More information about the tor-commits mailing list