aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--Makefile.am14
-rw-r--r--changes/40241_v24
-rw-r--r--changes/bug401133
-rw-r--r--changes/bug401175
-rw-r--r--changes/ticket401655
-rw-r--r--changes/ticket401703
-rw-r--r--changes/ticket402274
-rw-r--r--configure.ac21
-rw-r--r--contrib/win32build/tor-mingw.nsi.in2
-rwxr-xr-xscripts/maint/gen_ccls_file.sh20
-rw-r--r--src/core/or/channeltls.c4
-rw-r--r--src/core/or/circuitlist.c4
-rw-r--r--src/feature/client/entrynodes.c4
-rw-r--r--src/feature/rend/rendclient.c4
-rw-r--r--src/feature/rend/rendmid.c6
-rw-r--r--src/lib/crypt_ops/compat_openssl.h5
-rw-r--r--src/lib/crypt_ops/crypto_openssl_mgt.c13
-rw-r--r--src/lib/crypt_ops/crypto_openssl_mgt.h3
-rw-r--r--src/lib/log/util_bug.h11
-rw-r--r--src/test/test_connection.c7
-rw-r--r--src/test/test_tortls_openssl.c3
-rw-r--r--src/win32/orconfig.h2
23 files changed, 122 insertions, 32 deletions
diff --git a/.gitignore b/.gitignore
index f1ce903a11..736abbedc3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,12 @@ details-*.json
uptime-*.json
*.full_url
*.last_modified
+# Core files
+core
+core.*
+!core/
+# ccls file that can be per directory.
+*.ccls
# /
/Makefile
@@ -73,6 +79,7 @@ uptime-*.json
/Tor*Bundle.dmg
/tor-*-win32.exe
/warning_flags
+/compile_commands.json
/coverage_html/
/callgraph/
diff --git a/Makefile.am b/Makefile.am
index a868be7362..c7bc514287 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -470,3 +470,17 @@ show-libs:
show-testing-libs:
@echo $(TOR_INTERNAL_TESTING_LIBS)
+
+# Note here that we hardcode this -j2 because if the user would pass too many
+# cores, bear actually chockes and dies :S. For this to work, a make clean
+# needs to be done else bear will miss some compile flags.
+lsp:
+ @if test -x "`which bear 2>&1;true`"; then \
+ echo "Generating LSP compile_commands.json. Might take few minutes..."; \
+ $(MAKE) clean 2>&1 >/dev/null; \
+ bear >/dev/null 2>&1 -- $(MAKE) -j2 2>&1 >/dev/null; \
+ echo "Generating .ccls file..."; \
+ ./scripts/maint/gen_ccls_file.sh \
+ else \
+ echo "No bear command found. On debian, apt install bear"; \
+ fi
diff --git a/changes/40241_v2 b/changes/40241_v2
new file mode 100644
index 0000000000..85038297f7
--- /dev/null
+++ b/changes/40241_v2
@@ -0,0 +1,4 @@
+ o Minor bugfixes (compilation):
+ - Fix another warning about unreachable fallthrough annotations
+ when building with "--enable-all-bugs-are-fatal" on some compilers.
+ Fixes bug 40241; bugfix on 0.4.5.3-rc.
diff --git a/changes/bug40113 b/changes/bug40113
new file mode 100644
index 0000000000..adf4634097
--- /dev/null
+++ b/changes/bug40113
@@ -0,0 +1,3 @@
+ o Minor bugfixes (compilation):
+ - Resolve a compilation warning that could occur in test_connection.c.
+ Fixes bug 40113; bugfix on 0.2.9.3-alpha.
diff --git a/changes/bug40117 b/changes/bug40117
new file mode 100644
index 0000000000..77646edf9c
--- /dev/null
+++ b/changes/bug40117
@@ -0,0 +1,5 @@
+ o Major bugfixes (stats, onion services):
+ - Fix a bug where we were undercounting the Tor network's total onion
+ service traffic, by only counting rendezvous traffic originating from
+ services and ignoring any traffic originating from clients. Fixes bug
+ 40117; bugfix on 0.2.6.2-alpha.
diff --git a/changes/ticket40165 b/changes/ticket40165
new file mode 100644
index 0000000000..a8dd0a339b
--- /dev/null
+++ b/changes/ticket40165
@@ -0,0 +1,5 @@
+ o Minor features (compilation):
+ - Disable deprecation warnings when building with OpenSSL 3.0.0 or later.
+ There are a number of newly deprecated APIs in OpenSSL 3.0.0 that Tor
+ still requires. (A later version of Tor will try to stop depending on
+ these.) Closes ticket 40165.
diff --git a/changes/ticket40170 b/changes/ticket40170
new file mode 100644
index 0000000000..cc1c8dbad1
--- /dev/null
+++ b/changes/ticket40170
@@ -0,0 +1,3 @@
+ o Minor bugfixes (tests):
+ - Fix the "tortls/openssl/log_one_error" test to work with OpenSSL 3.0.0.
+ Fixes bug 40170; bugfix on 0.2.8.1-alpha.
diff --git a/changes/ticket40227 b/changes/ticket40227
new file mode 100644
index 0000000000..e5efad0f95
--- /dev/null
+++ b/changes/ticket40227
@@ -0,0 +1,4 @@
+ o Minor feature (build system):
+ - New "make lsp" command to auto generate the compile_commands.json file
+ used by the ccls server. The "bear" program is needed for this. Closes
+ ticket 40227.
diff --git a/configure.ac b/configure.ac
index 642e4cf09c..c7bda74c8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl Copyright (c) 2007-2019, The Tor Project, Inc.
dnl See LICENSE for licensing information
AC_PREREQ([2.63])
-AC_INIT([tor],[0.3.5.12-dev])
+AC_INIT([tor],[0.3.5.13])
AC_CONFIG_SRCDIR([src/app/main/tor_main.c])
AC_CONFIG_MACRO_DIR([m4])
@@ -937,13 +937,30 @@ LIBS="$TOR_OPENSSL_LIBS $LIBS"
LDFLAGS="$TOR_LDFLAGS_openssl $LDFLAGS"
CPPFLAGS="$TOR_CPPFLAGS_openssl $CPPFLAGS"
+dnl Tor currently uses a number of APIs that are deprecated in OpenSSL 3.0.0
+dnl and later. We want to migrate away from them, but that will be a lot of
+dnl work. (See ticket tor#40166.) For now, we disable the deprecation
+dnl warnings.
+
+AC_MSG_CHECKING([for OpenSSL >= 3.0.0])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <openssl/opensslv.h>
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER <= 0x30000000L
+#error "you_have_version_3"
+#endif
+ ]], [[]])],
+ [ AC_MSG_RESULT([no]) ],
+ [ AC_MSG_RESULT([yes]);
+ AC_DEFINE(OPENSSL_SUPPRESS_DEPRECATED, 1, [disable openssl deprecated-function warnings]) ])
+
+AC_MSG_CHECKING([for OpenSSL < 1.0.1])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <openssl/opensslv.h>
#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1000100fL
#error "too old"
#endif
]], [[]])],
- [ : ],
+ [ AC_MSG_RESULT([no]) ],
[ AC_MSG_ERROR([OpenSSL is too old. We require 1.0.1 or later. You can specify a path to a newer one with --with-openssl-dir.]) ])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
diff --git a/contrib/win32build/tor-mingw.nsi.in b/contrib/win32build/tor-mingw.nsi.in
index 37a0e1e93b..04a720a171 100644
--- a/contrib/win32build/tor-mingw.nsi.in
+++ b/contrib/win32build/tor-mingw.nsi.in
@@ -8,7 +8,7 @@
!include "LogicLib.nsh"
!include "FileFunc.nsh"
!insertmacro GetParameters
-!define VERSION "0.3.5.12-dev"
+!define VERSION "0.3.5.13"
!define INSTALLER "tor-${VERSION}-win32.exe"
!define WEBSITE "https://www.torproject.org/"
!define LICENSE "LICENSE"
diff --git a/scripts/maint/gen_ccls_file.sh b/scripts/maint/gen_ccls_file.sh
new file mode 100755
index 0000000000..899e4e9603
--- /dev/null
+++ b/scripts/maint/gen_ccls_file.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+##############################################################################
+# THIS MUST BE CALLED FROM THE ROOT DIRECTORY. IT IS USED BY THE MAKEFILE SO #
+# IN THEORY, YOU SHOULD NEVER CALL THIS. #
+##############################################################################
+
+set -e
+
+CCLS_FILE=".ccls"
+
+# Get all #define *_PRIVATE from our source. We need to list them in our .ccls
+# file and enable them otherwise ccls will not find their definition thinking
+# that they are dead code.
+PRIVATE_DEFS=$(grep -r --include \*.h "_PRIVATE" | grep "#ifdef" | cut -d' ' -f2 | sort | uniq)
+
+echo "clang" > "$CCLS_FILE"
+for p in $PRIVATE_DEFS; do
+ echo "-D$p" >> "$CCLS_FILE"
+done
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index bdd82f3138..18025ff73a 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -1225,9 +1225,7 @@ channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
* the v2 and v3 handshakes. */
/* But that should be happening any longer've disabled bufferevents. */
tor_assert_nonfatal_unreached_once();
-#ifndef ALL_BUGS_ARE_FATAL
- FALLTHROUGH;
-#endif
+ FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL;
case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
if (!(command_allowed_before_handshake(var_cell->command))) {
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index 83e2124498..ccf3041bb4 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -787,9 +787,7 @@ circuit_purpose_to_controller_hs_state_string(uint8_t purpose)
"Unrecognized circuit purpose: %d",
(int)purpose);
tor_fragile_assert();
-#ifndef ALL_BUGS_ARE_FATAL
- FALLTHROUGH;
-#endif
+ FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL;
case CIRCUIT_PURPOSE_OR:
case CIRCUIT_PURPOSE_C_GENERAL:
diff --git a/src/feature/client/entrynodes.c b/src/feature/client/entrynodes.c
index c930fe244f..6c7f8057bd 100644
--- a/src/feature/client/entrynodes.c
+++ b/src/feature/client/entrynodes.c
@@ -2263,9 +2263,7 @@ entry_guards_note_guard_success(guard_selection_t *gs,
break;
default:
tor_assert_nonfatal_unreached();
-#ifndef ALL_BUGS_ARE_FATAL
- FALLTHROUGH;
-#endif
+ FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL;
case GUARD_CIRC_STATE_USABLE_IF_NO_BETTER_GUARD:
if (guard->is_primary) {
/* XXXX #20832 -- I don't actually like this logic. It seems to make
diff --git a/src/feature/rend/rendclient.c b/src/feature/rend/rendclient.c
index acff805c0e..6e95142c0b 100644
--- a/src/feature/rend/rendclient.c
+++ b/src/feature/rend/rendclient.c
@@ -819,9 +819,7 @@ rend_client_report_intro_point_failure(extend_info_t *failed_intro,
log_warn(LD_BUG, "Unknown failure type %u. Removing intro point.",
failure_type);
tor_fragile_assert();
-#ifndef ALL_BUGS_ARE_FATAL
- FALLTHROUGH;
-#endif
+ FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL;
case INTRO_POINT_FAILURE_GENERIC:
rend_cache_intro_failure_note(failure_type,
(uint8_t *)failed_intro->identity_digest,
diff --git a/src/feature/rend/rendmid.c b/src/feature/rend/rendmid.c
index 3ba48f8858..af02b34e6b 100644
--- a/src/feature/rend/rendmid.c
+++ b/src/feature/rend/rendmid.c
@@ -333,10 +333,12 @@ rend_mid_rendezvous(or_circuit_t *circ, const uint8_t *request,
goto err;
}
- /* Statistics: Mark this circuit as an RP circuit so that we collect
- stats from it. */
+ /* Statistics: Mark circuits as RP circuits */
if (options->HiddenServiceStatistics) {
+ /* `circ` is the RP <-> service circuit */
circ->circuit_carries_hs_traffic_stats = 1;
+ /* `rend_circ` is the client <-> RP circuit */
+ rend_circ->circuit_carries_hs_traffic_stats = 1;
}
/* Send the RENDEZVOUS2 cell to the client. */
diff --git a/src/lib/crypt_ops/compat_openssl.h b/src/lib/crypt_ops/compat_openssl.h
index 9c10386c34..6605d01045 100644
--- a/src/lib/crypt_ops/compat_openssl.h
+++ b/src/lib/crypt_ops/compat_openssl.h
@@ -32,10 +32,6 @@
#define OPENSSL_1_1_API
#endif /* OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) && ... */
-#ifndef OPENSSL_VERSION
-#define OPENSSL_VERSION SSLEAY_VERSION
-#endif
-
#ifndef OPENSSL_1_1_API
#define OpenSSL_version(v) SSLeay_version(v)
#define OpenSSL_version_num() SSLeay()
@@ -54,4 +50,3 @@
#endif /* defined(ENABLE_OPENSSL) */
#endif /* !defined(TOR_COMPAT_OPENSSL_H) */
-
diff --git a/src/lib/crypt_ops/crypto_openssl_mgt.c b/src/lib/crypt_ops/crypto_openssl_mgt.c
index c97815f9a4..e7d6084f6c 100644
--- a/src/lib/crypt_ops/crypto_openssl_mgt.c
+++ b/src/lib/crypt_ops/crypto_openssl_mgt.c
@@ -101,13 +101,22 @@ static char *crypto_openssl_version_str = NULL;
const char *
crypto_openssl_get_version_str(void)
{
+#ifdef OPENSSL_VERSION
+ const int query = OPENSSL_VERSION;
+#else
+ /* This old name was changed around OpenSSL 1.1.0 */
+ const int query = SSLEAY_VERSION;
+#endif
+
if (crypto_openssl_version_str == NULL) {
- const char *raw_version = OpenSSL_version(OPENSSL_VERSION);
+ const char *raw_version = OpenSSL_version(query);
crypto_openssl_version_str = parse_openssl_version_str(raw_version);
}
return crypto_openssl_version_str;
}
+#undef QUERY_OPENSSL_VERSION
+
static char *crypto_openssl_header_version_str = NULL;
/* Return a human-readable version of the compile-time openssl version
* number. */
@@ -208,7 +217,7 @@ crypto_openssl_early_init(void)
setup_openssl_threading();
unsigned long version_num = OpenSSL_version_num();
- const char *version_str = OpenSSL_version(OPENSSL_VERSION);
+ const char *version_str = crypto_openssl_get_version_str();
if (version_num == OPENSSL_VERSION_NUMBER &&
!strcmp(version_str, OPENSSL_VERSION_TEXT)) {
log_info(LD_CRYPTO, "OpenSSL version matches version from headers "
diff --git a/src/lib/crypt_ops/crypto_openssl_mgt.h b/src/lib/crypt_ops/crypto_openssl_mgt.h
index a3dd03aa04..8dbadfc9d2 100644
--- a/src/lib/crypt_ops/crypto_openssl_mgt.h
+++ b/src/lib/crypt_ops/crypto_openssl_mgt.h
@@ -16,8 +16,7 @@
#include "orconfig.h"
#ifdef ENABLE_OPENSSL
-#include <openssl/engine.h>
-
+#include <openssl/opensslv.h>
/*
Macro to create an arbitrary OpenSSL version number as used by
OPENSSL_VERSION_NUMBER or SSLeay(), since the actual numbers are a bit hard
diff --git a/src/lib/log/util_bug.h b/src/lib/log/util_bug.h
index 2a4d68127e..17e8d0c5a7 100644
--- a/src/lib/log/util_bug.h
+++ b/src/lib/log/util_bug.h
@@ -215,6 +215,17 @@
IF_BUG_ONCE__(ASSERT_PREDICT_UNLIKELY_(cond), \
IF_BUG_ONCE_VARNAME__(__LINE__))
+/**
+ * Use this macro after a nonfatal assertion, and before a case statement
+ * where you would want to fall through.
+ */
+#ifdef ALL_BUGS_ARE_FATAL
+#define FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL \
+ abort()
+#else
+#define FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL FALLTHROUGH
+#endif
+
/** Define this if you want Tor to crash when any problem comes up,
* so you can get a coredump and track things down. */
// #define tor_fragile_assert() tor_assert_unreached(0)
diff --git a/src/test/test_connection.c b/src/test/test_connection.c
index ebe7c6d36f..6f716f5758 100644
--- a/src/test/test_connection.c
+++ b/src/test/test_connection.c
@@ -592,7 +592,8 @@ test_conn_download_status(void *arg)
connection_t *ap_conn = NULL;
const struct testcase_t *tc = arg;
- consensus_flavor_t usable_flavor = (consensus_flavor_t)tc->setup_data;
+ consensus_flavor_t usable_flavor =
+ networkstatus_parse_flavor_name((const char*) tc->setup_data);
/* The "other flavor" trick only works if there are two flavors */
tor_assert(N_CONSENSUS_FLAVORS == 2);
@@ -893,9 +894,9 @@ struct testcase_t connection_tests[] = {
CONNECTION_TESTCASE(get_rend, TT_FORK, test_conn_get_rend_st),
CONNECTION_TESTCASE(get_rsrc, TT_FORK, test_conn_get_rsrc_st),
CONNECTION_TESTCASE_ARG(download_status, TT_FORK,
- test_conn_download_status_st, FLAV_MICRODESC),
+ test_conn_download_status_st, "microdesc"),
CONNECTION_TESTCASE_ARG(download_status, TT_FORK,
- test_conn_download_status_st, FLAV_NS),
+ test_conn_download_status_st, "ns"),
//CONNECTION_TESTCASE(func_suffix, TT_FORK, setup_func_pair),
{ "failed_orconn_tracker", test_failed_orconn_tracker, TT_FORK, NULL, NULL },
END_OF_TESTCASES
diff --git a/src/test/test_tortls_openssl.c b/src/test/test_tortls_openssl.c
index f039980a25..f4e3430dac 100644
--- a/src/test/test_tortls_openssl.c
+++ b/src/test/test_tortls_openssl.c
@@ -283,8 +283,7 @@ test_tortls_log_one_error(void *ignored)
mock_clean_saved_logs();
tor_tls_log_one_error(tls, ERR_PACK(1, 2, 3), LOG_WARN, 0, NULL);
- expect_log_msg("TLS error with 127.hello: "
- "BN lib (in unknown library:(null):---)\n");
+ expect_log_msg_containing("TLS error with 127.hello");
mock_clean_saved_logs();
tor_tls_log_one_error(tls, ERR_PACK(1, 2, SSL_R_HTTP_REQUEST),
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index e67ff13b13..1c0ce18e73 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -218,7 +218,7 @@
#define USING_TWOS_COMPLEMENT
/* Version number of package */
-#define VERSION "0.3.5.12-dev"
+#define VERSION "0.3.5.13"