aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_common.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2023-01-25 09:04:07 -0500
committerNick Mathewson <nickm@torproject.org>2023-01-25 09:04:07 -0500
commita5d8c9fef7b4bcfa8eea429c55d7affb4238d5ec (patch)
tree8ed7b46bfa160e379018f19fd0aa9a29d2e34f62 /src/test/test_hs_common.c
parent3d7e3af91e9f0962a43d865132e6250423ee3918 (diff)
downloadtor-a5d8c9fef7b4bcfa8eea429c55d7affb4238d5ec.tar.gz
tor-a5d8c9fef7b4bcfa8eea429c55d7affb4238d5ec.zip
Add a test vector for disaster SRV calculation.
Diffstat (limited to 'src/test/test_hs_common.c')
-rw-r--r--src/test/test_hs_common.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index e58945a8c3..4b43a9eb0b 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -645,6 +645,19 @@ test_disaster_srv(void *arg)
tt_mem_op(cached_disaster_srv_one, OP_EQ, srv_one, DIGEST256_LEN);
tt_mem_op(cached_disaster_srv_two, OP_EQ, srv_two, DIGEST256_LEN);
+ /* For at least one SRV, check that its result was as expected. */
+ {
+ uint8_t srv1_expected[32];
+ crypto_digest256(
+ (char*)srv1_expected,
+ "shared-random-disaster\0\0\0\0\0\0\x05\xA0\0\0\0\0\0\0\0\1",
+ strlen("shared-random-disaster")+16,
+ DIGEST_SHA3_256);
+ tt_mem_op(srv_one, OP_EQ, srv1_expected, DIGEST256_LEN);
+ tt_str_op(hex_str((char*)srv_one, DIGEST256_LEN), OP_EQ,
+ "F8A4948707653837FA44ABB5BBC75A12F6F101E7F8FAF699B9715F4965D3507D");
+ }
+
/* Ask for an SRV that has already been computed */
get_disaster_srv(2, srv_two);
/* and check that the cache entries have not changed */