summaryrefslogtreecommitdiff
path: root/src/test/test-siphash24.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-11-16 23:17:52 +0100
committerDaniel Mack <daniel@zonque.org>2015-11-16 23:17:52 +0100
commit933f9caeeb2b3c1b951d330e04beb04226e5a890 (patch)
treedc36a6ddd84b060590c4885db7b6c3e9e91081eb /src/test/test-siphash24.c
parent5cd6491b71008334daa9965464e038dc3e39948a (diff)
siphash24: let siphash24_finalize() and siphash24() return the result directly
Rather than passing a pointer to return the result, return it directly from the function calls. Also, return the result in native endianess, and let the callers care about the conversion. For hash tables and bloom filters, we don't care, but in order to keep MAC addresses and DHCP client IDs stable, we explicitly convert to LE.
Diffstat (limited to 'src/test/test-siphash24.c')
-rw-r--r--src/test/test-siphash24.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/test-siphash24.c b/src/test/test-siphash24.c
index 0200e146ad..eda286da00 100644
--- a/src/test/test-siphash24.c
+++ b/src/test/test-siphash24.c
@@ -29,7 +29,7 @@ static int do_test(const uint8_t *in, size_t len, const uint8_t *key) {
uint64_t out = 0;
unsigned i, j;
- siphash24(&out, in, len, key);
+ out = siphash24(in, len, key);
assert_se(out == htole64(0xa129ca6149be45e5));
/* verify the internal state as given in the above paper */
@@ -43,7 +43,7 @@ static int do_test(const uint8_t *in, size_t len, const uint8_t *key) {
assert_se(state.v1 == 0x0d52f6f62a4f59a4);
assert_se(state.v2 == 0x634cb3577b01fd3d);
assert_se(state.v3 == 0xa5224d6f55c7d9c8);
- siphash24_finalize(&out, &state);
+ out = siphash24_finalize(&state);
assert_se(out == htole64(0xa129ca6149be45e5));
assert_se(state.v0 == 0xf6bcd53893fecff1);
assert_se(state.v1 == 0x54b9964c7ea0d937);
@@ -58,7 +58,7 @@ static int do_test(const uint8_t *in, size_t len, const uint8_t *key) {
siphash24_compress(in, i, &state);
siphash24_compress(&in[i], j - i, &state);
siphash24_compress(&in[j], len - j, &state);
- siphash24_finalize(&out, &state);
+ out = siphash24_finalize(&state);
assert_se(out == htole64(0xa129ca6149be45e5));
}
}