Several cleanups suggested by mab.
This change addresses several issues noted by mab:
• Use rough_time_t as a type for Roughtime timestamps. (Note that not
all timestamps use this type. Times from the monotonic clock, for
example, are not Roughtime timestamps.)
• Split the Success test into so that misalignment is tested
separately.
• Use sizeof(tag_t) in protocol.cc.
Change-Id: I0228d35c9116aa44b9a792df54a2df6b7d26d6e3
diff --git a/client.cc b/client.cc
index 68b1953..8543e0d 100644
--- a/client.cc
+++ b/client.cc
@@ -42,7 +42,7 @@
return std::string(reinterpret_cast<char*>(query_bytes), query_len);
}
-bool ParseResponse(uint64_t* out_time, uint32_t* out_radius,
+bool ParseResponse(rough_time_t* out_time, uint32_t* out_radius,
std::string* out_error,
const uint8_t root_public_key[ED25519_PUBLIC_KEY_LEN],
const uint8_t* response_bytes, size_t response_len,
@@ -94,7 +94,7 @@
}
const uint8_t* delegated_public_key;
- uint64_t min_time, max_time;
+ rough_time_t min_time, max_time;
Parser delegation(delegation_bytes, delegation_len);
if (!delegation.is_valid() ||
!delegation.Get(&min_time, kTagMINT) ||
@@ -144,7 +144,7 @@
}
const uint8_t* root;
- uint64_t timestamp;
+ rough_time_t timestamp;
uint32_t radius;
if (!signed_response.GetFixedLen(&root, kTagROOT, kNonceLength) ||
!signed_response.Get(×tamp, kTagMIDP) ||