summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-04 20:21:07 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-04 20:21:07 -0400
commit0db5c549571eb0098a3f709ffb25c2e4909ca01d (patch)
tree0dbf1fbe9b25ddab292eadca50703f34de4c919e /src/core
parentfd994f55c441922d3c5ae19ad5c254a1ae1eccfd (diff)
parentd644c93ae9373f99d95870c7b752b790f8714201 (diff)
downloadtor-0db5c549571eb0098a3f709ffb25c2e4909ca01d.tar.gz
tor-0db5c549571eb0098a3f709ffb25c2e4909ca01d.zip
Merge branch 'nss_squashed' into nss_merge
Diffstat (limited to 'src/core')
-rw-r--r--src/core/crypto/onion_ntor.c2
-rw-r--r--src/core/crypto/relay_crypto.c2
-rw-r--r--src/core/mainloop/connection.c25
-rw-r--r--src/core/mainloop/main.c6
-rw-r--r--src/core/or/channeltls.c1
-rw-r--r--src/core/or/connection_or.c1
-rw-r--r--src/core/or/or.h3
7 files changed, 27 insertions, 13 deletions
diff --git a/src/core/crypto/onion_ntor.c b/src/core/crypto/onion_ntor.c
index ea7261cb53..3614e0c9b1 100644
--- a/src/core/crypto/onion_ntor.c
+++ b/src/core/crypto/onion_ntor.c
@@ -22,7 +22,7 @@
#define ONION_NTOR_PRIVATE
-#include "lib/crypt_ops/crypto.h"
+#include "lib/crypt_ops/crypto_cipher.h"
#include "lib/crypt_ops/crypto_digest.h"
#include "lib/crypt_ops/crypto_hkdf.h"
#include "lib/crypt_ops/crypto_util.h"
diff --git a/src/core/crypto/relay_crypto.c b/src/core/crypto/relay_crypto.c
index b2388d2c45..311160a669 100644
--- a/src/core/crypto/relay_crypto.c
+++ b/src/core/crypto/relay_crypto.c
@@ -7,7 +7,7 @@
#include "core/or/or.h"
#include "core/or/circuitlist.h"
#include "app/config/config.h"
-#include "lib/crypt_ops/crypto.h"
+#include "lib/crypt_ops/crypto_cipher.h"
#include "lib/crypt_ops/crypto_util.h"
#include "core/crypto/hs_ntor.h" // for HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN
#include "core/or/relay.h"
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index a0902f5164..d6b191afc4 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -449,6 +449,20 @@ connection_new(int type, int socket_family)
}
}
+static void
+connection_close_and_invalidate_socket(connection_t *conn)
+{
+ if (connection_speaks_cells(conn)) {
+ or_connection_t *or_conn = TO_OR_CONN(conn);
+ tor_tls_free(or_conn->tls);
+ or_conn->tls = NULL;
+ or_conn->base_.s = TOR_INVALID_SOCKET;
+ } else {
+ tor_close_socket(conn->s);
+ conn->s = TOR_INVALID_SOCKET;
+ }
+}
+
/** Initializes conn. (you must call connection_add() to link it into the main
* array).
*
@@ -614,9 +628,8 @@ connection_free_minimal(connection_t *conn)
tor_free(conn->address);
if (connection_speaks_cells(conn)) {
+ connection_close_and_invalidate_socket(conn);
or_connection_t *or_conn = TO_OR_CONN(conn);
- tor_tls_free(or_conn->tls);
- or_conn->tls = NULL;
or_handshake_state_free(or_conn->handshake_state);
or_conn->handshake_state = NULL;
tor_free(or_conn->nickname);
@@ -692,9 +705,7 @@ connection_free_minimal(connection_t *conn)
}
if (SOCKET_OK(conn->s)) {
- log_debug(LD_NET,"closing fd %d.",(int)conn->s);
- tor_close_socket(conn->s);
- conn->s = TOR_INVALID_SOCKET;
+ connection_close_and_invalidate_socket(conn);
}
if (conn->type == CONN_TYPE_OR &&
@@ -820,9 +831,7 @@ connection_close_immediate(connection_t *conn)
conn->read_blocked_on_bw = 0;
conn->write_blocked_on_bw = 0;
- if (SOCKET_OK(conn->s))
- tor_close_socket(conn->s);
- conn->s = TOR_INVALID_SOCKET;
+ connection_close_and_invalidate_socket(conn);
if (conn->linked)
conn->linked_conn_is_closed = 1;
if (conn->outbuf)
diff --git a/src/core/mainloop/main.c b/src/core/mainloop/main.c
index 27c4a9b3bf..2a1ef0ba74 100644
--- a/src/core/mainloop/main.c
+++ b/src/core/mainloop/main.c
@@ -121,6 +121,7 @@
#include "lib/evloop/compat_libevent.h"
#include "lib/encoding/confline.h"
#include "lib/evloop/timers.h"
+#include "lib/crypt_ops/crypto_init.h"
#include <event2/event.h>
@@ -3503,10 +3504,11 @@ tor_init(int argc, char *argv[])
const char *version = get_version();
log_notice(LD_GENERAL, "Tor %s running on %s with Libevent %s, "
- "OpenSSL %s, Zlib %s, Liblzma %s, and Libzstd %s.", version,
+ "%s %s, Zlib %s, Liblzma %s, and Libzstd %s.", version,
get_uname(),
tor_libevent_get_version_str(),
- crypto_openssl_get_version_str(),
+ crypto_get_library_name(),
+ crypto_get_library_version_string(),
tor_compress_supports_method(ZLIB_METHOD) ?
tor_compress_version_str(ZLIB_METHOD) : "N/A",
tor_compress_supports_method(LZMA_METHOD) ?
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index 96898993c1..b90a2ea872 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -70,6 +70,7 @@
#include "core/or/var_cell_st.h"
#include "lib/tls/tortls.h"
+#include "lib/tls/x509.h"
/** How many CELL_PADDING cells have we received, ever? */
uint64_t stats_n_padding_cells_processed = 0;
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
index c5ff10f6a3..08371d1ad7 100644
--- a/src/core/or/connection_or.c
+++ b/src/core/or/connection_or.c
@@ -73,6 +73,7 @@
#include "lib/crypt_ops/crypto_format.h"
#include "lib/tls/tortls.h"
+#include "lib/tls/x509.h"
static int connection_tls_finish_handshake(or_connection_t *conn);
static int connection_or_launch_v3_or_handshake(or_connection_t *conn);
diff --git a/src/core/or/or.h b/src/core/or/or.h
index f0cef06011..eae0270124 100644
--- a/src/core/or/or.h
+++ b/src/core/or/or.h
@@ -27,7 +27,8 @@
#include "lib/cc/torint.h"
#include "lib/container/map.h"
#include "lib/container/smartlist.h"
-#include "lib/crypt_ops/crypto.h"
+#include "lib/crypt_ops/crypto_cipher.h"
+#include "lib/crypt_ops/crypto_rsa.h"
#include "lib/ctime/di_ops.h"
#include "lib/defs/dh_sizes.h"
#include "lib/encoding/binascii.h"