diff --git a/libtorrent/include/libtorrent/pe_crypto.hpp b/libtorrent/include/libtorrent/pe_crypto.hpp index e2276dee6..5db77f6c7 100644 --- a/libtorrent/include/libtorrent/pe_crypto.hpp +++ b/libtorrent/include/libtorrent/pe_crypto.hpp @@ -62,7 +62,7 @@ namespace libtorrent private: int get_local_key_size () const { - assert (m_DH); + TORRENT_ASSERT(m_DH); return BN_num_bytes (m_DH->pub_key); } @@ -97,8 +97,8 @@ namespace libtorrent void encrypt (char* pos, int len) { - assert (len >= 0); - assert (pos); + TORRENT_ASSERT(len >= 0); + TORRENT_ASSERT(pos); RC4 (&m_local_key, len, reinterpret_cast(pos), reinterpret_cast(pos)); @@ -106,8 +106,8 @@ namespace libtorrent void decrypt (char* pos, int len) { - assert (len >= 0); - assert (pos); + TORRENT_ASSERT(len >= 0); + TORRENT_ASSERT(pos); RC4 (&m_remote_key, len, reinterpret_cast(pos), reinterpret_cast(pos)); diff --git a/libtorrent/src/pe_crypto.cpp b/libtorrent/src/pe_crypto.cpp index 955a7fea0..093bb1265 100644 --- a/libtorrent/src/pe_crypto.cpp +++ b/libtorrent/src/pe_crypto.cpp @@ -52,11 +52,11 @@ namespace libtorrent { m_DH->g = BN_bin2bn (m_dh_generator, sizeof(m_dh_generator), NULL); m_DH->length = 160l; - assert (sizeof(m_dh_prime) == DH_size(m_DH)); + TORRENT_ASSERT(sizeof(m_dh_prime) == DH_size(m_DH)); DH_generate_key (m_DH); // TODO Check != 0 - assert (m_DH->pub_key); + TORRENT_ASSERT(m_DH->pub_key); // DH can generate key sizes that are smaller than the size of // P with exponentially decreasing probability, in which case @@ -78,7 +78,7 @@ namespace libtorrent { DH_key_exchange::~DH_key_exchange () { - assert (m_DH); + TORRENT_ASSERT(m_DH); DH_free (m_DH); } @@ -91,7 +91,7 @@ namespace libtorrent { // compute shared secret given remote public key void DH_key_exchange::compute_secret (char const* remote_pubkey) { - assert (remote_pubkey); + TORRENT_ASSERT(remote_pubkey); BIGNUM* bn_remote_pubkey = BN_bin2bn ((unsigned char*)remote_pubkey, 96, NULL); char dh_secret[96];