aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_or.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-09-20 11:01:10 -0400
committerNick Mathewson <nickm@torproject.org>2013-09-20 11:01:10 -0400
commit6178aaea0698d7f62754c2aa1574ad7fd4fa781d (patch)
treed60df65fdf156d8caffb572acb79ff76a37c47d1 /src/or/connection_or.c
parentee01e41937947eb77c02f552d59090c0ea280f98 (diff)
parent07bb17185681f875be461c4fea6c661fae2dfde9 (diff)
downloadtor-6178aaea0698d7f62754c2aa1574ad7fd4fa781d.tar
tor-6178aaea0698d7f62754c2aa1574ad7fd4fa781d.tar.gz
Merge remote-tracking branch 'origin/maint-0.2.4'
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r--src/or/connection_or.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 120f732ce..637ee4dd3 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -2121,8 +2121,9 @@ connection_or_send_netinfo(or_connection_t *conn)
memset(&cell, 0, sizeof(cell_t));
cell.command = CELL_NETINFO;
- /* Timestamp. */
- set_uint32(cell.payload, htonl((uint32_t)now));
+ /* Timestamp, if we're a relay. */
+ if (! conn->handshake_state->started_here)
+ set_uint32(cell.payload, htonl((uint32_t)now));
/* Their address. */
out = cell.payload + 4;
@@ -2356,19 +2357,11 @@ connection_or_compute_authenticate_cell_body(or_connection_t *conn,
if (server)
return V3_AUTH_FIXED_PART_LEN; // ptr-out
- /* Time: 8 octets. */
- {
- uint64_t now = time(NULL);
- if ((time_t)now < 0)
- return -1;
- set_uint32(ptr, htonl((uint32_t)(now>>32)));
- set_uint32(ptr+4, htonl((uint32_t)now));
- ptr += 8;
- }
-
- /* Nonce: 16 octets. */
- crypto_rand((char*)ptr, 16);
- ptr += 16;
+ /* 8 octets were reserved for the current time, but we're trying to get out
+ * of the habit of sending time around willynilly. Fortunately, nothing
+ * checks it. That's followed by 16 bytes of nonce. */
+ crypto_rand((char*)ptr, 24);
+ ptr += 24;
tor_assert(ptr - out == V3_AUTH_BODY_LEN);