summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-06-02 09:46:12 -0400
committerNick Mathewson <nickm@torproject.org>2016-06-11 10:11:54 -0400
commit53a3b39da1241ba43f63f1515f6ef5167b182cae (patch)
tree558ec394f3a02bb8f2b5e887ff70b82231424143 /src/common
parent80f1a2cbbdd0abd509711a5069f31855df5bcd79 (diff)
downloadtor-53a3b39da1241ba43f63f1515f6ef5167b182cae.tar.gz
tor-53a3b39da1241ba43f63f1515f6ef5167b182cae.zip
Add -Wmissing-variable-declarations, with attendant fixes
This is a big-ish patch, but it's very straightforward. Under this clang warning, we're not actually allowed to have a global variable without a previous extern declaration for it. The cases where we violated this rule fall into three roughly equal groups: * Stuff that should have been static. * Stuff that was global but where the extern was local to some other C file. * Stuff that was only global when built for the unit tests, that needed a conditional extern in the headers. The first two were IMO genuine problems; the last is a wart of how we build tests.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat_libevent.c2
-rw-r--r--src/common/crypto.h5
-rw-r--r--src/common/log.c2
-rw-r--r--src/common/tortls.c2
-rw-r--r--src/common/tortls.h10
5 files changed, 18 insertions, 3 deletions
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index cc58883750..96fcec54d4 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -125,7 +125,7 @@ tor_event_free(struct event *ev)
#endif
/** Global event base for use by the main thread. */
-struct event_base *the_event_base = NULL;
+static struct event_base *the_event_base = NULL;
/* This is what passes for version detection on OSX. We set
* MACOSX_KQUEUE_IS_BROKEN to true iff we're on a version of OSX before
diff --git a/src/common/crypto.h b/src/common/crypto.h
index ff38cca0da..f8fb0daa81 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -319,6 +319,11 @@ void crypto_add_spaces_to_fp(char *out, size_t outlen, const char *in);
#ifdef CRYPTO_PRIVATE
STATIC int crypto_force_rand_ssleay(void);
STATIC int crypto_strongest_rand_raw(uint8_t *out, size_t out_len);
+
+#ifdef TOR_UNIT_TESTS
+extern int break_strongest_rng_syscall;
+extern int break_strongest_rng_fallback;
+#endif
#endif
#endif
diff --git a/src/common/log.c b/src/common/log.c
index 6c387c6244..e948ccfa04 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -270,7 +270,7 @@ log_tor_version(logfile_t *lf, int reset)
return 0;
}
-const char bug_suffix[] = " (on Tor " VERSION
+static const char bug_suffix[] = " (on Tor " VERSION
#ifndef _MSC_VER
" "
#include "micro-revision.i"
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 252da6295e..1cb6ca8777 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -562,7 +562,7 @@ MOCK_IMPL(STATIC X509 *,
/** List of ciphers that servers should select from when we actually have
* our choice of what cipher to use. */
-const char UNRESTRICTED_SERVER_CIPHER_LIST[] =
+static const char UNRESTRICTED_SERVER_CIPHER_LIST[] =
/* This list is autogenerated with the gen_server_ciphers.py script;
* don't hand-edit it. */
#ifdef TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384
diff --git a/src/common/tortls.h b/src/common/tortls.h
index 1a59c67df3..b6ab2ec8f5 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -164,8 +164,18 @@ STATIC int tor_tls_context_init_one(tor_tls_context_t **ppcontext,
int is_client);
STATIC void tls_log_errors(tor_tls_t *tls, int severity, int domain,
const char *doing);
+
+#ifdef TOR_UNIT_TESTS
+extern int tor_tls_object_ex_data_index;
+extern tor_tls_context_t *server_tls_context;
+extern tor_tls_context_t *client_tls_context;
+extern uint16_t v2_cipher_list[];
+extern uint64_t total_bytes_written_over_tls;
+extern uint64_t total_bytes_written_by_tls;
#endif
+#endif /* endif TORTLS_PRIVATE */
+
const char *tor_tls_err_to_string(int err);
void tor_tls_get_state_description(tor_tls_t *tls, char *buf, size_t sz);