From a6b6227b2141f8d9d36f8555253ec4d56f423b04 Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Thu, 1 Jun 2017 15:11:03 +0300 Subject: test: Fix prop224 HS descriptor to use subcredential We used to use NULL subcredential which is a terrible terrible idea. Refactor HS unittests to use subcredentials. Also add some non-fatal asserts to make sure that we always use subcredentials when decoding/encoding descs. Signed-off-by: David Goulet --- src/test/test_hs_cache.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/test/test_hs_cache.c') diff --git a/src/test/test_hs_cache.c b/src/test/test_hs_cache.c index 40f50b322a..6c2addef9a 100644 --- a/src/test/test_hs_cache.c +++ b/src/test/test_hs_cache.c @@ -342,6 +342,7 @@ test_hsdir_revision_counter_check(void *arg) hs_descriptor_t *published_desc = NULL; char *published_desc_str = NULL; + uint8_t subcredential[DIGEST256_LEN]; char *received_desc_str = NULL; hs_descriptor_t *received_desc = NULL; @@ -378,9 +379,11 @@ test_hsdir_revision_counter_check(void *arg) const ed25519_public_key_t *blinded_key; blinded_key = &published_desc->plaintext_data.blinded_pubkey; + hs_get_subcredential(&signing_kp.pubkey, blinded_key, subcredential); received_desc_str = helper_fetch_desc_from_hsdir(blinded_key); - retval = hs_desc_decode_descriptor(received_desc_str,NULL, &received_desc); + retval = hs_desc_decode_descriptor(received_desc_str, + subcredential, &received_desc); tt_int_op(retval, ==, 0); tt_assert(received_desc); @@ -412,7 +415,8 @@ test_hsdir_revision_counter_check(void *arg) blinded_key = &published_desc->plaintext_data.blinded_pubkey; received_desc_str = helper_fetch_desc_from_hsdir(blinded_key); - retval = hs_desc_decode_descriptor(received_desc_str,NULL, &received_desc); + retval = hs_desc_decode_descriptor(received_desc_str, + subcredential, &received_desc); tt_int_op(retval, ==, 0); tt_assert(received_desc); -- cgit v1.2.3-54-g00ecf