summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-08-24 12:51:33 -0400
committerNick Mathewson <nickm@torproject.org>2009-10-15 15:17:13 -0400
commite1ddee8bbe724e934fe9a4cb2d290719a7d6105c (patch)
tree82848930764ba4b86637f15a25b557fc6805f31a /src/common
parenta8e92ba8fd65e12dbec265ccfcf0c89ac61847f2 (diff)
downloadtor-e1ddee8bbe724e934fe9a4cb2d290719a7d6105c.tar.gz
tor-e1ddee8bbe724e934fe9a4cb2d290719a7d6105c.zip
Code to generate, store, and parse microdescriptors and consensuses.
The consensus documents are not signed properly, not served, and not exchanged yet.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util.c7
-rw-r--r--src/common/util.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index d05c308fe8..139c1aaad8 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -684,6 +684,13 @@ tor_digest_is_zero(const char *digest)
return tor_mem_is_zero(digest, DIGEST_LEN);
}
+/** Return true iff the DIGEST256_LEN bytes in digest are all zero. */
+int
+tor_digest256_is_zero(const char *digest)
+{
+ return tor_mem_is_zero(digest, DIGEST256_LEN);
+}
+
/* Helper: common code to check whether the result of a strtol or strtoul or
* strtoll is correct. */
#define CHECK_STRTOX_RESULT() \
diff --git a/src/common/util.h b/src/common/util.h
index 28ea8a0488..85234f5157 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -195,6 +195,7 @@ const char *find_whitespace(const char *s) ATTR_PURE;
const char *find_whitespace_eos(const char *s, const char *eos) ATTR_PURE;
int tor_mem_is_zero(const char *mem, size_t len) ATTR_PURE;
int tor_digest_is_zero(const char *digest) ATTR_PURE;
+int tor_digest256_is_zero(const char *digest) ATTR_PURE;
char *esc_for_log(const char *string) ATTR_MALLOC;
const char *escaped(const char *string);
struct smartlist_t;