diff options
author | George Hazan <ghazan@miranda.im> | 2021-12-26 16:39:04 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-12-26 16:39:04 +0300 |
commit | 62a186697df33c96dc1a6dac0f4dfc38652fb96f (patch) | |
tree | 1437d0906218fae8827aed384026f2b7e656f4ac /plugins/CryptoPP | |
parent | fcbb395dc7ff3edab972b6d4b27dbbfb3305f5d7 (diff) |
BYTE -> uint8_t
Diffstat (limited to 'plugins/CryptoPP')
-rw-r--r-- | plugins/CryptoPP/src/base16.cpp | 8 | ||||
-rw-r--r-- | plugins/CryptoPP/src/cpp_gpgw.cpp | 2 | ||||
-rw-r--r-- | plugins/CryptoPP/src/cpp_gzip.cpp | 4 | ||||
-rw-r--r-- | plugins/CryptoPP/src/cpp_keys.cpp | 12 | ||||
-rw-r--r-- | plugins/CryptoPP/src/cpp_misc.cpp | 8 | ||||
-rw-r--r-- | plugins/CryptoPP/src/cpp_rsau.cpp | 6 | ||||
-rw-r--r-- | plugins/CryptoPP/src/cpp_svcs.cpp | 12 | ||||
-rw-r--r-- | plugins/CryptoPP/src/cryptopp.h | 6 | ||||
-rw-r--r-- | plugins/CryptoPP/src/utf8.cpp | 2 |
9 files changed, 30 insertions, 30 deletions
diff --git a/plugins/CryptoPP/src/base16.cpp b/plugins/CryptoPP/src/base16.cpp index f75ebe1d1b..3d531add45 100644 --- a/plugins/CryptoPP/src/base16.cpp +++ b/plugins/CryptoPP/src/base16.cpp @@ -4,7 +4,7 @@ char* base16encode(const char *inBuffer, size_t count) {
char *outBuffer = (char *)malloc(count * 2 + 1);
char *outBufferPtr = outBuffer;
- BYTE *inBufferPtr = (BYTE *)inBuffer;
+ uint8_t *inBufferPtr = (uint8_t *)inBuffer;
while (count) {
*outBufferPtr++ = encode16(((*inBufferPtr) >> 4) & 0x0F);
@@ -19,7 +19,7 @@ char* base16encode(const char *inBuffer, size_t count) char* base16decode(const char *inBuffer, size_t *count)
{
char *outBuffer = (char *)mir_alloc(*count);
- BYTE *outBufferPtr = (BYTE *)outBuffer;
+ uint8_t *outBufferPtr = (uint8_t *)outBuffer;
bool big_endian = false;
if (*inBuffer == '0' && *(inBuffer + 1) == 'x') {
@@ -28,7 +28,7 @@ char* base16decode(const char *inBuffer, size_t *count) *count -= 2;
}
while (*count > 1) {
- BYTE c0, c1;
+ uint8_t c0, c1;
if (big_endian) {
c1 = decode16(*--inBuffer);
c0 = decode16(*--inBuffer);
@@ -46,7 +46,7 @@ char* base16decode(const char *inBuffer, size_t *count) *count -= 2;
}
*outBufferPtr = '\0';
- *count = (int)(outBufferPtr - (BYTE *)outBuffer);
+ *count = (int)(outBufferPtr - (uint8_t *)outBuffer);
return outBuffer;
}
diff --git a/plugins/CryptoPP/src/cpp_gpgw.cpp b/plugins/CryptoPP/src/cpp_gpgw.cpp index 224ddf82d4..cf77a1e3c4 100644 --- a/plugins/CryptoPP/src/cpp_gpgw.cpp +++ b/plugins/CryptoPP/src/cpp_gpgw.cpp @@ -146,7 +146,7 @@ int __cdecl gpg_set_key(HANDLE context, LPCSTR RemoteKey) if (!_gpg_check_key(RemoteKey)) return 0;
SAFE_FREE(ptr->pgpKey);
- ptr->pgpKey = (BYTE *) malloc(strlen(RemoteKey)+1);
+ ptr->pgpKey = (uint8_t *) malloc(strlen(RemoteKey)+1);
strcpy((LPSTR)ptr->pgpKey,RemoteKey);
return 1;
diff --git a/plugins/CryptoPP/src/cpp_gzip.cpp b/plugins/CryptoPP/src/cpp_gzip.cpp index 1750a255a4..f8c4a154ea 100644 --- a/plugins/CryptoPP/src/cpp_gzip.cpp +++ b/plugins/CryptoPP/src/cpp_gzip.cpp @@ -1,7 +1,7 @@ #include "commonheaders.h"
// gzip data
-BYTE *cpp_gzip(BYTE *pData, size_t nLen, size_t& nCompressedLen)
+uint8_t *cpp_gzip(uint8_t *pData, size_t nLen, size_t& nCompressedLen)
{
string zipped;
Gzip gzip(new StringSink(zipped), 5); // 1 is fast, 9 is slow
@@ -16,7 +16,7 @@ BYTE *cpp_gzip(BYTE *pData, size_t nLen, size_t& nCompressedLen) }
// gunzip data
-BYTE *cpp_gunzip(BYTE *pCompressedData, size_t nCompressedLen, size_t& nLen)
+uint8_t *cpp_gunzip(uint8_t *pCompressedData, size_t nCompressedLen, size_t& nLen)
{
string unzipped;
Gunzip gunzip(new StringSink(unzipped));
diff --git a/plugins/CryptoPP/src/cpp_keys.cpp b/plugins/CryptoPP/src/cpp_keys.cpp index 38c82bf6b8..f327c575d1 100644 --- a/plugins/CryptoPP/src/cpp_keys.cpp +++ b/plugins/CryptoPP/src/cpp_keys.cpp @@ -24,8 +24,8 @@ LPSTR __cdecl cpp_init_keya(HANDLE context, int features) p->dh = new DH(p0, g0);
}
- BYTE priv1[KEYSIZE]; // private key of 2048 bit
- BYTE publ1[KEYSIZE + 2]; // public key of 2048 bit + faetures field
+ uint8_t priv1[KEYSIZE]; // private key of 2048 bit
+ uint8_t publ1[KEYSIZE + 2]; // public key of 2048 bit + faetures field
memset(priv1, 0, sizeof(priv1));
memset(publ1, 0, sizeof(publ1));
@@ -148,17 +148,17 @@ int __cdecl cpp_calc_keyx(HANDLE context) if (!p->KeyB) { ptr->error = ERROR_NO_KEYB; return 0; }
ptr->error = ERROR_NONE;
- BYTE agreeVal[KEYSIZE];
+ uint8_t agreeVal[KEYSIZE];
memset(agreeVal, 0, sizeof(agreeVal));
- BYTE agr = p->dh->Agree(agreeVal, p->KeyA, p->KeyB, true); // calculate key
+ uint8_t agr = p->dh->Agree(agreeVal, p->KeyA, p->KeyB, true); // calculate key
if (agr) {
// not needed anymore
SAFE_FREE(p->PubA);
SAFE_FREE(p->KeyA);
mir_free(p->KeyB); p->KeyB = nullptr;
- BYTE buffer[Tiger::DIGESTSIZE]; // buffer for hash
+ uint8_t buffer[Tiger::DIGESTSIZE]; // buffer for hash
memset(buffer, 0, sizeof(buffer));
// do this only if key exchanged is ok
@@ -179,7 +179,7 @@ int __cdecl cpp_init_keyp(HANDLE context, LPCSTR password) pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
pSIMDATA p = (pSIMDATA)cpp_alloc_pdata(ptr);
- BYTE buffer[Tiger::DIGESTSIZE]; // buffer for hash
+ uint8_t buffer[Tiger::DIGESTSIZE]; // buffer for hash
memset(buffer, 0, sizeof(buffer));
// calculate hash
diff --git a/plugins/CryptoPP/src/cpp_misc.cpp b/plugins/CryptoPP/src/cpp_misc.cpp index 0b05a59356..d7905b13b7 100644 --- a/plugins/CryptoPP/src/cpp_misc.cpp +++ b/plugins/CryptoPP/src/cpp_misc.cpp @@ -36,7 +36,7 @@ int __cdecl cpp_size_keyx(void) return(Tiger::DIGESTSIZE + 2);
}
-void __cdecl cpp_get_keyx(HANDLE context, BYTE *key)
+void __cdecl cpp_get_keyx(HANDLE context, uint8_t *key)
{
pCNTX ptr;
pSIMDATA p;
@@ -46,7 +46,7 @@ void __cdecl cpp_get_keyx(HANDLE context, BYTE *key) memcpy(key + Tiger::DIGESTSIZE, &ptr->features, 2);
}
-void __cdecl cpp_set_keyx(HANDLE context, BYTE *key)
+void __cdecl cpp_set_keyx(HANDLE context, uint8_t *key)
{
pCNTX ptr;
pSIMDATA p;
@@ -61,7 +61,7 @@ void __cdecl cpp_set_keyx(HANDLE context, BYTE *key) memcpy(&ptr->features, key + Tiger::DIGESTSIZE, 2);
}
-void __cdecl cpp_get_keyp(HANDLE context, BYTE *key)
+void __cdecl cpp_get_keyp(HANDLE context, uint8_t *key)
{
pCNTX ptr;
pSIMDATA p;
@@ -75,7 +75,7 @@ int __cdecl cpp_size_keyp(void) return(Tiger::DIGESTSIZE);
}
-void __cdecl cpp_set_keyp(HANDLE context, BYTE *key)
+void __cdecl cpp_set_keyp(HANDLE context, uint8_t *key)
{
pCNTX ptr;
pSIMDATA p;
diff --git a/plugins/CryptoPP/src/cpp_rsau.cpp b/plugins/CryptoPP/src/cpp_rsau.cpp index bf2266e84a..fb92835b59 100644 --- a/plugins/CryptoPP/src/cpp_rsau.cpp +++ b/plugins/CryptoPP/src/cpp_rsau.cpp @@ -113,7 +113,7 @@ string hash(string& b) string hash(uint8_t *b, size_t l)
{
- BYTE h[RSA_KEYSIZE];
+ uint8_t h[RSA_KEYSIZE];
RSA_CalculateDigest(h, b, l);
string s; s.assign((char*)&h, RSA_KEYSIZE);
return s;
@@ -131,7 +131,7 @@ string hash128(LPSTR b) string hash128(uint8_t *b, size_t l)
{
- BYTE h[RIPEMD128::DIGESTSIZE];
+ uint8_t h[RIPEMD128::DIGESTSIZE];
RIPEMD128().CalculateDigest(h, b, l);
string s; s.assign((char*)&h, sizeof(h));
return s;
@@ -149,7 +149,7 @@ string hash256(LPSTR b) string hash256(uint8_t *b, size_t l)
{
- BYTE h[RIPEMD256::DIGESTSIZE];
+ uint8_t h[RIPEMD256::DIGESTSIZE];
RIPEMD256().CalculateDigest(h, b, l);
string s; s.assign((char*)&h, sizeof(h));
return s;
diff --git a/plugins/CryptoPP/src/cpp_svcs.cpp b/plugins/CryptoPP/src/cpp_svcs.cpp index 23c05cb5e1..15d8202498 100644 --- a/plugins/CryptoPP/src/cpp_svcs.cpp +++ b/plugins/CryptoPP/src/cpp_svcs.cpp @@ -8,13 +8,13 @@ LPSTR __cdecl cpp_encrypt(pCNTX ptr, LPCSTR szPlainMsg) ptr->error = ERROR_NONE;
pSIMDATA p = (pSIMDATA)ptr->pdata;
- BYTE dataflag = 0;
+ uint8_t dataflag = 0;
size_t slen = strlen(szPlainMsg);
LPSTR szMsg;
if (ptr->features & FEATURES_GZIP) {
size_t clen;
- szMsg = (LPSTR)cpp_gzip((BYTE*)szPlainMsg, slen, clen);
+ szMsg = (LPSTR)cpp_gzip((uint8_t*)szPlainMsg, slen, clen);
if (clen >= slen) {
free(szMsg);
szMsg = _strdup(szPlainMsg);
@@ -38,9 +38,9 @@ LPSTR __cdecl cpp_encrypt(pCNTX ptr, LPCSTR szPlainMsg) unsigned clen = (unsigned)ciphered.length();
if (ptr->features & FEATURES_CRC32) {
- BYTE crc32[CRC32::DIGESTSIZE];
+ uint8_t crc32[CRC32::DIGESTSIZE];
memset(crc32, 0, sizeof(crc32));
- CRC32().CalculateDigest(crc32, (BYTE*)ciphered.data(), clen);
+ CRC32().CalculateDigest(crc32, (uint8_t*)ciphered.data(), clen);
ciphered.insert(0, (LPSTR)&crc32, CRC32::DIGESTSIZE);
ciphered.insert(0, (LPSTR)&clen, 2);
}
@@ -79,7 +79,7 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) LPSTR bciphered = ciphered;
- BYTE dataflag = 0;
+ uint8_t dataflag = 0;
if (ptr->features & FEATURES_GZIP) {
dataflag = *ciphered;
bciphered++; clen--; // cut GZIP flag
@@ -96,7 +96,7 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) return nullptr;
}
- BYTE crc32[CRC32::DIGESTSIZE];
+ uint8_t crc32[CRC32::DIGESTSIZE];
memset(crc32, 0, sizeof(crc32));
CRC32().CalculateDigest(crc32, (uint8_t*)(bciphered + CRC32::DIGESTSIZE), len);
diff --git a/plugins/CryptoPP/src/cryptopp.h b/plugins/CryptoPP/src/cryptopp.h index 5b8d304c40..f3c1cb8aca 100644 --- a/plugins/CryptoPP/src/cryptopp.h +++ b/plugins/CryptoPP/src/cryptopp.h @@ -87,7 +87,7 @@ typedef PGPDATA* pPGPDATA; typedef struct __GPGDATA {
- BYTE *gpgKeyID; // GPG KeyID
+ uint8_t *gpgKeyID; // GPG KeyID
} GPGDATA;
typedef GPGDATA* pGPGDATA;
@@ -155,8 +155,8 @@ extern LPCSTR szVersionStr; pCNTX get_context_on_id(int);
pCNTX get_context_on_id(HANDLE);
void cpp_free_keys(pCNTX);
-BYTE *cpp_gzip(BYTE*, size_t, size_t&);
-BYTE *cpp_gunzip(BYTE*, size_t, size_t&);
+uint8_t *cpp_gzip(uint8_t*, size_t, size_t&);
+uint8_t *cpp_gunzip(uint8_t*, size_t, size_t&);
string cpp_zlibc(string&);
string cpp_zlibd(string&);
diff --git a/plugins/CryptoPP/src/utf8.cpp b/plugins/CryptoPP/src/utf8.cpp index 6a0a6e21a7..03bcce1f36 100644 --- a/plugins/CryptoPP/src/utf8.cpp +++ b/plugins/CryptoPP/src/utf8.cpp @@ -27,7 +27,7 @@ LPSTR __cdecl utf8encode(LPCWSTR str) i = 0;
for (w = wszTemp; *w; w++) {
if (*w < 0x0080)
- szOut[i++] = (BYTE)*w;
+ szOut[i++] = (uint8_t)*w;
else if (*w < 0x0800) {
szOut[i++] = 0xc0 | (((*w) >> 6) & 0x3f);
szOut[i++] = 0x80 | ((*w) & 0x3f);
|