diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-03-18 11:44:11 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2019-04-30 11:11:39 -0400 |
commit | c6a93beed83a6271eb029d4b045be9d92b34031d (patch) | |
tree | 9b23f7dca5060d55f85274797b893de79754ea4c /src | |
parent | 7086a9f90e65b8f88063ca478e6f4d41866b2878 (diff) | |
download | tor-c6a93beed83a6271eb029d4b045be9d92b34031d.tar.gz tor-c6a93beed83a6271eb029d4b045be9d92b34031d.zip |
Use preloaded-rng code in test_hs_descriptor.c
Diffstat (limited to 'src')
-rw-r--r-- | src/test/test_hs_descriptor.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c index 09c6c3e700..2563a0bdf9 100644 --- a/src/test/test_hs_descriptor.c +++ b/src/test/test_hs_descriptor.c @@ -21,6 +21,7 @@ #include "test/hs_test_helpers.h" #include "test/test_helpers.h" #include "test/log_test_helpers.h" +#include "test/rng_test_helpers.h" #ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS DISABLE_GCC_WARNING(overlength-strings) @@ -30,13 +31,6 @@ DISABLE_GCC_WARNING(overlength-strings) #include "test_hs_descriptor.inc" ENABLE_GCC_WARNING(overlength-strings) -/* Mock function to fill all bytes with 1 */ -static void -mock_crypto_strongest_rand(uint8_t *out, size_t out_len) -{ - memset(out, 1, out_len); -} - /* Test certificate encoding put in a descriptor. */ static void test_cert_encoding(void *arg) @@ -800,7 +794,7 @@ test_build_authorized_client(void *arg) client_pubkey_b16, strlen(client_pubkey_b16)); - MOCK(crypto_strongest_rand_, mock_crypto_strongest_rand); + testing_enable_prefilled_rng("\x01", 1); hs_desc_build_authorized_client(subcredential, &client_auth_pk, &auth_ephemeral_sk, @@ -816,7 +810,7 @@ test_build_authorized_client(void *arg) done: tor_free(desc_client); tor_free(mem_op_hex_tmp); - UNMOCK(crypto_strongest_rand_); + testing_disable_prefilled_rng(); } struct testcase_t hs_descriptor[] = { |