aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-09-19 12:33:04 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-09-19 12:33:04 -0400
commit5dea4b565f7295bae8c48790cc7d00a6e237fff0 (patch)
treebdf04e8518f881b3dcb2ddcd51166b59897207dd /src/common
parentf395f41868514a0e418c95f3203d59f3aca6fa47 (diff)
downloadtor-5dea4b565f7295bae8c48790cc7d00a6e237fff0.tar.gz
tor-5dea4b565f7295bae8c48790cc7d00a6e237fff0.zip
Add a BASE32_DIGEST_LEN define
Use this value instead of hardcoded values of 32 everywhere. This also addresses the use of REND_DESC_ID_V2_LEN_BASE32 in hs_lookup_last_hid_serv_request() for the HSDir encoded identity digest length which is accurate but semantically wrong. Fixes #23305. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/crypto.h b/src/common/crypto.h
index 6f5e13a8de..f9aeeee2c0 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -73,6 +73,9 @@
/** Length of our DH keys. */
#define DH_BYTES (1024/8)
+/** Length of a sha1 message digest when encoded in base32 with trailing =
+ * signs removed. */
+#define BASE32_DIGEST_LEN 32
/** Length of a sha1 message digest when encoded in base64 with trailing =
* signs removed. */
#define BASE64_DIGEST_LEN 27