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/MSN | |
parent | 6c05257b0cee0cfd1599e1f771dfadfe6035141f (diff) |
in fact, we don't need mir_hmac_sha1 either
Diffstat (limited to 'protocols/MSN')
-rw-r--r-- | protocols/MSN/src/msn_auth.cpp | 12 | ||||
-rw-r--r-- | protocols/MSN/src/stdafx.h | 4 |
2 files changed, 11 insertions, 5 deletions
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 <http://www.gnu.org/licenses/>. #include "ezxml.h"
+#include <openssl/hmac.h>
+#include <openssl/sha.h>
+#pragma comment(lib, "libeay32.lib")
+
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////////////////
|