aboutsummaryrefslogtreecommitdiff
path: root/src/or/shared_random.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@ev0ke.net>2016-05-09 16:51:32 -0400
committerDavid Goulet <dgoulet@torproject.org>2016-07-01 14:01:41 -0400
commitc0cec2ffd3d5f965413f56e93f89fabf81a2c3a0 (patch)
tree06e8a76596186bb9f2f63da59f06f3173a2f3a52 /src/or/shared_random.c
parentb12d4852efaf6a6a5184abddacb777d30bf9850f (diff)
downloadtor-c0cec2ffd3d5f965413f56e93f89fabf81a2c3a0.tar.gz
tor-c0cec2ffd3d5f965413f56e93f89fabf81a2c3a0.zip
prop250: change time_t to uint64_t
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Diffstat (limited to 'src/or/shared_random.c')
-rw-r--r--src/or/shared_random.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/or/shared_random.c b/src/or/shared_random.c
index e3fe1a9e73..f5f4ccf9f5 100644
--- a/src/or/shared_random.c
+++ b/src/or/shared_random.c
@@ -144,18 +144,10 @@ commit_log(const sr_commit_t *commit)
tor_assert(commit);
log_debug(LD_DIR, "SR: Commit from %s", commit->rsa_identity_fpr);
-
- if (commit->commit_ts >= 0) {
- log_debug(LD_DIR, "SR: Commit: [TS: %ld] [Encoded: %s]",
- commit->commit_ts, commit->encoded_commit);
- }
-
- if (commit->reveal_ts >= 0) {
- log_debug(LD_DIR, "SR: Reveal: [TS: %ld] [Encoded: %s]",
- commit->reveal_ts, safe_str(commit->encoded_reveal));
- } else {
- log_debug(LD_DIR, "SR: Reveal: UNKNOWN");
- }
+ log_debug(LD_DIR, "SR: Commit: [TS: %" PRIu64 "] [Encoded: %s]",
+ commit->commit_ts, commit->encoded_commit);
+ log_debug(LD_DIR, "SR: Reveal: [TS: %" PRIu64 "] [Encoded: %s]",
+ commit->reveal_ts, safe_str(commit->encoded_reveal));
}
/* Make sure that the commitment and reveal information in <b>commit</b>
@@ -172,8 +164,9 @@ verify_commit_and_reveal(const sr_commit_t *commit)
/* Check that the timestamps match. */
if (commit->commit_ts != commit->reveal_ts) {
- log_warn(LD_BUG, "SR: Commit timestamp %ld doesn't match reveal "
- "timestamp %ld", commit->commit_ts, commit->reveal_ts);
+ log_warn(LD_BUG, "SR: Commit timestamp %" PRIu64 " doesn't match reveal "
+ "timestamp %" PRIu64, commit->commit_ts,
+ commit->reveal_ts);
goto invalid;
}
@@ -261,7 +254,7 @@ commit_decode(const char *encoded, sr_commit_t *commit)
}
/* First is the timestamp (8 bytes). */
- commit->commit_ts = (time_t) tor_ntohll(get_uint64(b64_decoded));
+ commit->commit_ts = tor_ntohll(get_uint64(b64_decoded));
offset += sizeof(uint64_t);
/* Next is hashed reveal. */
memcpy(commit->hashed_reveal, b64_decoded + offset,
@@ -313,7 +306,7 @@ reveal_decode(const char *encoded, sr_commit_t *commit)
goto error;
}
- commit->reveal_ts = (time_t) tor_ntohll(get_uint64(b64_decoded));
+ commit->reveal_ts = tor_ntohll(get_uint64(b64_decoded));
/* Copy the last part, the random value. */
memcpy(commit->random_number, b64_decoded + 8,
sizeof(commit->random_number));
@@ -371,7 +364,7 @@ commit_encode(const sr_commit_t *commit, char *dst, size_t len)
tor_assert(dst);
/* First is the timestamp (8 bytes). */
- set_uint64(buf, tor_htonll((uint64_t) commit->commit_ts));
+ set_uint64(buf, tor_htonll(commit->commit_ts));
offset += sizeof(uint64_t);
/* and then the hashed reveal. */
memcpy(buf + offset, commit->hashed_reveal,