aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Cryptography
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared/Cryptography')
-rw-r--r--src/server/shared/Cryptography/ARC4.h2
-rw-r--r--src/server/shared/Cryptography/BigNumber.cpp8
-rw-r--r--src/server/shared/Cryptography/BigNumber.h4
-rw-r--r--src/server/shared/Cryptography/OpenSSLCrypto.cpp21
4 files changed, 14 insertions, 21 deletions
diff --git a/src/server/shared/Cryptography/ARC4.h b/src/server/shared/Cryptography/ARC4.h
index 5304b0730a6..11d3d4ba87b 100644
--- a/src/server/shared/Cryptography/ARC4.h
+++ b/src/server/shared/Cryptography/ARC4.h
@@ -19,8 +19,8 @@
#ifndef _AUTH_SARC4_H
#define _AUTH_SARC4_H
-#include "Define.h"
#include <openssl/evp.h>
+#include "Define.h"
class ARC4
{
diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp
index 1c82314bdba..364bb8e452f 100644
--- a/src/server/shared/Cryptography/BigNumber.cpp
+++ b/src/server/shared/Cryptography/BigNumber.cpp
@@ -16,13 +16,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <ace/Guard_T.h>
-
#include "Cryptography/BigNumber.h"
#include <openssl/bn.h>
#include <openssl/crypto.h>
#include <algorithm>
-#include <ace/Auto_Ptr.h>
+#include <memory>
BigNumber::BigNumber()
: _bn(BN_new())
@@ -170,7 +168,7 @@ bool BigNumber::isZero() const
return BN_is_zero(_bn);
}
-ACE_Auto_Array_Ptr<uint8> BigNumber::AsByteArray(int32 minSize, bool littleEndian)
+std::unique_ptr<uint8[]> BigNumber::AsByteArray(int32 minSize, bool littleEndian)
{
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
@@ -186,7 +184,7 @@ ACE_Auto_Array_Ptr<uint8> BigNumber::AsByteArray(int32 minSize, bool littleEndia
if (littleEndian)
std::reverse(array, array + length);
- ACE_Auto_Array_Ptr<uint8> ret(array);
+ std::unique_ptr<uint8[]> ret(array);
return ret;
}
diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h
index 7de53b442ae..df19ba60b71 100644
--- a/src/server/shared/Cryptography/BigNumber.h
+++ b/src/server/shared/Cryptography/BigNumber.h
@@ -19,8 +19,8 @@
#ifndef _AUTH_BIGNUMBER_H
#define _AUTH_BIGNUMBER_H
+#include <memory>
#include "Define.h"
-#include <ace/Auto_Ptr.h>
#include <string>
struct bignum_st;
@@ -88,7 +88,7 @@ class BigNumber
uint32 AsDword();
- ACE_Auto_Array_Ptr<uint8> AsByteArray(int32 minSize = 0, bool littleEndian = true);
+ std::unique_ptr<uint8[]> AsByteArray(int32 minSize = 0, bool littleEndian = true);
std::string AsHexStr() const;
std::string AsDecStr() const;
diff --git a/src/server/shared/Cryptography/OpenSSLCrypto.cpp b/src/server/shared/Cryptography/OpenSSLCrypto.cpp
index bd72459e9df..6d8d6584e6c 100644
--- a/src/server/shared/Cryptography/OpenSSLCrypto.cpp
+++ b/src/server/shared/Cryptography/OpenSSLCrypto.cpp
@@ -17,28 +17,23 @@
#include <OpenSSLCrypto.h>
#include <openssl/crypto.h>
-#include <ace/Thread_Mutex.h>
#include <vector>
-#include <ace/Thread.h>
+#include <thread>
+#include <mutex>
-std::vector<ACE_Thread_Mutex*> cryptoLocks;
+std::vector<std::mutex*> cryptoLocks;
static void lockingCallback(int mode, int type, const char* /*file*/, int /*line*/)
{
if (mode & CRYPTO_LOCK)
- cryptoLocks[type]->acquire();
+ cryptoLocks[type]->lock();
else
- cryptoLocks[type]->release();
+ cryptoLocks[type]->unlock();
}
static void threadIdCallback(CRYPTO_THREADID * id)
{
-/// ACE_thread_t turns out to be a struct under Mac OS.
-#ifndef __APPLE__
- CRYPTO_THREADID_set_numeric(id, ACE_Thread::self());
-#else
- CRYPTO_THREADID_set_pointer(id, ACE_Thread::self());
-#endif
+ CRYPTO_THREADID_set_numeric(id, std::hash<std::thread::id>()(std::this_thread::get_id()));
}
void OpenSSLCrypto::threadsSetup()
@@ -46,7 +41,7 @@ void OpenSSLCrypto::threadsSetup()
cryptoLocks.resize(CRYPTO_num_locks());
for(int i = 0 ; i < CRYPTO_num_locks(); ++i)
{
- cryptoLocks[i] = new ACE_Thread_Mutex();
+ cryptoLocks[i] = new std::mutex;
}
CRYPTO_THREADID_set_callback(threadIdCallback);
CRYPTO_set_locking_callback(lockingCallback);
@@ -61,4 +56,4 @@ void OpenSSLCrypto::threadsCleanup()
delete cryptoLocks[i];
}
cryptoLocks.resize(0);
-} \ No newline at end of file
+}