aboutsummaryrefslogtreecommitdiff
path: root/src/ext/csiphash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/csiphash.c')
-rw-r--r--src/ext/csiphash.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ext/csiphash.c b/src/ext/csiphash.c
index 9a8833d10..30be40b51 100644
--- a/src/ext/csiphash.c
+++ b/src/ext/csiphash.c
@@ -31,6 +31,9 @@
#include "torint.h"
#include "siphash.h"
+/* for tor_assert */
+#include "util.h"
+/* for memcpy */
#include <string.h>
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
@@ -137,11 +140,13 @@ static int the_siphash_key_is_set = 0;
static struct sipkey the_siphash_key;
uint64_t siphash24g(const void *src, unsigned long src_sz) {
+ tor_assert(the_siphash_key_is_set);
return siphash24(src, src_sz, &the_siphash_key);
}
void siphash_set_global_key(const struct sipkey *key)
{
+ tor_assert(! the_siphash_key_is_set);
the_siphash_key.k0 = key->k0;
the_siphash_key.k1 = key->k1;
the_siphash_key_is_set = 1;