Commit 1e2b0087 authored by Nick Mathewson's avatar Nick Mathewson 🐘
Browse files

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


svn:r1479
parent 84b9e90d
Loading
Loading
Loading
Loading
+9 −0
Changes for src/or/rendmid.c: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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
Changes for src/or/rendservice.c: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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) {