summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-10-30 19:26:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-10-30 19:26:25 +0300
commit7efa6ec72313264d94a79ba71216bf0ac8aadc15 (patch)
tree726bb9792062711f09e20d04d24cf33827807ad0 /protocols/WhatsApp
parentc657140a8aba3e92154c8ca2622c74308ccdf19c (diff)
fixes #3222 (WhatsApp: no QR code window in 32-bit Miranda)
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/pmsg.proto.h4
-rw-r--r--protocols/WhatsApp/src/proto.h2
-rw-r--r--protocols/WhatsApp/src/protobuf-c/protobuf-c.h4
-rw-r--r--protocols/WhatsApp/src/utils.cpp6
-rw-r--r--protocols/WhatsApp/src/utils.h2
5 files changed, 9 insertions, 9 deletions
diff --git a/protocols/WhatsApp/src/pmsg.proto.h b/protocols/WhatsApp/src/pmsg.proto.h
index 1784124b12..1b5a5ccf4c 100644
--- a/protocols/WhatsApp/src/pmsg.proto.h
+++ b/protocols/WhatsApp/src/pmsg.proto.h
@@ -1,3 +1,7 @@
+#ifdef _DEBUG
+#define PROTOBUF_C_UNPACK_ERROR OutputDebugStringA
+#endif
+
#include "pmsg.pb-c.h"
namespace proto
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index 96a0800b77..1d17a1ed27 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -118,7 +118,7 @@ class WANoise
friend class WhatsAppProto;
WhatsAppProto *ppro;
- int readCounter = 0, writeCounter = 0;
+ uint32_t readCounter = 0, writeCounter = 0;
bool bInitFinished = false, bSendIntro = false;
MBinBuffer salt, encKey, decKey;
uint8_t hash[32];
diff --git a/protocols/WhatsApp/src/protobuf-c/protobuf-c.h b/protocols/WhatsApp/src/protobuf-c/protobuf-c.h
index ec91d00977..5fa52da626 100644
--- a/protocols/WhatsApp/src/protobuf-c/protobuf-c.h
+++ b/protocols/WhatsApp/src/protobuf-c/protobuf-c.h
@@ -209,10 +209,6 @@ size_t foo__bar__baz_bah__pack_to_buffer
# define PROTOBUF_C__END_DECLS
#endif
-#ifdef _DEBUG
-#define PROTOBUF_C_UNPACK_ERROR OutputDebugStringA
-#endif
-
PROTOBUF_C__BEGIN_DECLS
#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB)
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp
index dd59f5d1bf..8f0f766651 100644
--- a/protocols/WhatsApp/src/utils.cpp
+++ b/protocols/WhatsApp/src/utils.cpp
@@ -259,11 +259,11 @@ std::string encodeBigEndian(uint32_t num, size_t len)
return res;
}
-void generateIV(uint8_t *iv, int &pVar)
+void generateIV(uint8_t *iv, uint32_t &pVar)
{
auto counter = encodeBigEndian(pVar);
- memset(iv, 0, sizeof(iv));
- memcpy(iv + 8, counter.c_str(), sizeof(int));
+ memset(iv, 0, 8);
+ memcpy(iv + 8, counter.c_str(), sizeof(uint32_t));
pVar++;
}
diff --git a/protocols/WhatsApp/src/utils.h b/protocols/WhatsApp/src/utils.h
index 375104f865..616e1de002 100644
--- a/protocols/WhatsApp/src/utils.h
+++ b/protocols/WhatsApp/src/utils.h
@@ -227,7 +227,7 @@ MBinBuffer aesEncrypt(
uint32_t decodeBigEndian(const ProtobufCBinaryData &buf);
std::string encodeBigEndian(uint32_t num, size_t len = sizeof(uint32_t));
-void generateIV(uint8_t *iv, int &pVar);
+void generateIV(uint8_t *iv, uint32_t &pVar);
unsigned char* HKDF(const EVP_MD *evp_md,
const unsigned char *salt, size_t salt_len,