summaryrefslogtreecommitdiff
path: root/src/or/shared_random.h
diff options
context:
space:
mode:
authorTaylor Yu <catalyst@torproject.org>2017-04-06 14:49:40 -0400
committerTaylor Yu <catalyst@torproject.org>2017-04-06 17:43:17 -0400
commit681812ea40423f46c45f05d096ca01f346ff3fd9 (patch)
tree3c3264098a2c7ad41378c0800bcf2c6a28687c2e /src/or/shared_random.h
parent86477f4e3fedb316e5708f4e7fd09ea61840993a (diff)
downloadtor-681812ea40423f46c45f05d096ca01f346ff3fd9.tar.gz
tor-681812ea40423f46c45f05d096ca01f346ff3fd9.zip
Use macros for base64 lengths in shared_random.h
Fixes #19564.
Diffstat (limited to 'src/or/shared_random.h')
-rw-r--r--src/or/shared_random.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/or/shared_random.h b/src/or/shared_random.h
index ae390c469e..1f027c70e0 100644
--- a/src/or/shared_random.h
+++ b/src/or/shared_random.h
@@ -36,17 +36,14 @@
/* Length of base64 encoded commit NOT including the NUL terminated byte.
* Formula is taken from base64_encode_size. This adds up to 56 bytes. */
-#define SR_COMMIT_BASE64_LEN \
- (((SR_COMMIT_LEN - 1) / 3) * 4 + 4)
+#define SR_COMMIT_BASE64_LEN (BASE64_LEN(SR_COMMIT_LEN))
/* Length of base64 encoded reveal NOT including the NUL terminated byte.
* Formula is taken from base64_encode_size. This adds up to 56 bytes. */
-#define SR_REVEAL_BASE64_LEN \
- (((SR_REVEAL_LEN - 1) / 3) * 4 + 4)
+#define SR_REVEAL_BASE64_LEN (BASE64_LEN(SR_REVEAL_LEN))
/* Length of base64 encoded shared random value. It's 32 bytes long so 44
* bytes from the base64_encode_size formula. That includes the '='
* character at the end. */
-#define SR_SRV_VALUE_BASE64_LEN \
- (((DIGEST256_LEN - 1) / 3) * 4 + 4)
+#define SR_SRV_VALUE_BASE64_LEN (BASE64_LEN(DIGEST256_LEN))
/* Assert if commit valid flag is not set. */
#define ASSERT_COMMIT_VALID(c) tor_assert((c)->valid)