summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-10-19 22:28:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-10-19 22:28:22 +0300
commita6a0505831e4d3f91698ad995cd2ead8b47a2f2c (patch)
treed8c0a4f6a07da16144fc0c65eed62e6c9357e756
parentab99d7c226e1482c9a09771961ccabc9a60fb2cc (diff)
WhatsApp untied from libsodium
-rw-r--r--libs/libsignal/src/signal.def1
-rw-r--r--protocols/WhatsAppWeb/WhatsAppWeb.vcxproj5
-rw-r--r--protocols/WhatsAppWeb/src/noise.cpp2
-rw-r--r--protocols/WhatsAppWeb/src/stdafx.h1
-rw-r--r--tools/build_scripts/z2_PackPluginUpdater.bat2
-rw-r--r--utils/mir_signal.h20
6 files changed, 16 insertions, 15 deletions
diff --git a/libs/libsignal/src/signal.def b/libs/libsignal/src/signal.def
index d471c45ab7..b08db777b4 100644
--- a/libs/libsignal/src/signal.def
+++ b/libs/libsignal/src/signal.def
@@ -3,6 +3,7 @@ LIBRARY libsignal.mir
EXPORTS
ciphertext_message_get_serialized
ciphertext_message_get_type
+ curve25519_donna
curve_calculate_agreement
curve_calculate_signature
curve_decode_point
diff --git a/protocols/WhatsAppWeb/WhatsAppWeb.vcxproj b/protocols/WhatsAppWeb/WhatsAppWeb.vcxproj
index bc032bfdcc..a3c27bbfc6 100644
--- a/protocols/WhatsAppWeb/WhatsAppWeb.vcxproj
+++ b/protocols/WhatsAppWeb/WhatsAppWeb.vcxproj
@@ -25,9 +25,6 @@
<ProjectReference Include="..\..\libs\libsignal\libsignal.vcxproj">
<Project>{620e0be7-3763-4f35-9dbd-4770104e269c}</Project>
</ProjectReference>
- <ProjectReference Include="..\..\libs\libsodium\libsodium.vcxproj">
- <Project>{a185b162-6cb6-4502-b03f-b56f7699a8d9}</Project>
- </ProjectReference>
<ProjectReference Include="..\..\libs\zlib\zlib.vcxproj">
<Project>{e2a369cd-eda3-414f-8ad0-e732cd7ee68c}</Project>
</ProjectReference>
@@ -37,7 +34,7 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{13E796AD-BEA4-4213-A1B8-E18E2397E544}</ProjectGuid>
- <ProjectName>WhatsAppWeb</ProjectName>
+ <ProjectName>WhatsApp</ProjectName>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Platform)'=='Win32'">
<VcpkgUseStatic>false</VcpkgUseStatic>
diff --git a/protocols/WhatsAppWeb/src/noise.cpp b/protocols/WhatsAppWeb/src/noise.cpp
index 446689bea7..190e5740f6 100644
--- a/protocols/WhatsAppWeb/src/noise.cpp
+++ b/protocols/WhatsAppWeb/src/noise.cpp
@@ -90,7 +90,7 @@ void WANoise::deriveKey(const void *pData, size_t cbLen, MBinBuffer &write, MBin
void WANoise::mixIntoKey(const void *n, const void *p)
{
uint8_t tmp[32];
- crypto_scalarmult((unsigned char *)tmp, (const unsigned char *)n, (const unsigned char *)p);
+ curve25519_donna((unsigned char *)tmp, (const unsigned char *)n, (const unsigned char *)p);
deriveKey(tmp, sizeof(tmp), salt, encKey);
decKey.assign(encKey.data(), encKey.length());
diff --git a/protocols/WhatsAppWeb/src/stdafx.h b/protocols/WhatsAppWeb/src/stdafx.h
index 52a3148edd..98fea4f388 100644
--- a/protocols/WhatsAppWeb/src/stdafx.h
+++ b/protocols/WhatsAppWeb/src/stdafx.h
@@ -53,7 +53,6 @@ Copyright © 2019-22 George Hazan
#include <openssl/kdf.h>
#include "../../libs/libqrencode/src/qrencode.h"
-#include "../../libs/libsodium/src/include/sodium.h"
#include "../../libs/zlib/src/zlib.h"
#include "../../utils/mir_signal.h"
diff --git a/tools/build_scripts/z2_PackPluginUpdater.bat b/tools/build_scripts/z2_PackPluginUpdater.bat
index bbfc4d84c1..3b0d1410c3 100644
--- a/tools/build_scripts/z2_PackPluginUpdater.bat
+++ b/tools/build_scripts/z2_PackPluginUpdater.bat
@@ -81,7 +81,7 @@ for /f %%a in ('dir plugins\*.dll /B /L') do (
if /I "%%a"=="VKontakte.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Icons\Proto_VKontakte.dll")
if /I "%%a"=="Watrack.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Icons\Watrack_buttons.dll" "Icons\Watrack_icons.dll" "Plugins\player.ini")
if /I "%%a"=="Weather.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Icons\Proto_Weather.dll" "Plugins\Weather\*.ini")
- if /I "%%a"=="WhatsAppWeb.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "libs\libprotobuf-lite.dll" "libs\libprotobuf.dll" "Libs\libsodium.mir" "libs\libqrencode.mir")
+ if /I "%%a"=="WhatsApp.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "libs\libprotobuf-lite.dll" "libs\libprotobuf.dll" "Libs\libsignal.mir" "libs\libqrencode.mir")
if /I "%%a"=="YAMN.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Icons\Proto_YAMN.dll")
rem now adding plugin itself into archive
%ZipIt% "%Arch%\Plugins\%%~na.zip" %%a
diff --git a/utils/mir_signal.h b/utils/mir_signal.h
index 95281e745c..6395cc5282 100644
--- a/utils/mir_signal.h
+++ b/utils/mir_signal.h
@@ -4,14 +4,18 @@
#include <m_system.h>
#include <m_utils.h>
-#include "../libs/libsignal/src/curve.h"
-#include "../libs/libsignal/src/hkdf.h"
-#include "../libs/libsignal/src/key_helper.h"
-#include "../libs/libsignal/src/protocol.h"
-#include "../libs/libsignal/src/session_builder.h"
-#include "../libs/libsignal/src/session_cipher.h"
-#include "../libs/libsignal/src/signal_protocol.h"
-#include "../libs/libsignal/src/signal_protocol_types.h"
+extern "C"
+{
+ #include "../libs/libsignal/src/curve.h"
+ #include "../libs/libsignal/src/hkdf.h"
+ #include "../libs/libsignal/src/key_helper.h"
+ #include "../libs/libsignal/src/protocol.h"
+ #include "../libs/libsignal/src/session_builder.h"
+ #include "../libs/libsignal/src/session_cipher.h"
+ #include "../libs/libsignal/src/signal_protocol.h"
+ #include "../libs/libsignal/src/signal_protocol_types.h"
+ #include "../libs/libsignal/src/curve25519/curve25519-donna.h"
+}
struct signal_buffer
{