summaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops/crypto_init.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-02-19 15:23:31 -0500
committerNick Mathewson <nickm@torproject.org>2019-02-19 15:36:08 -0500
commitb25cd5cfe168b85500c160ca538a44d9adba52c1 (patch)
treeff48d6598b801dee11b6af1f77b4f01a964f4616 /src/lib/crypt_ops/crypto_init.c
parent6927e9a60ca12fa67d6a33044c2903ce95ca1605 (diff)
downloadtor-b25cd5cfe168b85500c160ca538a44d9adba52c1.tar.gz
tor-b25cd5cfe168b85500c160ca538a44d9adba52c1.zip
Implement code to manage a per-thread instance of crypto_fast_rng()
The subsystems API makes this really simple, fortunately. Closes ticket 29536
Diffstat (limited to 'src/lib/crypt_ops/crypto_init.c')
-rw-r--r--src/lib/crypt_ops/crypto_init.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/crypt_ops/crypto_init.c b/src/lib/crypt_ops/crypto_init.c
index 4040085c76..cf491f32d1 100644
--- a/src/lib/crypt_ops/crypto_init.c
+++ b/src/lib/crypt_ops/crypto_init.c
@@ -12,6 +12,8 @@
#include "orconfig.h"
+#define CRYPTO_PRIVATE
+
#include "lib/crypt_ops/crypto_init.h"
#include "lib/crypt_ops/crypto_curve25519.h"
@@ -69,6 +71,8 @@ crypto_early_init(void)
if (crypto_init_siphash_key() < 0)
return -1;
+ crypto_rand_fast_init();
+
curve25519_init();
ed25519_init();
}
@@ -111,6 +115,7 @@ crypto_thread_cleanup(void)
#ifdef ENABLE_OPENSSL
crypto_openssl_thread_cleanup();
#endif
+ destroy_thread_fast_rng();
}
/**
@@ -129,6 +134,8 @@ crypto_global_cleanup(void)
crypto_nss_global_cleanup();
#endif
+ crypto_rand_fast_shutdown();
+
crypto_early_initialized_ = 0;
crypto_global_initialized_ = 0;
have_seeded_siphash = 0;