diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index b82a7c954..38cb78e3b 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -444,7 +444,7 @@ namespace aux { , std::vector
const& addresses, int port); #endif -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION torrent const* find_encrypted_torrent( sha1_hash const& info_hash, sha1_hash const& xor_mask) override; @@ -876,7 +876,7 @@ namespace aux { // ordered by their queue position aux::vector m_download_queue; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // this maps obfuscated hashes to torrents. It's only // used when encryption is enabled torrent_map m_obfuscated_torrents; diff --git a/include/libtorrent/aux_/session_interface.hpp b/include/libtorrent/aux_/session_interface.hpp index 64c58ab51..3c7f6815e 100644 --- a/include/libtorrent/aux_/session_interface.hpp +++ b/include/libtorrent/aux_/session_interface.hpp @@ -294,7 +294,7 @@ namespace aux { virtual boost::asio::ssl::context* ssl_ctx() = 0 ; #endif -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION virtual torrent const* find_encrypted_torrent( sha1_hash const& info_hash, sha1_hash const& xor_mask) = 0; virtual void add_obfuscated_hash(sha1_hash const& obfuscated diff --git a/include/libtorrent/bt_peer_connection.hpp b/include/libtorrent/bt_peer_connection.hpp index 65a284cb5..5ae6185b4 100644 --- a/include/libtorrent/bt_peer_connection.hpp +++ b/include/libtorrent/bt_peer_connection.hpp @@ -108,7 +108,7 @@ namespace libtorrent { ~bt_peer_connection() override; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION bool supports_encryption() const { return m_encrypted; } bool rc4_encrypted() const @@ -171,7 +171,7 @@ namespace libtorrent { , std::size_t bytes_transferred) override; void on_receive_impl(std::size_t bytes_transferred); -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // next_barrier, buffers-to-prepend std::tuple>> hit_send_barrier(span> iovec) override; @@ -295,7 +295,7 @@ namespace libtorrent { // will be invalid. piece_block_progress downloading_piece_progress() const override; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // if (is_local()), we are 'a' otherwise 'b' // @@ -324,7 +324,7 @@ namespace libtorrent { template void append_const_send_buffer(Holder holder, int size) { -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION if (!m_enc_handler.is_send_plaintext()) { // if we're encrypting this buffer, we need to make a copy @@ -343,7 +343,7 @@ namespace libtorrent { enum class state_t : std::uint8_t { -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION read_pe_dhkey, read_pe_syncvc, read_pe_synchash, @@ -386,7 +386,7 @@ namespace libtorrent { // only done once per connection bool m_sent_allowed_fast:1; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // this is set to true after the encryption method has been // successfully negotiated (either plaintext or rc4), to signal // automatic encryption/decryption. @@ -436,7 +436,7 @@ namespace libtorrent { std::vector m_payloads; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // initialized during write_pe1_2_dhkey, and destroyed on // creation of m_enc_handler. Cannot reinitialize once // initialized. diff --git a/include/libtorrent/receive_buffer.hpp b/include/libtorrent/receive_buffer.hpp index 53c64c993..b03355e78 100644 --- a/include/libtorrent/receive_buffer.hpp +++ b/include/libtorrent/receive_buffer.hpp @@ -88,7 +88,7 @@ struct TORRENT_EXTRA_EXPORT receive_buffer // This is the "current" packet. span get() const; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // returns the buffer from the current packet start position to the last // received byte (possibly part of another packet) span mutable_buffer(); @@ -159,7 +159,7 @@ private: buffer m_recv_buffer; }; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // Wraps a receive_buffer to provide the ability to inject // possibly authenticated crypto beneath the bittorrent protocol. // When authenticated crypto is in use the wrapped receive_buffer diff --git a/include/libtorrent/torrent_peer.hpp b/include/libtorrent/torrent_peer.hpp index e2fec86ad..0d15616e5 100644 --- a/include/libtorrent/torrent_peer.hpp +++ b/include/libtorrent/torrent_peer.hpp @@ -157,7 +157,7 @@ namespace libtorrent { peer_source_flags_t peer_source() const { return peer_source_flags_t(source); } -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // Hints encryption support of torrent_peer. Only effective // for and when the outgoing encryption policy // allows both encrypted and non encrypted diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index ec7da00ef..d597bcba8 100644 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -131,7 +131,7 @@ namespace libtorrent { , (tracker_req().event != tracker_request::none) ? event_string[tracker_req().event - 1] : "" , tracker_req().num_want); url += str; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION if (settings.get_int(settings_pack::in_enc_policy) != settings_pack::pe_disabled && settings.get_bool(settings_pack::announce_crypto_support)) url += "&supportcrypto=1"; diff --git a/src/pe_crypto.cpp b/src/pe_crypto.cpp index 8fb1e02c7..faea2f787 100644 --- a/src/pe_crypto.cpp +++ b/src/pe_crypto.cpp @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. */ -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION #include #include @@ -411,4 +411,4 @@ std::size_t rc4_encrypt(unsigned char *out, std::size_t outlen, rc4 *state) } // namespace libtorrent -#endif // TORRENT_DISABLE_ENCRYPION +#endif // TORRENT_DISABLE_ENCRYPTION diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 517a3a89d..9c574311b 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -4275,7 +4275,7 @@ namespace libtorrent { if (m_outgoing) m_counters.inc_stats_counter(counters::error_outgoing_peers); else m_counters.inc_stats_counter(counters::error_incoming_peers); -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION if (type() == connection_type::bittorrent && op != operation_t::connect) { auto* bt = static_cast(this); diff --git a/src/peer_connection_handle.cpp b/src/peer_connection_handle.cpp index 4d7367528..47fe9a5f6 100644 --- a/src/peer_connection_handle.cpp +++ b/src/peer_connection_handle.cpp @@ -315,7 +315,7 @@ bool bt_peer_connection_handle::support_extensions() const bool bt_peer_connection_handle::supports_encryption() const { -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION std::shared_ptr pc = native_handle(); TORRENT_ASSERT(pc); return pc->supports_encryption(); @@ -326,7 +326,7 @@ bool bt_peer_connection_handle::supports_encryption() const void bt_peer_connection_handle::switch_send_crypto(std::shared_ptr crypto) { -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION std::shared_ptr pc = native_handle(); TORRENT_ASSERT(pc); pc->switch_send_crypto(std::move(crypto)); @@ -337,7 +337,7 @@ void bt_peer_connection_handle::switch_send_crypto(std::shared_ptr crypto) { -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION std::shared_ptr pc = native_handle(); TORRENT_ASSERT(pc); pc->switch_recv_crypto(std::move(crypto)); diff --git a/src/peer_list.cpp b/src/peer_list.cpp index 50f7c378e..698fed592 100644 --- a/src/peer_list.cpp +++ b/src/peer_list.cpp @@ -922,7 +922,7 @@ namespace libtorrent { if (m_round_robin >= iter - m_peers.begin()) ++m_round_robin; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION if (flags & pex_encryption) p->pe_support = true; #endif if (flags & pex_seed) diff --git a/src/receive_buffer.cpp b/src/receive_buffer.cpp index 80ffbefa5..5e39fa93a 100644 --- a/src/receive_buffer.cpp +++ b/src/receive_buffer.cpp @@ -150,7 +150,7 @@ span receive_buffer::get() const return aux::typed_span(m_recv_buffer).subspan(m_recv_start, m_recv_pos); } -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION span receive_buffer::mutable_buffer() { INVARIANT_CHECK; @@ -230,7 +230,7 @@ void receive_buffer::reset(int const packet_size) m_packet_size = packet_size; } -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION bool crypto_receive_buffer::packet_finished() const { if (m_recv_pos == INT_MAX) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index dbf0280fc..dedf7c8b4 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -4460,7 +4460,7 @@ namespace aux { trigger_auto_manage(); } -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION torrent const* session_impl::find_encrypted_torrent(sha1_hash const& info_hash , sha1_hash const& xor_mask) { @@ -4803,7 +4803,7 @@ namespace aux { m_torrents.insert(std::make_pair(params.info_hash, torrent_ptr)); -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION static char const req2[4] = {'r', 'e', 'q', '2'}; hasher h(req2); h.update(params.info_hash); @@ -5191,7 +5191,7 @@ namespace aux { m_torrents.erase(i); tptr->removed(); -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION static char const req2[4] = {'r', 'e', 'q', '2'}; hasher h(req2); h.update(tptr->info_hash()); @@ -6092,13 +6092,13 @@ namespace aux { #endif -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION void session_impl::add_obfuscated_hash(sha1_hash const& obfuscated , std::weak_ptr const& t) { m_obfuscated_torrents.insert(std::make_pair(obfuscated, t.lock())); } -#endif // TORRENT_DISABLE_ENCRYPION +#endif // TORRENT_DISABLE_ENCRYPTION bool session_impl::is_listening() const { diff --git a/src/torrent.cpp b/src/torrent.cpp index 0f01f7d8d..4de5dbe47 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -490,7 +490,7 @@ bool is_downloading_state(int const st) aux::random_shuffle(ws.begin(), ws.end()); for (auto& w : ws) m_web_seeds.push_back(std::move(w)); -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION static char const req2[4] = {'r', 'e', 'q', '2'}; hasher h(req2); h.update(m_torrent_file->info_hash()); diff --git a/src/torrent_peer.cpp b/src/torrent_peer.cpp index 2519011d1..e206aa15b 100644 --- a/src/torrent_peer.cpp +++ b/src/torrent_peer.cpp @@ -151,7 +151,7 @@ namespace libtorrent { , fast_reconnects(0) , trust_points(0) , source(static_cast(src)) -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION // assume no support in order to // prefer opening non-encrypted // connections. If it fails, we'll diff --git a/src/ut_pex.cpp b/src/ut_pex.cpp index ef2feed70..e2f74fd9c 100644 --- a/src/ut_pex.cpp +++ b/src/ut_pex.cpp @@ -167,7 +167,7 @@ namespace libtorrent { namespace { // used as a rendezvous point in case direct // connections to the peer fail pex_flags_t flags = p->is_seed() ? pex_seed : pex_flags_t{}; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION flags |= p->supports_encryption() ? pex_encryption : pex_flags_t{}; #endif flags |= is_utp(*p->get_socket()) ? pex_utp : pex_flags_t{}; @@ -552,7 +552,7 @@ namespace libtorrent { namespace { // used as a rendezvous point in case direct // connections to the peer fail int flags = p->is_seed() ? 2 : 0; -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION flags |= p->supports_encryption() ? 1 : 0; #endif flags |= is_utp(*p->get_socket()) ? 4 : 0; diff --git a/test/test_pe_crypto.cpp b/test/test_pe_crypto.cpp index 6e5d1a82b..6c508f114 100644 --- a/test/test_pe_crypto.cpp +++ b/test/test_pe_crypto.cpp @@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "setup_transfer.hpp" #include "test.hpp" -#if !defined TORRENT_DISABLE_ENCRYPION +#if !defined TORRENT_DISABLE_ENCRYPTION namespace {