diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-23 20:11:05 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-23 20:11:05 +0300 |
commit | ff6b8261d89a2ac071bba0ebe0e16b40dd7122a1 (patch) | |
tree | 4259ca6e16d4bf453be0bc2aaa31f5a5ba413051 /protocols/JabberG/src | |
parent | 6c05257b0cee0cfd1599e1f771dfadfe6035141f (diff) |
in fact, we don't need mir_hmac_sha1 either
Diffstat (limited to 'protocols/JabberG/src')
-rwxr-xr-x | protocols/JabberG/src/jabber_omemo.cpp | 5 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_secur.cpp | 12 | ||||
-rwxr-xr-x | protocols/JabberG/src/stdafx.h | 6 |
3 files changed, 14 insertions, 9 deletions
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index 186cd5c2e9..772560af2f 100755 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -28,10 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "jabber_omemo.h"
-#include <openssl/evp.h>
-#include <openssl/hmac.h>
-#include <openssl/rand.h>
-#include <openssl/sha.h>
+
#include <signal_protocol.h>
#include <signal_protocol_types.h>
#include <key_helper.h>
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index bb0a51e778..28166d3348 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -230,7 +230,8 @@ void TScramAuth::Hi(BYTE* res, char* passw, size_t passwLen, char* salt, size_t memset(res, 0, MIR_SHA1_HASH_SIZE);
for (int i = 0; i < ind; i++) {
- mir_hmac_sha1(u, (BYTE*)passw, passwLen, u, bufLen);
+ unsigned int len = MIR_SHA1_HASH_SIZE;
+ HMAC(EVP_sha1(), (BYTE*)passw, passwLen, u, bufLen, u, &len);
bufLen = MIR_SHA1_HASH_SIZE;
for (unsigned j = 0; j < MIR_SHA1_HASH_SIZE; j++)
@@ -268,7 +269,8 @@ char* TScramAuth::getChallenge(const wchar_t *challenge) Hi(saltedPassw, passw, passwLen, salt, saltLen, ind);
BYTE clientKey[MIR_SHA1_HASH_SIZE];
- mir_hmac_sha1(clientKey, saltedPassw, sizeof(saltedPassw), (BYTE*)"Client Key", 10);
+ unsigned int len = sizeof(clientKey);
+ HMAC(EVP_sha1(), saltedPassw, sizeof(saltedPassw), (BYTE*)"Client Key", 10, clientKey, &len);
BYTE storedKey[MIR_SHA1_HASH_SIZE];
@@ -281,7 +283,7 @@ char* TScramAuth::getChallenge(const wchar_t *challenge) int authmsgLen = mir_snprintf(authmsg, "%s,%s,c=biws,r=%s", msg1, chl, snonce);
BYTE clientSig[MIR_SHA1_HASH_SIZE];
- mir_hmac_sha1(clientSig, storedKey, sizeof(storedKey), (BYTE*)authmsg, authmsgLen);
+ HMAC(EVP_sha1(), storedKey, sizeof(storedKey), (BYTE*)authmsg, authmsgLen, clientSig, &len);
BYTE clientProof[MIR_SHA1_HASH_SIZE];
for (unsigned j = 0; j < sizeof(clientKey); j++)
@@ -289,10 +291,10 @@ char* TScramAuth::getChallenge(const wchar_t *challenge) /* Calculate the server signature */
BYTE serverKey[MIR_SHA1_HASH_SIZE];
- mir_hmac_sha1(serverKey, saltedPassw, sizeof(saltedPassw), (BYTE*)"Server Key", 10);
+ HMAC(EVP_sha1(), saltedPassw, sizeof(saltedPassw), (BYTE*)"Server Key", 10, serverKey, &len);
BYTE srvSig[MIR_SHA1_HASH_SIZE];
- mir_hmac_sha1(srvSig, serverKey, sizeof(serverKey), (BYTE*)authmsg, authmsgLen);
+ HMAC(EVP_sha1(), serverKey, sizeof(serverKey), (BYTE*)authmsg, authmsgLen, srvSig, &len);
serverSignature = mir_base64_encode(srvSig, sizeof(srvSig));
char buf[4096];
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index bd420ce718..f4431b2b28 100755 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -97,6 +97,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_skin_eng.h>
#include <m_gui.h>
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+#include <openssl/rand.h>
+#include <openssl/sha.h>
+#pragma comment(lib, "libeay32.lib")
+
#include "../../libs/zlib/src/zlib.h"
#include "resource.h"
|