|
@@ -350,6 +350,18 @@ test_onion_queues(void *arg)
|
|
tor_free(onionskin);
|
|
tor_free(onionskin);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static crypto_cipher_t *crypto_rand_aes_cipher = NULL;
|
|
|
|
+
|
|
|
|
+// Mock replacement for crypto_rand: Generates bytes from a provided AES_CTR
|
|
|
|
+// cipher in <b>crypto_rand_aes_cipher</b>.
|
|
|
|
+static void
|
|
|
|
+crypto_rand_deterministic_aes(char *out, size_t n)
|
|
|
|
+{
|
|
|
|
+ tor_assert(crypto_rand_aes_cipher);
|
|
|
|
+ memset(out, 0, n);
|
|
|
|
+ crypto_cipher_crypt_inplace(crypto_rand_aes_cipher, out, n);
|
|
|
|
+}
|
|
|
|
+
|
|
static void
|
|
static void
|
|
test_circuit_timeout(void *arg)
|
|
test_circuit_timeout(void *arg)
|
|
{
|
|
{
|
|
@@ -379,6 +391,11 @@ test_circuit_timeout(void *arg)
|
|
|
|
|
|
state = or_state_new();
|
|
state = or_state_new();
|
|
|
|
|
|
|
|
+ // Use a deterministic RNG here, or else we'll get nondeterministic
|
|
|
|
+ // coverage in some of the circuitstats functions.
|
|
|
|
+ MOCK(crypto_rand, crypto_rand_deterministic_aes);
|
|
|
|
+ crypto_rand_aes_cipher = crypto_cipher_new("xyzzyplughplover");
|
|
|
|
+
|
|
circuitbuild_running_unit_tests();
|
|
circuitbuild_running_unit_tests();
|
|
#define timeout0 (build_time_t)(30*1000.0)
|
|
#define timeout0 (build_time_t)(30*1000.0)
|
|
initial.Xm = 3000;
|
|
initial.Xm = 3000;
|
|
@@ -513,6 +530,8 @@ test_circuit_timeout(void *arg)
|
|
circuit_build_times_free_timeouts(&final);
|
|
circuit_build_times_free_timeouts(&final);
|
|
or_state_free(state);
|
|
or_state_free(state);
|
|
teardown_periodic_events();
|
|
teardown_periodic_events();
|
|
|
|
+ UNMOCK(crypto_rand);
|
|
|
|
+ crypto_cipher_free(crypto_rand_aes_cipher);
|
|
}
|
|
}
|
|
|
|
|
|
/** Test encoding and parsing of rendezvous service descriptors. */
|
|
/** Test encoding and parsing of rendezvous service descriptors. */
|