aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Cryptography/Authentication/WorldPacketCrypt.cpp (renamed from src/common/Cryptography/Authentication/AuthCrypt.cpp)17
-rw-r--r--src/common/Cryptography/Authentication/WorldPacketCrypt.h (renamed from src/common/Cryptography/Authentication/AuthCrypt.h)30
-rw-r--r--src/common/DataStores/DBCFileLoader.cpp2
-rw-r--r--src/common/DataStores/DBCFileLoader.h32
4 files changed, 39 insertions, 42 deletions
diff --git a/src/common/Cryptography/Authentication/AuthCrypt.cpp b/src/common/Cryptography/Authentication/WorldPacketCrypt.cpp
index 86126b3ba81..5df0116d185 100644
--- a/src/common/Cryptography/Authentication/AuthCrypt.cpp
+++ b/src/common/Cryptography/Authentication/WorldPacketCrypt.cpp
@@ -15,18 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "AuthCrypt.h"
-#include "BigNumber.h"
+#include "WorldPacketCrypt.h"
#include "Errors.h"
#include "HMAC.h"
-#include <cstring>
-
-AuthCrypt::AuthCrypt() :
- _initialized(false)
-{ }
+WorldPacketCrypt::WorldPacketCrypt() : _initialized(false)
+{
+}
-void AuthCrypt::Init(SessionKey const& K)
+void WorldPacketCrypt::Init(SessionKey const& K)
{
uint8 ServerEncryptionKey[] = { 0xCC, 0x98, 0xAE, 0x04, 0xE8, 0x97, 0xEA, 0xCA, 0x12, 0xDD, 0xC0, 0x93, 0x42, 0x91, 0x53, 0x57 };
_serverEncrypt.Init(Trinity::Crypto::HMAC_SHA1::GetDigestOf(ServerEncryptionKey, K));
@@ -41,13 +38,13 @@ void AuthCrypt::Init(SessionKey const& K)
_initialized = true;
}
-void AuthCrypt::DecryptRecv(uint8 *data, size_t len)
+void WorldPacketCrypt::DecryptRecv(uint8 *data, size_t len)
{
ASSERT(_initialized);
_clientDecrypt.UpdateData(data, len);
}
-void AuthCrypt::EncryptSend(uint8 *data, size_t len)
+void WorldPacketCrypt::EncryptSend(uint8 *data, size_t len)
{
ASSERT(_initialized);
_serverEncrypt.UpdateData(data, len);
diff --git a/src/common/Cryptography/Authentication/AuthCrypt.h b/src/common/Cryptography/Authentication/WorldPacketCrypt.h
index 86c186bef69..5d7b1e0f65d 100644
--- a/src/common/Cryptography/Authentication/AuthCrypt.h
+++ b/src/common/Cryptography/Authentication/WorldPacketCrypt.h
@@ -15,27 +15,27 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _AUTHCRYPT_H
-#define _AUTHCRYPT_H
+#ifndef _WORLDPACKETCRYPT_H
+#define _WORLDPACKETCRYPT_H
#include "ARC4.h"
#include "AuthDefines.h"
-#include <array>
-class TC_COMMON_API AuthCrypt
+class TC_COMMON_API WorldPacketCrypt
{
- public:
- AuthCrypt();
+public:
+ WorldPacketCrypt();
- void Init(SessionKey const& K);
- void DecryptRecv(uint8* data, size_t len);
- void EncryptSend(uint8* data, size_t len);
+ void Init(SessionKey const& K);
+ void DecryptRecv(uint8* data, size_t len);
+ void EncryptSend(uint8* data, size_t len);
- bool IsInitialized() const { return _initialized; }
+ bool IsInitialized() const { return _initialized; }
- private:
- Trinity::Crypto::ARC4 _clientDecrypt;
- Trinity::Crypto::ARC4 _serverEncrypt;
- bool _initialized;
+private:
+ Trinity::Crypto::ARC4 _clientDecrypt;
+ Trinity::Crypto::ARC4 _serverEncrypt;
+ bool _initialized;
};
-#endif
+
+#endif // _WORLDPACKETCRYPT_H
diff --git a/src/common/DataStores/DBCFileLoader.cpp b/src/common/DataStores/DBCFileLoader.cpp
index a2ace0eb41b..d38ba107014 100644
--- a/src/common/DataStores/DBCFileLoader.cpp
+++ b/src/common/DataStores/DBCFileLoader.cpp
@@ -88,7 +88,7 @@ bool DBCFileLoader::Load(char const* filename, char const* fmt)
for (uint32 i = 1; i < fieldCount; ++i)
{
fieldsOffset[i] = fieldsOffset[i - 1];
- if (fmt[i - 1] == 'b' || fmt[i - 1] == 'X') // byte fields
+ if (fmt[i - 1] == FT_BYTE || fmt[i - 1] == FT_NA_BYTE) // byte fields
fieldsOffset[i] += sizeof(uint8);
else // 4 byte fields (int32/float/strings)
fieldsOffset[i] += sizeof(uint32);
diff --git a/src/common/DataStores/DBCFileLoader.h b/src/common/DataStores/DBCFileLoader.h
index 0abbf6c95eb..40585853490 100644
--- a/src/common/DataStores/DBCFileLoader.h
+++ b/src/common/DataStores/DBCFileLoader.h
@@ -24,17 +24,17 @@
enum DbcFieldFormat
{
- FT_NA='x', //not used or unknown, 4 byte size
- FT_NA_BYTE='X', //not used or unknown, byte
- FT_STRING='s', //char*
- FT_FLOAT='f', //float
- FT_INT='i', //uint32
- FT_BYTE='b', //uint8
- FT_SORT='d', //sorted by this field, field is not included
- FT_IND='n', //the same, but parsed to data
- FT_LOGIC='l', //Logical (boolean)
- FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
- FT_SQL_ABSENT='a' //Used in sql format to mark column absent in sql dbc
+ FT_NA = 'x', //not used or unknown, 4 byte size
+ FT_NA_BYTE = 'X', //not used or unknown, byte
+ FT_STRING = 's', //char*
+ FT_FLOAT = 'f', //float
+ FT_INT = 'i', //uint32
+ FT_BYTE = 'b', //uint8
+ FT_SORT = 'd', //sorted by this field, field is not included
+ FT_IND = 'n', //the same, but parsed to data
+ FT_LOGIC = 'l', //Logical (boolean)
+ FT_SQL_PRESENT = 'p', //Used in sql format to mark column present in sql dbc
+ FT_SQL_ABSENT = 'a' //Used in sql format to mark column absent in sql dbc
};
class TC_COMMON_API DBCFileLoader
@@ -51,21 +51,21 @@ class TC_COMMON_API DBCFileLoader
float getFloat(size_t field) const
{
ASSERT(field < file.fieldCount);
- float val = *reinterpret_cast<float*>(offset+file.GetOffset(field));
+ float val = *reinterpret_cast<float*>(offset + file.GetOffset(field));
EndianConvert(val);
return val;
}
uint32 getUInt(size_t field) const
{
ASSERT(field < file.fieldCount);
- uint32 val = *reinterpret_cast<uint32*>(offset+file.GetOffset(field));
+ uint32 val = *reinterpret_cast<uint32*>(offset + file.GetOffset(field));
EndianConvert(val);
return val;
}
uint8 getUInt8(size_t field) const
{
ASSERT(field < file.fieldCount);
- return *reinterpret_cast<uint8*>(offset+file.GetOffset(field));
+ return *reinterpret_cast<uint8*>(offset + file.GetOffset(field));
}
const char *getString(size_t field) const
@@ -78,8 +78,8 @@ class TC_COMMON_API DBCFileLoader
private:
Record(DBCFileLoader &file_, unsigned char *offset_): offset(offset_), file(file_) { }
- unsigned char *offset;
- DBCFileLoader &file;
+ unsigned char* offset;
+ DBCFileLoader& file;
friend class DBCFileLoader;