Browse Source

Don't forget to use the mutex in testing_enable_prefilled_rng()

rl1987 5 years ago
parent
commit
49acbfad23
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/test/rng_test_helpers.c

+ 4 - 0
src/test/rng_test_helpers.c

@@ -185,10 +185,14 @@ testing_enable_prefilled_rng(const void *buffer, size_t buflen)
   tor_assert(buflen > 0);
   rng_mutex = tor_mutex_new();
 
+  tor_mutex_acquire(rng_mutex);
+
   prefilled_rng_buffer = tor_memdup(buffer, buflen);
   prefilled_rng_buflen = buflen;
   prefilled_rng_idx = 0;
 
+  tor_mutex_release(rng_mutex);
+
   MOCK(crypto_rand, crypto_rand_prefilled);
   MOCK(crypto_strongest_rand_, mock_crypto_strongest_rand);
 }