From ff6b8261d89a2ac071bba0ebe0e16b40dd7122a1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 23 Dec 2018 20:11:05 +0300 Subject: in fact, we don't need mir_hmac_sha1 either --- protocols/MSN/src/msn_auth.cpp | 12 +++++++----- protocols/MSN/src/stdafx.h | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'protocols/MSN') diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index e8c1fa4602..e478dc6e72 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -524,16 +524,17 @@ static void derive_key(BYTE* der, unsigned char* key, size_t keylen, unsigned ch const size_t buflen = MIR_SHA1_HASH_SIZE + datalen; BYTE* buf = (BYTE*)alloca(buflen); - mir_hmac_sha1(hash1, key, keylen, data, datalen); - mir_hmac_sha1(hash3, key, keylen, hash1, MIR_SHA1_HASH_SIZE); + unsigned int len = sizeof(hash1); + HMAC(EVP_sha1(), key, keylen, data, datalen, hash1, &len); + HMAC(EVP_sha1(), key, keylen, hash1, MIR_SHA1_HASH_SIZE, hash3, &len); memcpy(buf, hash1, MIR_SHA1_HASH_SIZE); memcpy(buf + MIR_SHA1_HASH_SIZE, data, datalen); - mir_hmac_sha1(hash2, key, keylen, buf, buflen); + HMAC(EVP_sha1(), key, keylen, buf, buflen, hash2, &len); memcpy(buf, hash3, MIR_SHA1_HASH_SIZE); memcpy(buf + MIR_SHA1_HASH_SIZE, data, datalen); - mir_hmac_sha1(hash4, key, keylen, buf, buflen); + HMAC(EVP_sha1(), key, keylen, buf, buflen, hash4, &len); memcpy(der, hash2, MIR_SHA1_HASH_SIZE); memcpy(der + MIR_SHA1_HASH_SIZE, hash4, 4); @@ -564,7 +565,8 @@ CMStringA CMsnProto::HotmailLogin(const char* url) result.Append(ptrA(mir_urlEncode(noncenc))); BYTE hash[MIR_SHA1_HASH_SIZE]; - mir_hmac_sha1(hash, key2, sizeof(key2), (BYTE*)result.GetString(), result.GetLength()); + unsigned int len = sizeof(hash); + HMAC(EVP_sha1(), key2, sizeof(key2), (BYTE*)result.GetString(), result.GetLength(), hash, &len); ptrA szHash(mir_base64_encode(hash, sizeof(hash))); result.AppendFormat("&hash=%s", ptrA(mir_urlEncode(szHash))); return result; diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index a96e8a8efa..ef2024f7e2 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -70,6 +70,10 @@ along with this program. If not, see . #include "ezxml.h" +#include +#include +#pragma comment(lib, "libeay32.lib") + #include "resource.h" ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3