summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorIsis Lovecruft <isis@torproject.org>2018-04-06 21:23:29 +0000
committerIsis Lovecruft <isis@torproject.org>2018-04-06 21:45:28 +0000
commitfe3aca149191f2eac410caa7113fb6f7e0804d8c (patch)
treeaabae7d1953667965ba9fd3a6fc15f0a531ac4a0 /src/or
parent21c81348a39dd235c40656c34abb76daf88e81f3 (diff)
downloadtor-fe3aca149191f2eac410caa7113fb6f7e0804d8c.tar.gz
tor-fe3aca149191f2eac410caa7113fb6f7e0804d8c.zip
crypto: Refactor (P)RNG functionality into new crypto_rand module.
* ADD new /src/common/crypto_rand.[ch] module. * ADD new /src/common/crypto_util.[ch] module (contains the memwipe() function, since all crypto_* modules need this). * FIXES part of #24658: https://bugs.torproject.org/24658
Diffstat (limited to 'src/or')
-rw-r--r--src/or/addressmap.c1
-rw-r--r--src/or/channelpadding.c1
-rw-r--r--src/or/circpathbias.c1
-rw-r--r--src/or/circuitbuild.c2
-rw-r--r--src/or/circuitlist.c2
-rw-r--r--src/or/circuitstats.c1
-rw-r--r--src/or/command.c1
-rw-r--r--src/or/config.c2
-rw-r--r--src/or/connection.c1
-rw-r--r--src/or/connection_edge.c1
-rw-r--r--src/or/connection_or.c2
-rw-r--r--src/or/conscache.c1
-rw-r--r--src/or/control.c2
-rw-r--r--src/or/cpuworker.c2
-rw-r--r--src/or/directory.c2
-rw-r--r--src/or/dns.c1
-rw-r--r--src/or/dos.c1
-rw-r--r--src/or/entrynodes.c1
-rw-r--r--src/or/ext_orport.c2
-rw-r--r--src/or/hibernate.c1
-rw-r--r--src/or/hs_cache.c1
-rw-r--r--src/or/hs_cell.c1
-rw-r--r--src/or/hs_circuit.c2
-rw-r--r--src/or/hs_client.c2
-rw-r--r--src/or/hs_common.c2
-rw-r--r--src/or/hs_control.c1
-rw-r--r--src/or/hs_descriptor.c2
-rw-r--r--src/or/hs_descriptor.h1
-rw-r--r--src/or/hs_ident.c1
-rw-r--r--src/or/hs_ntor.c1
-rw-r--r--src/or/hs_service.c2
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/networkstatus.c2
-rw-r--r--src/or/onion.c1
-rw-r--r--src/or/onion_fast.c2
-rw-r--r--src/or/onion_ntor.c1
-rw-r--r--src/or/onion_tap.c2
-rw-r--r--src/or/proto_socks.c1
-rw-r--r--src/or/relay.c2
-rw-r--r--src/or/rendclient.c2
-rw-r--r--src/or/rendcommon.c2
-rw-r--r--src/or/rendservice.c2
-rw-r--r--src/or/rephist.c1
-rw-r--r--src/or/router.c2
-rw-r--r--src/or/routerkeys.c1
-rw-r--r--src/or/routerlist.c1
-rw-r--r--src/or/routerparse.c1
-rw-r--r--src/or/shared_random.c2
-rw-r--r--src/or/shared_random_state.c1
-rw-r--r--src/or/torcert.c2
50 files changed, 71 insertions, 2 deletions
diff --git a/src/or/addressmap.c b/src/or/addressmap.c
index 96ce275578..f691ef9aa0 100644
--- a/src/or/addressmap.c
+++ b/src/or/addressmap.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "connection_edge.h"
#include "control.h"
+#include "crypto_rand.h"
#include "dns.h"
#include "routerset.h"
#include "nodelist.h"
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c
index 5da3009e67..0c20d6dd3e 100644
--- a/src/or/channelpadding.c
+++ b/src/or/channelpadding.c
@@ -16,6 +16,7 @@
#include "networkstatus.h"
#include "connection.h"
#include "connection_or.h"
+#include "crypto_rand.h"
#include "main.h"
#include "rephist.h"
#include "router.h"
diff --git a/src/or/circpathbias.c b/src/or/circpathbias.c
index c1c1ca31be..ff42bf91e4 100644
--- a/src/or/circpathbias.c
+++ b/src/or/circpathbias.c
@@ -30,6 +30,7 @@
#include "circuitstats.h"
#include "connection_edge.h"
#include "config.h"
+#include "crypto_rand.h"
#include "entrynodes.h"
#include "networkstatus.h"
#include "relay.h"
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 8b7990e5f6..fbc4fc4ac5 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -43,7 +43,7 @@
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
-#include "crypto.h"
+#include "crypto_rand.h"
#include "directory.h"
#include "entrynodes.h"
#include "hs_ntor.h"
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index f362b8e97f..02e2181343 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -65,6 +65,8 @@
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "entrynodes.h"
#include "main.h"
#include "hs_circuit.h"
diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c
index 6438319273..0dfde67f82 100644
--- a/src/or/circuitstats.c
+++ b/src/or/circuitstats.c
@@ -31,6 +31,7 @@
#include "config.h"
#include "confparse.h"
#include "control.h"
+#include "crypto_rand.h"
#include "main.h"
#include "networkstatus.h"
#include "rendclient.h"
diff --git a/src/or/command.c b/src/or/command.c
index 4f99462f38..aa792a0064 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -46,6 +46,7 @@
#include "config.h"
#include "control.h"
#include "cpuworker.h"
+#include "crypto_util.h"
#include "dos.h"
#include "hibernate.h"
#include "nodelist.h"
diff --git a/src/or/config.c b/src/or/config.c
index 212c6c6b94..18298937e4 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -78,6 +78,8 @@
#include "control.h"
#include "confparse.h"
#include "cpuworker.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "dirserv.h"
#include "dirvote.h"
#include "dns.h"
diff --git a/src/or/connection.c b/src/or/connection.c
index 5532551cfe..69a8d24c9b 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -76,6 +76,7 @@
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
+#include "crypto_util.h"
#include "directory.h"
#include "dirserv.h"
#include "dns.h"
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 948c8722bf..d74512c45b 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -70,6 +70,7 @@
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
+#include "crypto_util.h"
#include "dns.h"
#include "dnsserv.h"
#include "directory.h"
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 267463312c..ad5ee6a2b6 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -39,6 +39,8 @@
#include "connection.h"
#include "connection_or.h"
#include "control.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "dirserv.h"
#include "entrynodes.h"
#include "geoip.h"
diff --git a/src/or/conscache.c b/src/or/conscache.c
index e25ac5f40b..51dc9d621f 100644
--- a/src/or/conscache.c
+++ b/src/or/conscache.c
@@ -5,6 +5,7 @@
#include "config.h"
#include "conscache.h"
+#include "crypto_util.h"
#include "storagedir.h"
#define CCE_MAGIC 0x17162253
diff --git a/src/or/control.c b/src/or/control.c
index 5cac0e1722..ee4f02cb2c 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -52,6 +52,8 @@
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "directory.h"
#include "dirserv.h"
#include "dnsserv.h"
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 7da7dc5f8b..8f03d654a8 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -24,6 +24,8 @@
#include "connection_or.h"
#include "config.h"
#include "cpuworker.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "main.h"
#include "onion.h"
#include "rephist.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index c419b61d02..44e3d2f2a0 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -18,6 +18,8 @@
#include "consdiffmgr.h"
#include "control.h"
#include "compat.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "directory.h"
#include "dirserv.h"
#include "dirvote.h"
diff --git a/src/or/dns.c b/src/or/dns.c
index e4dc8048ed..34f28252fb 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -56,6 +56,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "control.h"
+#include "crypto_rand.h"
#include "dns.h"
#include "main.h"
#include "policies.h"
diff --git a/src/or/dos.c b/src/or/dos.c
index 4d1797eece..f78409a7b7 100644
--- a/src/or/dos.c
+++ b/src/or/dos.c
@@ -11,6 +11,7 @@
#include "or.h"
#include "channel.h"
#include "config.h"
+#include "crypto_rand.h"
#include "geoip.h"
#include "main.h"
#include "networkstatus.h"
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 2b6ff38c9c..42a776fe46 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -123,6 +123,7 @@
#include "confparse.h"
#include "connection.h"
#include "control.h"
+#include "crypto_rand.h"
#include "directory.h"
#include "entrynodes.h"
#include "main.h"
diff --git a/src/or/ext_orport.c b/src/or/ext_orport.c
index 16a250fa58..8fff0f9559 100644
--- a/src/or/ext_orport.c
+++ b/src/or/ext_orport.c
@@ -23,6 +23,8 @@
#include "ext_orport.h"
#include "control.h"
#include "config.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "main.h"
#include "proto_ext_or.h"
#include "util.h"
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 7261cf8002..2b50aa5f06 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -36,6 +36,7 @@ hibernating, phase 2:
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
+#include "crypto_rand.h"
#include "hibernate.h"
#include "main.h"
#include "router.h"
diff --git a/src/or/hs_cache.c b/src/or/hs_cache.c
index df53efd32d..ecc845d17f 100644
--- a/src/or/hs_cache.c
+++ b/src/or/hs_cache.c
@@ -11,6 +11,7 @@
#include "or.h"
#include "config.h"
+#include "crypto_util.h"
#include "hs_ident.h"
#include "hs_common.h"
#include "hs_client.h"
diff --git a/src/or/hs_cell.c b/src/or/hs_cell.c
index ad92521d34..03273a44f9 100644
--- a/src/or/hs_cell.c
+++ b/src/or/hs_cell.c
@@ -8,6 +8,7 @@
#include "or.h"
#include "config.h"
+#include "crypto_util.h"
#include "rendservice.h"
#include "replaycache.h"
#include "util.h"
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 3a674f6223..38434fba3b 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -13,6 +13,8 @@
#include "circuitlist.h"
#include "circuituse.h"
#include "config.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "nodelist.h"
#include "policies.h"
#include "relay.h"
diff --git a/src/or/hs_client.c b/src/or/hs_client.c
index 20963cd453..f07426052e 100644
--- a/src/or/hs_client.c
+++ b/src/or/hs_client.c
@@ -13,6 +13,8 @@
#include "hs_ident.h"
#include "connection_edge.h"
#include "container.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "rendclient.h"
#include "hs_descriptor.h"
#include "hs_cache.h"
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index aa34b0e8fb..5b0c4c07f8 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -15,6 +15,8 @@
#include "config.h"
#include "circuitbuild.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "networkstatus.h"
#include "nodelist.h"
#include "hs_cache.h"
diff --git a/src/or/hs_control.c b/src/or/hs_control.c
index 87b4e3fca8..87c41bf96e 100644
--- a/src/or/hs_control.c
+++ b/src/or/hs_control.c
@@ -8,6 +8,7 @@
#include "or.h"
#include "control.h"
+#include "crypto_util.h"
#include "hs_common.h"
#include "hs_control.h"
#include "hs_descriptor.h"
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index 7388807bc5..eb48cb0601 100644
--- a/src/or/hs_descriptor.c
+++ b/src/or/hs_descriptor.c
@@ -59,6 +59,8 @@
#include "ed25519_cert.h" /* Trunnel interface. */
#include "hs_descriptor.h"
#include "circuitbuild.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "parsecommon.h"
#include "rendcache.h"
#include "hs_cache.h"
diff --git a/src/or/hs_descriptor.h b/src/or/hs_descriptor.h
index 09979410e1..8195c6efbc 100644
--- a/src/or/hs_descriptor.h
+++ b/src/or/hs_descriptor.h
@@ -16,6 +16,7 @@
#include "container.h"
#include "crypto.h"
#include "crypto_ed25519.h"
+#include "ed25519_cert.h" /* needed for trunnel */
#include "torcert.h"
/* Trunnel */
diff --git a/src/or/hs_ident.c b/src/or/hs_ident.c
index 0bce2f625b..3603e329d4 100644
--- a/src/or/hs_ident.c
+++ b/src/or/hs_ident.c
@@ -7,6 +7,7 @@
* subsytem.
**/
+#include "crypto_util.h"
#include "hs_ident.h"
/* Return a newly allocated circuit identifier. The given public key is copied
diff --git a/src/or/hs_ntor.c b/src/or/hs_ntor.c
index a416bc46c3..809fa83bb8 100644
--- a/src/or/hs_ntor.c
+++ b/src/or/hs_ntor.c
@@ -25,6 +25,7 @@
*/
#include "or.h"
+#include "crypto_util.h"
#include "hs_ntor.h"
/* String constants used by the ntor HS protocol */
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index ba8abc4237..fdd5e449c5 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -15,6 +15,8 @@
#include "circuituse.h"
#include "config.h"
#include "connection.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "directory.h"
#include "main.h"
#include "networkstatus.h"
diff --git a/src/or/main.c b/src/or/main.c
index a0d2ae0757..b3f0a85cda 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -70,6 +70,7 @@
#include "control.h"
#include "cpuworker.h"
#include "crypto_s2k.h"
+#include "crypto_rand.h"
#include "directory.h"
#include "dirserv.h"
#include "dirvote.h"
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 235b95b704..e223b6f1b9 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -48,6 +48,8 @@
#include "connection_or.h"
#include "consdiffmgr.h"
#include "control.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "directory.h"
#include "dirserv.h"
#include "dirvote.h"
diff --git a/src/or/onion.c b/src/or/onion.c
index 0c88c4d7ee..829be12bae 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -67,6 +67,7 @@
#include "circuitlist.h"
#include "config.h"
#include "cpuworker.h"
+#include "crypto_util.h"
#include "networkstatus.h"
#include "onion.h"
#include "onion_fast.h"
diff --git a/src/or/onion_fast.c b/src/or/onion_fast.c
index de9103b1f5..9f9b2199d4 100644
--- a/src/or/onion_fast.c
+++ b/src/or/onion_fast.c
@@ -29,6 +29,8 @@
#include "or.h"
#include "onion_fast.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
/** Release all state held in <b>victim</b>. */
void
diff --git a/src/or/onion_ntor.c b/src/or/onion_ntor.c
index 8ad876a587..02d43cb722 100644
--- a/src/or/onion_ntor.c
+++ b/src/or/onion_ntor.c
@@ -23,6 +23,7 @@
#define ONION_NTOR_PRIVATE
#include "crypto.h"
#include "crypto_digest.h"
+#include "crypto_util.h"
#include "onion_ntor.h"
#include "torlog.h"
#include "util.h"
diff --git a/src/or/onion_tap.c b/src/or/onion_tap.c
index c71fa236ed..44737034f4 100644
--- a/src/or/onion_tap.c
+++ b/src/or/onion_tap.c
@@ -29,6 +29,8 @@
#include "or.h"
#include "config.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "onion_tap.h"
#include "rephist.h"
diff --git a/src/or/proto_socks.c b/src/or/proto_socks.c
index 8700fe1269..57a7d1cd64 100644
--- a/src/or/proto_socks.c
+++ b/src/or/proto_socks.c
@@ -9,6 +9,7 @@
#include "buffers.h"
#include "control.h"
#include "config.h"
+#include "crypto_util.h"
#include "ext_orport.h"
#include "proto_socks.h"
#include "reasons.h"
diff --git a/src/or/relay.c b/src/or/relay.c
index 5651579c3e..96f43ca603 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -61,6 +61,8 @@
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "geoip.h"
#include "hs_cache.h"
#include "main.h"
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 9a1b97c6d6..61dde88692 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -15,6 +15,8 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "directory.h"
#include "hs_common.h"
#include "hs_circuit.h"
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 230da4be5c..50ca04838c 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -14,6 +14,8 @@
#include "circuitbuild.h"
#include "config.h"
#include "control.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "hs_common.h"
#include "rendclient.h"
#include "rendcommon.h"
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index cc22429777..91ee321bc0 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -16,6 +16,8 @@
#include "circuituse.h"
#include "config.h"
#include "control.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "directory.h"
#include "hs_common.h"
#include "hs_config.h"
diff --git a/src/or/rephist.c b/src/or/rephist.c
index ac3e9f502e..fe52d206c8 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -78,6 +78,7 @@
#include "circuitlist.h"
#include "circuituse.h"
#include "config.h"
+#include "crypto_rand.h"
#include "networkstatus.h"
#include "nodelist.h"
#include "rephist.h"
diff --git a/src/or/router.c b/src/or/router.c
index e5996f665e..c52831348b 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -13,6 +13,8 @@
#include "config.h"
#include "connection.h"
#include "control.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "crypto_curve25519.h"
#include "directory.h"
#include "dirserv.h"
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index 1933aaf4b6..43460da8cc 100644
--- a/src/or/routerkeys.c
+++ b/src/or/routerkeys.c
@@ -16,6 +16,7 @@
#include "or.h"
#include "config.h"
+#include "crypto_util.h"
#include "router.h"
#include "crypto_pwbox.h"
#include "routerkeys.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index bc3abb236f..8793c64ed3 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -99,6 +99,7 @@
#include "config.h"
#include "connection.h"
#include "control.h"
+#include "crypto_rand.h"
#include "directory.h"
#include "dirserv.h"
#include "dirvote.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 79499f2e6f..9967e139f5 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -58,6 +58,7 @@
#include "or.h"
#include "config.h"
#include "circuitstats.h"
+#include "crypto_util.h"
#include "dirserv.h"
#include "dirvote.h"
#include "parsecommon.h"
diff --git a/src/or/shared_random.c b/src/or/shared_random.c
index 13416d6bc7..7455668773 100644
--- a/src/or/shared_random.c
+++ b/src/or/shared_random.c
@@ -91,6 +91,8 @@
#include "shared_random.h"
#include "config.h"
#include "confparse.h"
+#include "crypto_rand.h"
+#include "crypto_util.h"
#include "dirvote.h"
#include "networkstatus.h"
#include "routerkeys.h"
diff --git a/src/or/shared_random_state.c b/src/or/shared_random_state.c
index 53782af59a..80470e4e98 100644
--- a/src/or/shared_random_state.c
+++ b/src/or/shared_random_state.c
@@ -14,6 +14,7 @@
#include "shared_random.h"
#include "config.h"
#include "confparse.h"
+#include "crypto_util.h"
#include "dirvote.h"
#include "networkstatus.h"
#include "router.h"
diff --git a/src/or/torcert.c b/src/or/torcert.c
index 51935ddf72..1c5afd965a 100644
--- a/src/or/torcert.c
+++ b/src/or/torcert.c
@@ -27,7 +27,7 @@
#include "or.h"
#include "config.h"
-#include "crypto.h"
+#include "crypto_util.h"
#include "torcert.h"
#include "ed25519_cert.h"
#include "torlog.h"