summaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-03-06 09:59:10 -0500
committerNick Mathewson <nickm@torproject.org>2019-04-04 12:56:52 -0400
commitab6ad3c040de68b1f06b8f910407bff570b24b43 (patch)
tree9416e628e3872594c3d7a44414d34cb1b891393b /src/lib/crypt_ops
parentdb2e916afe34c2b2fd3078a0cd4f8e5ba7193904 (diff)
downloadtor-ab6ad3c040de68b1f06b8f910407bff570b24b43.tar.gz
tor-ab6ad3c040de68b1f06b8f910407bff570b24b43.zip
Drop thread-local fast_rng on fork.
This will cause the child process to construct a new one in a nice safe way. Closes ticket 29668; bug not in any released Tor.
Diffstat (limited to 'src/lib/crypt_ops')
-rw-r--r--src/lib/crypt_ops/crypto_init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/crypt_ops/crypto_init.c b/src/lib/crypt_ops/crypto_init.c
index cf491f32d1..5c2780b2ca 100644
--- a/src/lib/crypt_ops/crypto_init.c
+++ b/src/lib/crypt_ops/crypto_init.c
@@ -152,6 +152,12 @@ crypto_prefork(void)
#ifdef ENABLE_NSS
crypto_nss_prefork();
#endif
+ /* It is not safe to share a fast_rng object across a fork boundary unless
+ * we actually have zero-on-fork support in map_anon.c. If we have
+ * drop-on-fork support, we will crash; if we have neither, we will yield
+ * a copy of the parent process's rng, which is scary and insecure.
+ */
+ destroy_thread_fast_rng();
}
/** Run operations that the crypto library requires to be happy again