summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-12-26 15:58:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-12-26 15:58:40 +0300
commitfcbb395dc7ff3edab972b6d4b27dbbfb3305f5d7 (patch)
tree8807aea6f2afce38b30ce60aa5ebf84a26992b73 /plugins/CryptoPP/src
parentaf2958f2e82cb68392983da6f7f69fa3cd0c5276 (diff)
PBYTE -> uint8_t*
Diffstat (limited to 'plugins/CryptoPP/src')
-rw-r--r--plugins/CryptoPP/src/commonheaders.h2
-rw-r--r--plugins/CryptoPP/src/cpp_cntx.cpp8
-rw-r--r--plugins/CryptoPP/src/cpp_gpgw.cpp4
-rw-r--r--plugins/CryptoPP/src/cpp_gzip.cpp10
-rw-r--r--plugins/CryptoPP/src/cpp_keys.cpp14
-rw-r--r--plugins/CryptoPP/src/cpp_misc.cpp4
-rw-r--r--plugins/CryptoPP/src/cpp_pgpw.cpp8
-rw-r--r--plugins/CryptoPP/src/cpp_rsam.cpp52
-rw-r--r--plugins/CryptoPP/src/cpp_rsam.h12
-rw-r--r--plugins/CryptoPP/src/cpp_rsau.cpp18
-rw-r--r--plugins/CryptoPP/src/cpp_rsau.h6
-rw-r--r--plugins/CryptoPP/src/cpp_svcs.cpp8
-rw-r--r--plugins/CryptoPP/src/cryptopp.h48
-rw-r--r--plugins/CryptoPP/src/main.cpp2
14 files changed, 98 insertions, 98 deletions
diff --git a/plugins/CryptoPP/src/commonheaders.h b/plugins/CryptoPP/src/commonheaders.h
index 575fa7a96a..9fb22609c5 100644
--- a/plugins/CryptoPP/src/commonheaders.h
+++ b/plugins/CryptoPP/src/commonheaders.h
@@ -86,7 +86,7 @@ int Sent_NetLog(const char *, ...);
#define DLLEXPORT __declspec(dllexport)
-PBYTE cpp_alloc_pdata(pCNTX);
+uint8_t* cpp_alloc_pdata(pCNTX);
extern "C"
{
diff --git a/plugins/CryptoPP/src/cpp_cntx.cpp b/plugins/CryptoPP/src/cpp_cntx.cpp
index 9fcb9e8542..feab8a48e9 100644
--- a/plugins/CryptoPP/src/cpp_cntx.cpp
+++ b/plugins/CryptoPP/src/cpp_cntx.cpp
@@ -45,22 +45,22 @@ void __cdecl cpp_reset_context(HANDLE context)
}
// allocate pdata
-PBYTE cpp_alloc_pdata(pCNTX ptr)
+uint8_t* cpp_alloc_pdata(pCNTX ptr)
{
if (!ptr->pdata) {
if (ptr->mode & MODE_PGP) {
- ptr->pdata = (PBYTE)malloc(sizeof(PGPDATA));
+ ptr->pdata = (uint8_t*)malloc(sizeof(PGPDATA));
memset(ptr->pdata, 0, sizeof(PGPDATA));
}
else if (ptr->mode & MODE_GPG) {
- ptr->pdata = (PBYTE)malloc(sizeof(GPGDATA));
+ ptr->pdata = (uint8_t*)malloc(sizeof(GPGDATA));
memset(ptr->pdata, 0, sizeof(GPGDATA));
}
else if (ptr->mode & MODE_RSA) {
rsa_alloc(ptr);
}
else {
- ptr->pdata = (PBYTE)malloc(sizeof(SIMDATA));
+ ptr->pdata = (uint8_t*)malloc(sizeof(SIMDATA));
memset(ptr->pdata, 0, sizeof(SIMDATA));
}
}
diff --git a/plugins/CryptoPP/src/cpp_gpgw.cpp b/plugins/CryptoPP/src/cpp_gpgw.cpp
index 6141ee8796..224ddf82d4 100644
--- a/plugins/CryptoPP/src/cpp_gpgw.cpp
+++ b/plugins/CryptoPP/src/cpp_gpgw.cpp
@@ -3,7 +3,7 @@
HMODULE hgpg;
HRSRC hRS_gpg;
-PBYTE pRS_gpg;
+uint8_t *pRS_gpg;
int __cdecl _gpg_init(void);
int __cdecl _gpg_done(void);
@@ -163,7 +163,7 @@ int __cdecl gpg_set_keyid(HANDLE context, LPCSTR RemoteKeyID)
ptr->error = ERROR_NONE;
SAFE_FREE(p->gpgKeyID);
- p->gpgKeyID = (PBYTE)_strdup(RemoteKeyID);
+ p->gpgKeyID = (uint8_t*)_strdup(RemoteKeyID);
return 1;
}
diff --git a/plugins/CryptoPP/src/cpp_gzip.cpp b/plugins/CryptoPP/src/cpp_gzip.cpp
index 41183d3eb5..1750a255a4 100644
--- a/plugins/CryptoPP/src/cpp_gzip.cpp
+++ b/plugins/CryptoPP/src/cpp_gzip.cpp
@@ -9,7 +9,7 @@ BYTE *cpp_gzip(BYTE *pData, size_t nLen, size_t& nCompressedLen)
gzip.MessageEnd();
nCompressedLen = (int)zipped.length();
- PBYTE pCompressed = (PBYTE)malloc(nCompressedLen + 1);
+ uint8_t *pCompressed = (uint8_t*)malloc(nCompressedLen + 1);
memcpy(pCompressed, zipped.data(), nCompressedLen);
return pCompressed;
@@ -20,11 +20,11 @@ BYTE *cpp_gunzip(BYTE *pCompressedData, size_t nCompressedLen, size_t& nLen)
{
string unzipped;
Gunzip gunzip(new StringSink(unzipped));
- gunzip.Put((PBYTE)pCompressedData, nCompressedLen);
+ gunzip.Put((uint8_t*)pCompressedData, nCompressedLen);
gunzip.MessageEnd();
nLen = (int)unzipped.length();
- PBYTE pData = (PBYTE)malloc(nLen + 1);
+ uint8_t *pData = (uint8_t*)malloc(nLen + 1);
memcpy(pData, unzipped.data(), nLen);
return pData;
@@ -35,7 +35,7 @@ string cpp_zlibc(string& pData)
{
string zipped;
ZlibCompressor zlib(new StringSink(zipped), 5); // 1 is fast, 9 is slow
- zlib.Put((PBYTE)pData.data(), pData.length());
+ zlib.Put((uint8_t*)pData.data(), pData.length());
zlib.MessageEnd();
return zipped;
@@ -46,7 +46,7 @@ string cpp_zlibd(string& pData)
{
string unzipped;
ZlibDecompressor zlib(new StringSink(unzipped));
- zlib.Put((PBYTE)pData.data(), pData.length());
+ zlib.Put((uint8_t*)pData.data(), pData.length());
zlib.MessageEnd();
return unzipped;
diff --git a/plugins/CryptoPP/src/cpp_keys.cpp b/plugins/CryptoPP/src/cpp_keys.cpp
index ffcf0645a0..38c82bf6b8 100644
--- a/plugins/CryptoPP/src/cpp_keys.cpp
+++ b/plugins/CryptoPP/src/cpp_keys.cpp
@@ -34,11 +34,11 @@ LPSTR __cdecl cpp_init_keya(HANDLE context, int features)
p->dh->GenerateKeyPair(autorng, priv1, publ1);
SAFE_FREE(p->PubA);
- p->PubA = (PBYTE)malloc(KEYSIZE);
+ p->PubA = (uint8_t*)malloc(KEYSIZE);
memcpy(p->PubA, publ1, KEYSIZE);
SAFE_FREE(p->KeyA);
- p->KeyA = (PBYTE)malloc(KEYSIZE);
+ p->KeyA = (uint8_t*)malloc(KEYSIZE);
memcpy(p->KeyA, priv1, KEYSIZE);
if (p->KeyP) {
@@ -110,7 +110,7 @@ int __cdecl cpp_init_keyb(HANDLE context, LPCSTR key)
CFB_Mode<AES>::Decryption dec(p->KeyP, Tiger::DIGESTSIZE, IV);
StreamTransformationFilter cbcDecryptor(dec, new StringSink(unciphered));
- cbcDecryptor.Put((PBYTE)pub_binary, KEYSIZE);
+ cbcDecryptor.Put((uint8_t*)pub_binary, KEYSIZE);
cbcDecryptor.MessageEnd();
memcpy(pub_binary, unciphered.data(), unciphered.length());
}
@@ -123,7 +123,7 @@ int __cdecl cpp_init_keyb(HANDLE context, LPCSTR key)
}
mir_free(p->KeyB);
- p->KeyB = (PBYTE)pub_binary;
+ p->KeyB = (uint8_t*)pub_binary;
if (p->PubA && memcmp(p->PubA, p->KeyB, KEYSIZE) == 0) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -167,7 +167,7 @@ int __cdecl cpp_calc_keyx(HANDLE context)
// store key
SAFE_FREE(p->KeyX);
- p->KeyX = (PBYTE)malloc(Tiger::DIGESTSIZE);
+ p->KeyX = (uint8_t*)malloc(Tiger::DIGESTSIZE);
memcpy(p->KeyX, buffer, Tiger::DIGESTSIZE);
}
return (int)agr;
@@ -183,11 +183,11 @@ int __cdecl cpp_init_keyp(HANDLE context, LPCSTR password)
memset(buffer, 0, sizeof(buffer));
// calculate hash
- Tiger().CalculateDigest(buffer, (PBYTE)password, strlen(password));
+ Tiger().CalculateDigest(buffer, (uint8_t*)password, strlen(password));
// store pre-shared key
SAFE_FREE(p->KeyP);
- p->KeyP = (PBYTE)malloc(Tiger::DIGESTSIZE);
+ p->KeyP = (uint8_t*)malloc(Tiger::DIGESTSIZE);
memcpy(p->KeyP, buffer, Tiger::DIGESTSIZE);
return 1;
diff --git a/plugins/CryptoPP/src/cpp_misc.cpp b/plugins/CryptoPP/src/cpp_misc.cpp
index bdd3f2a645..0b05a59356 100644
--- a/plugins/CryptoPP/src/cpp_misc.cpp
+++ b/plugins/CryptoPP/src/cpp_misc.cpp
@@ -56,7 +56,7 @@ void __cdecl cpp_set_keyx(HANDLE context, BYTE *key)
SAFE_FREE(p->KeyA);
mir_free(p->KeyB); p->KeyB = nullptr;
SAFE_FREE(p->KeyX);
- p->KeyX = (PBYTE)malloc(Tiger::DIGESTSIZE + 2);
+ p->KeyX = (uint8_t*)malloc(Tiger::DIGESTSIZE + 2);
memcpy(p->KeyX, key, Tiger::DIGESTSIZE);
memcpy(&ptr->features, key + Tiger::DIGESTSIZE, 2);
}
@@ -82,7 +82,7 @@ void __cdecl cpp_set_keyp(HANDLE context, BYTE *key)
if (!cpp_get_simdata(context, &ptr, &p))
return;
SAFE_FREE(p->KeyP);
- p->KeyP = (PBYTE)malloc(Tiger::DIGESTSIZE);
+ p->KeyP = (uint8_t*)malloc(Tiger::DIGESTSIZE);
memcpy(p->KeyP, key, Tiger::DIGESTSIZE);
}
diff --git a/plugins/CryptoPP/src/cpp_pgpw.cpp b/plugins/CryptoPP/src/cpp_pgpw.cpp
index 4c148cffec..9e2316a0e4 100644
--- a/plugins/CryptoPP/src/cpp_pgpw.cpp
+++ b/plugins/CryptoPP/src/cpp_pgpw.cpp
@@ -4,7 +4,7 @@
HMODULE hpgpsdk;
UINT pgpVer;
HRSRC hRS_pgp;
-PBYTE pRS_pgp;
+uint8_t *pRS_pgp;
int __cdecl _pgp_init(void);
int __cdecl _pgp_done(void);
@@ -93,7 +93,7 @@ int __cdecl pgp_init()
// create context for private pgp keys
hPGPPRIV = (HANDLE)cpp_create_context(MODE_PGP | MODE_PRIV_KEY);
pCNTX tmp = (pCNTX)hPGPPRIV;
- tmp->pdata = (PBYTE)malloc(sizeof(PGPDATA));
+ tmp->pdata = (uint8_t*)malloc(sizeof(PGPDATA));
memset(tmp->pdata, 0, sizeof(PGPDATA));
}
@@ -221,7 +221,7 @@ int __cdecl pgp_set_key(HANDLE context, LPCSTR RemoteKey)
ptr->error = ERROR_NONE;
SAFE_FREE(p->pgpKey);
- p->pgpKey = (PBYTE)_strdup(RemoteKey);
+ p->pgpKey = (uint8_t*)_strdup(RemoteKey);
return 1;
}
@@ -235,7 +235,7 @@ int __cdecl pgp_set_keyid(HANDLE context, PVOID RemoteKeyID)
ptr->error = ERROR_NONE;
SAFE_FREE(p->pgpKeyID);
- p->pgpKeyID = (PBYTE)malloc(p_pgp_size_keyid());
+ p->pgpKeyID = (uint8_t*)malloc(p_pgp_size_keyid());
memcpy(p->pgpKeyID, RemoteKeyID, p_pgp_size_keyid());
return 1;
diff --git a/plugins/CryptoPP/src/cpp_rsam.cpp b/plugins/CryptoPP/src/cpp_rsam.cpp
index 1ff82b508d..8ef706ff98 100644
--- a/plugins/CryptoPP/src/cpp_rsam.cpp
+++ b/plugins/CryptoPP/src/cpp_rsam.cpp
@@ -58,7 +58,7 @@ int __cdecl rsa_init(pRSA_EXPORT* e, pRSA_IMPORT i)
hRSA4096 = (HANDLE)cpp_create_context(MODE_RSA_4096 | MODE_PRIV_KEY);
pCNTX tmp = (pCNTX)hRSA4096;
pRSAPRIV p = new RSAPRIV;
- tmp->pdata = (PBYTE)p;
+ tmp->pdata = (uint8_t*)p;
}
return 1;
}
@@ -131,7 +131,7 @@ int __cdecl rsa_gen_keypair(short mode)
return 1;
}
-int __cdecl rsa_get_keypair(short mode, PBYTE privKey, int* privKeyLen, PBYTE pubKey, int* pubKeyLen)
+int __cdecl rsa_get_keypair(short mode, uint8_t *privKey, int *privKeyLen, uint8_t *pubKey, int *pubKeyLen)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_get_keypair: %d", mode);
@@ -144,7 +144,7 @@ int __cdecl rsa_get_keypair(short mode, PBYTE privKey, int* privKeyLen, PBYTE pu
return 1;
}
-int __cdecl rsa_get_keyhash(short mode, PBYTE privKey, int* privKeyLen, PBYTE pubKey, int* pubKeyLen)
+int __cdecl rsa_get_keyhash(short mode, uint8_t *privKey, int *privKeyLen, uint8_t *pubKey, int *pubKeyLen)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_get_keyhash: %d", mode);
@@ -158,7 +158,7 @@ int __cdecl rsa_get_keyhash(short mode, PBYTE privKey, int* privKeyLen, PBYTE pu
return 1;
}
-int __cdecl rsa_set_keypair(short mode, PBYTE privKey, int privKeyLen)
+int __cdecl rsa_set_keypair(short mode, uint8_t *privKey, int privKeyLen)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_set_keypair: %s", privKey);
@@ -193,7 +193,7 @@ int __cdecl rsa_set_keypair(short mode, PBYTE privKey, int privKeyLen)
return 1;
}
-int __cdecl rsa_get_pubkey(HANDLE context, PBYTE pubKey, int* pubKeyLen)
+int __cdecl rsa_get_pubkey(HANDLE context, uint8_t *pubKey, int *pubKeyLen)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_get_pubkey: %s", pubKey);
@@ -206,7 +206,7 @@ int __cdecl rsa_get_pubkey(HANDLE context, PBYTE pubKey, int* pubKeyLen)
return 1;
}
-int __cdecl rsa_set_pubkey(HANDLE context, PBYTE pubKey, int pubKeyLen)
+int __cdecl rsa_set_pubkey(HANDLE context, uint8_t *pubKey, int pubKeyLen)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_set_pubkey: %s", pubKey);
@@ -238,7 +238,7 @@ int __cdecl rsa_get_state(HANDLE context)
return p->state;
}
-int __cdecl rsa_get_hash(PBYTE pubKey, int pubKeyLen, PBYTE pubHash, int* pubHashLen)
+int __cdecl rsa_get_hash(uint8_t *pubKey, int pubKeyLen, uint8_t *pubHash, int *pubHashLen)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_get_hash: %d", pubKeyLen);
@@ -286,7 +286,7 @@ int __cdecl rsa_disconnect(HANDLE context)
pRSADATA p = (pRSADATA)cpp_alloc_pdata(ptr);
if (!p->state) return 1;
- PBYTE buffer = (PBYTE)alloca(RAND_SIZE);
+ uint8_t *buffer = (uint8_t*)alloca(RAND_SIZE);
GlobalRNG().GenerateBlock(buffer, RAND_SIZE);
inject_msg(context, 0xF0, encode_msg(0, p, ::hash(buffer, RAND_SIZE)));
@@ -386,7 +386,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg)
return nullptr;
}
{
- PBYTE buffer = (PBYTE)alloca(RAND_SIZE);
+ uint8_t *buffer = (uint8_t*)alloca(RAND_SIZE);
GlobalRNG().GenerateBlock(buffer, RAND_SIZE);
inject_msg(context, 0x60, encode_msg(0, p, ::hash(buffer, RAND_SIZE)));
}
@@ -491,9 +491,9 @@ string encode_msg(short z, pRSADATA p, string& msg)
string ciphered;
try {
- CBC_Mode<AES>::Encryption enc((PBYTE)p->aes_k.data(), p->aes_k.length(), (PBYTE)p->aes_v.data());
+ CBC_Mode<AES>::Encryption enc((uint8_t*)p->aes_k.data(), p->aes_k.length(), (uint8_t*)p->aes_v.data());
StreamTransformationFilter cbcEncryptor(enc, new StringSink(ciphered));
- cbcEncryptor.Put((PBYTE)zlib.data(), zlib.length());
+ cbcEncryptor.Put((uint8_t*)zlib.data(), zlib.length());
cbcEncryptor.MessageEnd();
}
catch (...) {
@@ -513,9 +513,9 @@ string decode_msg(pRSADATA p, string& msg)
string unciphered, zlib;
try {
- CBC_Mode<AES>::Decryption dec((PBYTE)p->aes_k.data(), p->aes_k.length(), (PBYTE)p->aes_v.data());
+ CBC_Mode<AES>::Decryption dec((uint8_t*)p->aes_k.data(), p->aes_k.length(), (uint8_t*)p->aes_v.data());
StreamTransformationFilter cbcDecryptor(dec, new StringSink(zlib));
- cbcDecryptor.Put((PBYTE)ciphered.data(), ciphered.length());
+ cbcDecryptor.Put((uint8_t*)ciphered.data(), ciphered.length());
cbcDecryptor.MessageEnd();
if (sig == ::hash(zlib))
@@ -563,7 +563,7 @@ string gen_aes_key_iv(short m, pRSADATA p, pRSAPRIV r)
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("gen_aes_key_iv: %04x", m);
#endif
- PBYTE buffer = (PBYTE)alloca(RAND_SIZE);
+ uint8_t *buffer = (uint8_t*)alloca(RAND_SIZE);
GlobalRNG().GenerateBlock(buffer, RAND_SIZE);
p->aes_k = hash256(buffer, RAND_SIZE);
@@ -655,7 +655,7 @@ int __cdecl rsa_encrypt_file(HANDLE context, LPCSTR file_in, LPCSTR file_out)
pRSADATA p = (pRSADATA)cpp_alloc_pdata(ptr); if (p->state != 7) return 0;
try {
- CBC_Mode<AES>::Encryption enc((PBYTE)p->aes_k.data(), p->aes_k.length(), (PBYTE)p->aes_v.data());
+ CBC_Mode<AES>::Encryption enc((uint8_t*)p->aes_k.data(), p->aes_k.length(), (uint8_t*)p->aes_v.data());
FileSource *f = new FileSource(file_in, true, new StreamTransformationFilter(enc, new FileSink(file_out)));
delete f;
}
@@ -672,7 +672,7 @@ int __cdecl rsa_decrypt_file(HANDLE context, LPCSTR file_in, LPCSTR file_out)
pRSADATA p = (pRSADATA)cpp_alloc_pdata(ptr); if (p->state != 7) return 0;
try {
- CBC_Mode<AES>::Decryption dec((PBYTE)p->aes_k.data(), p->aes_k.length(), (PBYTE)p->aes_v.data());
+ CBC_Mode<AES>::Decryption dec((uint8_t*)p->aes_k.data(), p->aes_k.length(), (uint8_t*)p->aes_v.data());
FileSource *f = new FileSource(file_in, true, new StreamTransformationFilter(dec, new FileSink(file_out)));
delete f;
}
@@ -732,7 +732,7 @@ int __cdecl rsa_recv_thread(HANDLE context, string& msg)
string pub;
un_tlv(un_tlv(data, t[0], features), t[1], pub);
string sig = ::hash(pub);
- if (!imp->rsa_check_pub(context, (PBYTE)pub.data(), (int)pub.length(), (PBYTE)sig.data(), (int)sig.length())) {
+ if (!imp->rsa_check_pub(context, (uint8_t*)pub.data(), (int)pub.length(), (uint8_t*)sig.data(), (int)sig.length())) {
p->state = 0; p->time = 0;
null_msg(context, 0x00, -type); // сессия разорвана по ошибке
return 0;
@@ -758,7 +758,7 @@ int __cdecl rsa_recv_thread(HANDLE context, string& msg)
string pub;
un_tlv(un_tlv(data, t[0], features), t[1], pub);
string sig = ::hash(pub);
- if (!imp->rsa_check_pub(context, (PBYTE)pub.data(), (int)pub.length(), (PBYTE)sig.data(), (int)sig.length())) {
+ if (!imp->rsa_check_pub(context, (uint8_t*)pub.data(), (int)pub.length(), (uint8_t*)sig.data(), (int)sig.length())) {
p->state = 0; p->time = 0;
null_msg(context, 0x00, -type); // сессия разорвана по ошибке
return 0;
@@ -779,7 +779,7 @@ int __cdecl rsa_recv_thread(HANDLE context, string& msg)
string pub;
un_tlv(data, t[0], pub);
string sig = ::hash(pub);
- if (!imp->rsa_check_pub(context, (PBYTE)pub.data(), (int)pub.length(), (PBYTE)sig.data(), (int)sig.length())) {
+ if (!imp->rsa_check_pub(context, (uint8_t*)pub.data(), (int)pub.length(), (uint8_t*)sig.data(), (int)sig.length())) {
p->state = 0; p->time = 0;
null_msg(context, 0x00, -type); // сессия разорвана по ошибке
return 0;
@@ -806,7 +806,7 @@ int __cdecl rsa_recv_thread(HANDLE context, string& msg)
}
un_tlv(key, t[0], p->aes_k);
un_tlv(key, t[1], p->aes_v);
- PBYTE buffer = (PBYTE)alloca(RAND_SIZE);
+ uint8_t *buffer = (uint8_t*)alloca(RAND_SIZE);
GlobalRNG().GenerateBlock(buffer, RAND_SIZE);
inject_msg(context, 0x50, encode_msg(0, p, ::hash(buffer, RAND_SIZE)));
p->state = 6;
@@ -820,7 +820,7 @@ int __cdecl rsa_recv_thread(HANDLE context, string& msg)
un_tlv(un_tlv(un_tlv(data, t[0], features), t[1], pub), t[2], sha);
if (p->pub_k != pub) { // пришел новый паблик
string sig = ::hash(pub);
- if (!imp->rsa_check_pub(context, (PBYTE)pub.data(), (int)pub.length(), (PBYTE)sig.data(), (int)sig.length())) {
+ if (!imp->rsa_check_pub(context, (uint8_t*)pub.data(), (int)pub.length(), (uint8_t*)sig.data(), (int)sig.length())) {
p->state = 0; p->time = 0;
null_msg(context, 0x00, -type); // сессия разорвана по ошибке
return 0;
@@ -849,7 +849,7 @@ void rsa_alloc(pCNTX ptr)
p->thread = p->event = nullptr;
p->thread_exit = 0;
p->queue = new STRINGQUEUE;
- ptr->pdata = (PBYTE)p;
+ ptr->pdata = (uint8_t*)p;
}
int rsa_free(pCNTX ptr)
@@ -957,9 +957,9 @@ int __cdecl rsa_export_keypair(short mode, LPSTR privKey, LPSTR pubKey, LPSTR pa
string ciphered;
try {
- CBC_Mode<AES>::Encryption enc((PBYTE)key.data(), key.length(), (PBYTE)iv.data());
+ CBC_Mode<AES>::Encryption enc((uint8_t*)key.data(), key.length(), (uint8_t*)iv.data());
StreamTransformationFilter cbcEncryptor(enc, new StringSink(ciphered));
- cbcEncryptor.Put((PBYTE)priv.data(), priv.length());
+ cbcEncryptor.Put((uint8_t*)priv.data(), priv.length());
cbcEncryptor.MessageEnd();
}
catch (...) {
@@ -1008,9 +1008,9 @@ int __cdecl rsa_import_keypair(short mode, LPSTR privKey, LPSTR passPhrase)
string unciphered;
try {
- CBC_Mode<AES>::Decryption dec((PBYTE)key.data(), key.length(), (PBYTE)iv.data());
+ CBC_Mode<AES>::Decryption dec((uint8_t*)key.data(), key.length(), (uint8_t*)iv.data());
StreamTransformationFilter cbcDecryptor(dec, new StringSink(unciphered));
- cbcDecryptor.Put((PBYTE)priv.data(), priv.length());
+ cbcDecryptor.Put((uint8_t*)priv.data(), priv.length());
cbcDecryptor.MessageEnd();
}
catch (...) {
diff --git a/plugins/CryptoPP/src/cpp_rsam.h b/plugins/CryptoPP/src/cpp_rsam.h
index 7ffdbe1579..9bceaa8ed6 100644
--- a/plugins/CryptoPP/src/cpp_rsam.h
+++ b/plugins/CryptoPP/src/cpp_rsam.h
@@ -2,14 +2,14 @@
#define __CPP_RSAM_H__
int __cdecl rsa_gen_keypair(short);
-int __cdecl rsa_get_keypair(short,PBYTE,int*,PBYTE,int*);
-int __cdecl rsa_get_keyhash(short,PBYTE,int*,PBYTE,int*);
-int __cdecl rsa_set_keypair(short,PBYTE,int);
-int __cdecl rsa_get_pubkey(HANDLE,PBYTE,int*);
-int __cdecl rsa_set_pubkey(HANDLE,PBYTE,int);
+int __cdecl rsa_get_keypair(short, uint8_t*,int*, uint8_t*,int*);
+int __cdecl rsa_get_keyhash(short,uint8_t*,int*,uint8_t*,int*);
+int __cdecl rsa_set_keypair(short,uint8_t*,int);
+int __cdecl rsa_get_pubkey(HANDLE,uint8_t*,int*);
+int __cdecl rsa_set_pubkey(HANDLE,uint8_t*,int);
void __cdecl rsa_set_timeout(int);
int __cdecl rsa_get_state(HANDLE);
-int __cdecl rsa_get_hash(PBYTE,int,PBYTE,int*);
+int __cdecl rsa_get_hash(uint8_t*,int,uint8_t*,int*);
int __cdecl rsa_connect(HANDLE);
int __cdecl rsa_disconnect(HANDLE);
int __cdecl rsa_disabled(HANDLE);
diff --git a/plugins/CryptoPP/src/cpp_rsau.cpp b/plugins/CryptoPP/src/cpp_rsau.cpp
index 1adf07afd5..bf2266e84a 100644
--- a/plugins/CryptoPP/src/cpp_rsau.cpp
+++ b/plugins/CryptoPP/src/cpp_rsau.cpp
@@ -108,10 +108,10 @@ int str2int(string& s)
string hash(string& b)
{
- return ::hash((PBYTE)b.data(), b.length());
+ return ::hash((uint8_t*)b.data(), b.length());
}
-string hash(PBYTE b, size_t l)
+string hash(uint8_t *b, size_t l)
{
BYTE h[RSA_KEYSIZE];
RSA_CalculateDigest(h, b, l);
@@ -121,15 +121,15 @@ string hash(PBYTE b, size_t l)
string hash128(string& b)
{
- return hash128((PBYTE)b.data(), b.length());
+ return hash128((uint8_t*)b.data(), b.length());
}
string hash128(LPSTR b)
{
- return hash128((PBYTE)b, strlen(b));
+ return hash128((uint8_t*)b, strlen(b));
}
-string hash128(PBYTE b, size_t l)
+string hash128(uint8_t *b, size_t l)
{
BYTE h[RIPEMD128::DIGESTSIZE];
RIPEMD128().CalculateDigest(h, b, l);
@@ -139,15 +139,15 @@ string hash128(PBYTE b, size_t l)
string hash256(string& b)
{
- return hash256((PBYTE)b.data(), b.length());
+ return hash256((uint8_t*)b.data(), b.length());
}
string hash256(LPSTR b)
{
- return hash256((PBYTE)b, strlen(b));
+ return hash256((uint8_t*)b, strlen(b));
}
-string hash256(PBYTE b, size_t l)
+string hash256(uint8_t *b, size_t l)
{
BYTE h[RIPEMD256::DIGESTSIZE];
RIPEMD256().CalculateDigest(h, b, l);
@@ -232,5 +232,5 @@ BOOL RSAVerifyString(const RSA::PublicKey& pubkey, const string& plaintext, cons
{
RSASSA_PKCS1v15_SHA_Verifier ver(pubkey);
- return ver.VerifyMessage((PBYTE)plaintext.data(), plaintext.length(), (PBYTE)sig.data(), sig.length());
+ return ver.VerifyMessage((uint8_t*)plaintext.data(), plaintext.length(), (uint8_t*)sig.data(), sig.length());
}
diff --git a/plugins/CryptoPP/src/cpp_rsau.h b/plugins/CryptoPP/src/cpp_rsau.h
index 38ba656f9d..c8b976f1ed 100644
--- a/plugins/CryptoPP/src/cpp_rsau.h
+++ b/plugins/CryptoPP/src/cpp_rsau.h
@@ -77,15 +77,15 @@ string& un_tlv(string&,int&,int&);
int str2int(string&);
string hash(string&);
-string hash(PBYTE, size_t);
+string hash(uint8_t*, size_t);
string hash128(string&);
string hash128(LPSTR);
-string hash128(PBYTE, size_t);
+string hash128(uint8_t*, size_t);
string hash256(string&);
string hash256(LPSTR);
-string hash256(PBYTE, size_t);
+string hash256(uint8_t*, size_t);
Integer BinaryToInteger(const string&);
string IntegerToBinary(const Integer&);
diff --git a/plugins/CryptoPP/src/cpp_svcs.cpp b/plugins/CryptoPP/src/cpp_svcs.cpp
index c7a47f058b..23c05cb5e1 100644
--- a/plugins/CryptoPP/src/cpp_svcs.cpp
+++ b/plugins/CryptoPP/src/cpp_svcs.cpp
@@ -31,7 +31,7 @@ LPSTR __cdecl cpp_encrypt(pCNTX ptr, LPCSTR szPlainMsg)
CBC_Mode<AES>::Encryption enc(p->KeyX, Tiger::DIGESTSIZE, IV);
StreamTransformationFilter cbcEncryptor(enc, new StringSink(ciphered));
- cbcEncryptor.Put((PBYTE)szMsg, slen);
+ cbcEncryptor.Put((uint8_t*)szMsg, slen);
cbcEncryptor.MessageEnd();
free(szMsg);
@@ -99,7 +99,7 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg)
BYTE crc32[CRC32::DIGESTSIZE];
memset(crc32, 0, sizeof(crc32));
- CRC32().CalculateDigest(crc32, (PBYTE)(bciphered + CRC32::DIGESTSIZE), len);
+ CRC32().CalculateDigest(crc32, (uint8_t*)(bciphered + CRC32::DIGESTSIZE), len);
if (memcmp(crc32, bciphered, CRC32::DIGESTSIZE)) { // message is bad crc
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -117,14 +117,14 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg)
CBC_Mode<AES>::Decryption dec(p->KeyX, Tiger::DIGESTSIZE, IV);
StreamTransformationFilter cbcDecryptor(dec, new StringSink(unciphered));
- cbcDecryptor.Put((PBYTE)bciphered, clen);
+ cbcDecryptor.Put((uint8_t*)bciphered, clen);
cbcDecryptor.MessageEnd();
mir_free(ptr->tmp);
if (dataflag & DATA_GZIP) {
size_t clen2 = clen;
- LPSTR res = (LPSTR)cpp_gunzip((PBYTE)unciphered.data(), unciphered.length(), clen2);
+ LPSTR res = (LPSTR)cpp_gunzip((uint8_t*)unciphered.data(), unciphered.length(), clen2);
ptr->tmp = mir_strndup(res, clen2);
free(res);
}
diff --git a/plugins/CryptoPP/src/cryptopp.h b/plugins/CryptoPP/src/cryptopp.h
index a98b6204f5..5b8d304c40 100644
--- a/plugins/CryptoPP/src/cryptopp.h
+++ b/plugins/CryptoPP/src/cryptopp.h
@@ -32,15 +32,15 @@ USING_NAMESPACE(std)
#define EMPTYH 0xF1E2D3C4
typedef struct __CNTX {
- u_int header; // HEADER
- short mode; // mode of encoding
- short features; // features of client
- short error; // error code of last operation
- PBYTE pdata; // data block
- PVOID udata; // user data
- LPSTR tmp; // return string
- u_int deleted; // delete time&flag to delete
- u_int footer; // FOOTER
+ u_int header; // HEADER
+ short mode; // mode of encoding
+ short features; // features of client
+ short error; // error code of last operation
+ uint8_t* pdata; // data block
+ PVOID udata; // user data
+ LPSTR tmp; // return string
+ u_int deleted; // delete time&flag to delete
+ u_int footer; // FOOTER
} CNTX;
typedef CNTX* pCNTX;
@@ -69,19 +69,19 @@ typedef CNTX* pCNTX;
#define DATA_GZIP 1
typedef struct __SIMDATA {
- DH *dh; // diffie-hellman
- PBYTE PubA; // public keyA 2048 bit
- PBYTE KeyA; // private keyA 2048 bit
- PBYTE KeyB; // public keyB 2048 bit
- PBYTE KeyX; // secret keyX 192 bit
- PBYTE KeyP; // pre-shared keyP 192 bit
+ DH *dh; // diffie-hellman
+ uint8_t* PubA; // public keyA 2048 bit
+ uint8_t* KeyA; // private keyA 2048 bit
+ uint8_t* KeyB; // public keyB 2048 bit
+ uint8_t* KeyX; // secret keyX 192 bit
+ uint8_t* KeyP; // pre-shared keyP 192 bit
} SIMDATA;
typedef SIMDATA* pSIMDATA;
typedef struct __PGPDATA {
- PBYTE pgpKeyID; // PGP KeyID
- PBYTE pgpKey; // PGP Key
+ uint8_t* pgpKeyID; // PGP KeyID
+ uint8_t* pgpKey; // PGP Key
} PGPDATA;
typedef PGPDATA* pPGPDATA;
@@ -162,14 +162,14 @@ string cpp_zlibd(string&);
typedef struct {
int(__cdecl *rsa_gen_keypair)(short); // генерит RSA-ключи для указанной длины (либо тока 2048, либо 2048 и 4096)
- int(__cdecl *rsa_get_keypair)(short, PBYTE, int*, PBYTE, int*); // возвращает пару ключей для указанной длины
- int(__cdecl *rsa_get_keyhash)(short, PBYTE, int*, PBYTE, int*); // возвращает hash пары ключей для указанной длины
- int(__cdecl *rsa_set_keypair)(short, PBYTE, int); // устанавливает ключи, указанной длины
- int(__cdecl *rsa_get_pubkey)(HANDLE, PBYTE, int*); // возвращает паблик ключ из указанного контекста
- int(__cdecl *rsa_set_pubkey)(HANDLE, PBYTE, int); // загружает паблик ключ для указанного контекста
+ int(__cdecl *rsa_get_keypair)(short, uint8_t*, int*, uint8_t*, int*); // возвращает пару ключей для указанной длины
+ int(__cdecl *rsa_get_keyhash)(short, uint8_t*, int*, uint8_t*, int*); // возвращает hash пары ключей для указанной длины
+ int(__cdecl *rsa_set_keypair)(short, uint8_t*, int); // устанавливает ключи, указанной длины
+ int(__cdecl *rsa_get_pubkey)(HANDLE, uint8_t*, int*); // возвращает паблик ключ из указанного контекста
+ int(__cdecl *rsa_set_pubkey)(HANDLE, uint8_t*, int); // загружает паблик ключ для указанного контекста
void(__cdecl *rsa_set_timeout)(int); // установить таймаут для установки секюрного соединения
int(__cdecl *rsa_get_state)(HANDLE); // получить статус указанного контекста
- int(__cdecl *rsa_get_hash)(PBYTE, int, PBYTE, int*); // вычисляет SHA1(key)
+ int(__cdecl *rsa_get_hash)(uint8_t*, int, uint8_t*, int*); // вычисляет SHA1(key)
int(__cdecl *rsa_connect)(HANDLE); // запускает процесс установки содинения с указанным контекстом
int(__cdecl *rsa_disconnect)(HANDLE); // разрывает соединение с указанным контекстом
int(__cdecl *rsa_disabled)(HANDLE); // разрывает соединение по причине "disabled"
@@ -190,7 +190,7 @@ typedef RSA_EXPORT* pRSA_EXPORT;
typedef struct {
int(__cdecl *rsa_inject)(HANDLE, LPCSTR); // вставляет сообщение в очередь на отправку
- int(__cdecl *rsa_check_pub)(HANDLE, PBYTE, int, PBYTE, int); // проверяет интерактивно SHA и сохраняет ключ, если все нормально
+ int(__cdecl *rsa_check_pub)(HANDLE, uint8_t*, int, uint8_t*, int); // проверяет интерактивно SHA и сохраняет ключ, если все нормально
void(__cdecl *rsa_notify)(HANDLE, int); // нотификация о смене состояния
} RSA_IMPORT;
typedef RSA_IMPORT* pRSA_IMPORT;
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp
index 0b305a9949..bdc059828a 100644
--- a/plugins/CryptoPP/src/main.cpp
+++ b/plugins/CryptoPP/src/main.cpp
@@ -61,7 +61,7 @@ BOOL ExtractFileFromResource(HANDLE FH, int ResType, int ResId, DWORD* Size)
if (RH == nullptr)
return FALSE;
- PBYTE RP = (PBYTE)LoadResource(g_plugin.getInst(), RH);
+ uint8_t *RP = (uint8_t*)LoadResource(g_plugin.getInst(), RH);
if (RP == nullptr)
return FALSE;