diff options
Diffstat (limited to 'src/common/Cryptography')
-rw-r--r-- | src/common/Cryptography/ARC4.cpp | 8 | ||||
-rw-r--r-- | src/common/Cryptography/BigNumber.cpp | 2 | ||||
-rw-r--r-- | src/common/Cryptography/BigNumber.h | 2 | ||||
-rw-r--r-- | src/common/Cryptography/HMACSHA1.cpp | 11 | ||||
-rw-r--r-- | src/common/Cryptography/HMACSHA1.h | 6 | ||||
-rw-r--r-- | src/common/Cryptography/OpenSSLCrypto.cpp | 6 |
6 files changed, 18 insertions, 17 deletions
diff --git a/src/common/Cryptography/ARC4.cpp b/src/common/Cryptography/ARC4.cpp index 1a568f99700..ee5837b5b42 100644 --- a/src/common/Cryptography/ARC4.cpp +++ b/src/common/Cryptography/ARC4.cpp @@ -21,16 +21,16 @@ ARC4::ARC4(uint32 len) : m_ctx() { EVP_CIPHER_CTX_init(&m_ctx); - EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL); + EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), nullptr, nullptr, nullptr); EVP_CIPHER_CTX_set_key_length(&m_ctx, len); } ARC4::ARC4(uint8 *seed, uint32 len) : m_ctx() { EVP_CIPHER_CTX_init(&m_ctx); - EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL); + EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), nullptr, nullptr, nullptr); EVP_CIPHER_CTX_set_key_length(&m_ctx, len); - EVP_EncryptInit_ex(&m_ctx, NULL, NULL, seed, NULL); + EVP_EncryptInit_ex(&m_ctx, nullptr, nullptr, seed, nullptr); } ARC4::~ARC4() @@ -40,7 +40,7 @@ ARC4::~ARC4() void ARC4::Init(uint8 *seed) { - EVP_EncryptInit_ex(&m_ctx, NULL, NULL, seed, NULL); + EVP_EncryptInit_ex(&m_ctx, nullptr, nullptr, seed, nullptr); } void ARC4::UpdateData(int len, uint8 *data) diff --git a/src/common/Cryptography/BigNumber.cpp b/src/common/Cryptography/BigNumber.cpp index fe048104f85..c67e8c8fbbc 100644 --- a/src/common/Cryptography/BigNumber.cpp +++ b/src/common/Cryptography/BigNumber.cpp @@ -112,7 +112,7 @@ BigNumber BigNumber::operator/=(BigNumber const& bn) BN_CTX *bnctx; bnctx = BN_CTX_new(); - BN_div(_bn, NULL, _bn, bn._bn, bnctx); + BN_div(_bn, nullptr, _bn, bn._bn, bnctx); BN_CTX_free(bnctx); return *this; diff --git a/src/common/Cryptography/BigNumber.h b/src/common/Cryptography/BigNumber.h index c8ca5860933..8936ffffe53 100644 --- a/src/common/Cryptography/BigNumber.h +++ b/src/common/Cryptography/BigNumber.h @@ -19,8 +19,8 @@ #ifndef _AUTH_BIGNUMBER_H #define _AUTH_BIGNUMBER_H -#include <memory> #include "Define.h" +#include <memory> #include <string> struct bignum_st; diff --git a/src/common/Cryptography/HMACSHA1.cpp b/src/common/Cryptography/HMACSHA1.cpp index a10c012e896..c6936cacaef 100644 --- a/src/common/Cryptography/HMACSHA1.cpp +++ b/src/common/Cryptography/HMACSHA1.cpp @@ -18,12 +18,13 @@ #include "HMACSHA1.h" #include "BigNumber.h" -#include "Common.h" +#include "Errors.h" +#include <cstring> -HmacHash::HmacHash(uint32 len, uint8 *seed) +HmacHash::HmacHash(uint32 len, uint8* seed) { HMAC_CTX_init(&m_ctx); - HMAC_Init_ex(&m_ctx, seed, len, EVP_sha1(), NULL); + HMAC_Init_ex(&m_ctx, seed, len, EVP_sha1(), nullptr); memset(m_digest, 0, sizeof(m_digest)); } @@ -32,12 +33,12 @@ HmacHash::~HmacHash() HMAC_CTX_cleanup(&m_ctx); } -void HmacHash::UpdateData(const std::string &str) +void HmacHash::UpdateData(std::string const& str) { HMAC_Update(&m_ctx, (uint8 const*)str.c_str(), str.length()); } -void HmacHash::UpdateData(const uint8* data, size_t len) +void HmacHash::UpdateData(uint8 const* data, size_t len) { HMAC_Update(&m_ctx, data, len); } diff --git a/src/common/Cryptography/HMACSHA1.h b/src/common/Cryptography/HMACSHA1.h index 19db12f82c0..972c9b02012 100644 --- a/src/common/Cryptography/HMACSHA1.h +++ b/src/common/Cryptography/HMACSHA1.h @@ -31,10 +31,10 @@ class BigNumber; class TC_COMMON_API HmacHash { public: - HmacHash(uint32 len, uint8 *seed); + HmacHash(uint32 len, uint8* seed); ~HmacHash(); - void UpdateData(const std::string &str); - void UpdateData(const uint8* data, size_t len); + void UpdateData(std::string const& str); + void UpdateData(uint8 const* data, size_t len); void Finalize(); uint8 *ComputeHash(BigNumber* bn); uint8 *GetDigest() { return (uint8*)m_digest; } diff --git a/src/common/Cryptography/OpenSSLCrypto.cpp b/src/common/Cryptography/OpenSSLCrypto.cpp index 7a97cc2375e..3f7bdef9fce 100644 --- a/src/common/Cryptography/OpenSSLCrypto.cpp +++ b/src/common/Cryptography/OpenSSLCrypto.cpp @@ -23,7 +23,7 @@ std::vector<std::mutex*> cryptoLocks; -static void lockingCallback(int mode, int type, const char* /*file*/, int /*line*/) +static void lockingCallback(int mode, int type, char const* /*file*/, int /*line*/) { if (mode & CRYPTO_LOCK) cryptoLocks[type]->lock(); @@ -49,8 +49,8 @@ void OpenSSLCrypto::threadsSetup() void OpenSSLCrypto::threadsCleanup() { - CRYPTO_set_locking_callback(NULL); - CRYPTO_THREADID_set_callback(NULL); + CRYPTO_set_locking_callback(nullptr); + CRYPTO_THREADID_set_callback(nullptr); for(int i = 0 ; i < CRYPTO_num_locks(); ++i) { delete cryptoLocks[i]; |