X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/53c1823aaef2eb8d547a8eed8cfe12fe7204ca79..4d5dff7b4570cffaa3520f8d8ef8fd9f30be7524:/stglibs/ia.lib/ia.cpp?ds=sidebyside diff --git a/stglibs/ia.lib/ia.cpp b/stglibs/ia.lib/ia.cpp index abecef09..148750d2 100644 --- a/stglibs/ia.lib/ia.cpp +++ b/stglibs/ia.lib/ia.cpp @@ -29,25 +29,26 @@ //--------------------------------------------------------------------------- +#ifdef WIN32 +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#endif + #include #include #include #include -#ifdef WIN32 - #include - #include - #include - #include -#else - #include - #include - #include - #include -#endif - #include "stg/common.h" -#include "ia.h" +#include "stg/ia.h" #define IA_NONE (0) #define IA_CONNECT (1) @@ -61,8 +62,18 @@ //--------------------------------------------------------------------------- #ifndef WIN32 #include +void Sleep(int ms) +{ +long long res = ms * 1000000; +struct timespec ts = {res / 1000000000, res % 1000000000}; +nanosleep(&ts, NULL); +} +//--------------------------------------------------------------------------- void * RunL(void * data) { +sigset_t signalSet; +sigfillset(&signalSet); +pthread_sigmask(SIG_BLOCK, &signalSet, NULL); IA_CLIENT_PROT * c = (IA_CLIENT_PROT *)data; static int a = 0; @@ -80,13 +91,6 @@ while (c->GetNonstop()) return NULL; } //--------------------------------------------------------------------------- -void Sleep(int ms) -{ -long long res = ms * 1000000; -struct timespec ts = {res / 1000000000, res % 1000000000}; -nanosleep(&ts, NULL); -} -//--------------------------------------------------------------------------- long GetTickCount() { struct timeval tv; @@ -295,14 +299,14 @@ if (!isNetPrepared) int db = sizeof(HDR_8); for (int i = 0; i < IA_LOGIN_LEN/8; i++) { - Blowfish_Encrypt(&ctxHdr, (uint32_t*)(buffer + db + i*8), (uint32_t*)(buffer + db + i*8 + 4)); + EncodeString(buffer + db + i * 8, buffer + db + i * 8, &ctxHdr); } db += IA_LOGIN_LEN; int encLen = (len - sizeof(HDR_8) - IA_LOGIN_LEN)/8; for (int i = 0; i < encLen; i++) { - Blowfish_Encrypt(&ctxPass, (uint32_t*)(buffer + db), (uint32_t*)(buffer + db + 4)); + EncodeString(buffer + db, buffer + db, &ctxPass); db += 8; } @@ -327,7 +331,7 @@ if (res == -1) if (strcmp(buffer + 4 + sizeof(HDR_8), "ERR")) { for (int i = 0; i < len/8; i++) - Blowfish_Decrypt(&ctxPass, (uint32_t*)(buffer + i*8), (uint32_t*)(buffer + i*8 + 4)); + DecodeString(buffer + i * 8, buffer + i * 8, &ctxPass); } return 0;