summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-12-23 19:44:41 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-12-23 19:44:41 +0300
commit6c05257b0cee0cfd1599e1f771dfadfe6035141f (patch)
tree56d9818899698e9c33e7a795154078a67fbf32a8 /protocols
parent3a5a00dd6d1d0d0d0ff9c882faf1a8d958469323 (diff)
openssl based hmac calculation
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Icq10/src/server.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp
index 7668c154f6..35db43f06c 100644
--- a/protocols/Icq10/src/server.cpp
+++ b/protocols/Icq10/src/server.cpp
@@ -20,6 +20,8 @@
#include "stdafx.h"
+#pragma comment(lib, "libeay32.lib")
+
void CIcqProto::ConnectionFailed(int iReason)
{
debugLogA("ConnectionFailed -> reason %d", iReason);
@@ -138,13 +140,15 @@ void CIcqProto::OnCheckPassword(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*)
<< INT_PARAM("mobile", 0) << CHAR_PARAM("nonce", nonce) << INT_PARAM("pointVersion", 0) << CHAR_PARAM("r", (char*)szId)
<< INT_PARAM("rawMsg", 0) << INT_PARAM("sessionTimeout", 7776000) << INT_PARAM("ts", ts) << CHAR_PARAM("view", "online");
- BYTE hashOut[MIR_SHA256_HASH_SIZE];
ptrA szPassword(getStringA("Password"));
- mir_hmac_sha256(hashOut, (BYTE*)szPassword.get(), mir_strlen(szPassword), (BYTE*)m_szSessionSecret.c_str(), m_szSessionSecret.GetLength());
+
+ BYTE hashOut[MIR_SHA256_HASH_SIZE];
+ unsigned int len = sizeof(hashOut);
+ HMAC(EVP_sha256(), szPassword.get(), mir_strlen(szPassword), (BYTE*)m_szSessionSecret.c_str(), m_szSessionSecret.GetLength(), hashOut, &len);
ptrA szSessionKey(mir_base64_encode(hashOut, sizeof(hashOut)));
CMStringA hashData(FORMAT, "POST&%s&%s", ptrA(mir_urlEncode(pReq->szUrl)), ptrA(mir_urlEncode(pReq->m_szParam)));
- mir_hmac_sha256(hashOut, (BYTE*)szSessionKey.get(), mir_strlen(szSessionKey), (BYTE*)hashData.c_str(), hashData.GetLength());
+ HMAC(EVP_sha256(), szSessionKey.get(), mir_strlen(szSessionKey), (BYTE*)hashData.c_str(), hashData.GetLength(), hashOut, &len);
pReq->m_szParam.Empty();
pReq << CHAR_PARAM("a", m_szAToken) << INT_PARAM("activeTimeout", 180) << CHAR_PARAM("assertCaps", CAPS)