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>
/* 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;
}
}
/* 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,
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));
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,
/* Commitment information */
/* Timestamp of reveal. Correspond to TIMESTAMP. */
- time_t reveal_ts;
+ uint64_t reveal_ts;
/* H(REVEAL) as found in COMMIT message. */
char hashed_reveal[DIGEST256_LEN];
/* Base64 encoded COMMIT. We use this to put it in our vote. */
* avoiding possible information leaks of our PRNG. */
uint8_t random_number[SR_RANDOM_NUMBER_LEN];
/* Timestamp of commit. Correspond to TIMESTAMP. */
- time_t commit_ts;
+ uint64_t commit_ts;
/* This is the whole reveal message. We use it during verification */
char encoded_reveal[SR_REVEAL_BASE64_LEN + 1];
} sr_commit_t;