From 9cb64ba2151b213f5544b2e53c6668061f197b9c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 21 Jun 2015 13:43:01 +0000 Subject: MS_UTILS_GETRANDOM -> mir_core::Utils_GetRandom git-svn-id: http://svn.miranda-ng.org/main/trunk@14299 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/AimOscar/src/client.cpp | 2 +- protocols/AimOscar/src/file.cpp | 2 +- protocols/AimOscar/src/utility.cpp | 2 +- protocols/Gadu-Gadu/src/oauth.cpp | 2 +- protocols/JabberG/src/jabber_secur.cpp | 4 ++-- protocols/MSN/src/msn_auth.cpp | 5 ++--- protocols/MSN/src/msn_std.cpp | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp index b17a0cdd39..e0c9a29ec7 100644 --- a/protocols/AimOscar/src/client.cpp +++ b/protocols/AimOscar/src/client.cpp @@ -345,7 +345,7 @@ int CAimProto::aim_send_message(HANDLE hServerConn,unsigned short &seqno,const c char* tlv_buf=(char*)alloca(5+msg_len+8); char icbm_cookie[8]; - CallService(MS_UTILS_GETRANDOM, 8, (LPARAM)icbm_cookie); + Utils_GetRandom(icbm_cookie, sizeof(icbm_cookie)); aim_writegeneric(5,"\x05\x01\x00\x01\x01",tlv_offset,tlv_buf); // icbm im capabilities aim_writeshort(0x0101,tlv_offset,tlv_buf); // icbm im text tag diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index f98060d924..9e075e3f79 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -540,7 +540,7 @@ file_transfer::file_transfer(MCONTACT hCont, char* nick, char* cookie) if (cookie) memcpy(icbm_cookie, cookie, 8); else - CallService(MS_UTILS_GETRANDOM, 8, (LPARAM)icbm_cookie); + Utils_GetRandom(icbm_cookie, 8); hResumeEvent = CreateEvent(NULL, FALSE, FALSE, NULL); } diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 004e195359..d66e920b56 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -674,7 +674,7 @@ unsigned long char_ip_to_long_ip(char* ip) unsigned short get_random(void) { unsigned short id; - CallService(MS_UTILS_GETRANDOM, sizeof(id), (LPARAM)&id); + Utils_GetRandom(&id, sizeof(id)); id &= 0x7fff; return id; } diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 19c74c0acf..4aad3c3838 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -222,7 +222,7 @@ int oauth_sign_request(LIST ¶ms, const char *httpmethod, con char* oauth_generate_nonce() { char randnum[16]; - CallService(MS_UTILS_GETRANDOM, (WPARAM)sizeof(randnum), (LPARAM)randnum); + Utils_GetRandom(randnum, sizeof(randnum)); CMStringA str(FORMAT, "%ld%s", time(NULL), randnum); diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 24c93439db..9edeb32d7e 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -154,7 +154,7 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge) DWORD digest[4], hash1[4], hash2[4]; mir_md5_state_t ctx; - CallService(MS_UTILS_GETRANDOM, sizeof(digest), (LPARAM)digest); + Utils_GetRandom(digest, sizeof(digest)); mir_snprintf(cnonce, _countof(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3])); T2Utf uname(info->conn.username), passw(info->conn.password); @@ -306,7 +306,7 @@ char* TScramAuth::getInitialRequest() T2Utf uname(info->conn.username); unsigned char nonce[24]; - CallService(MS_UTILS_GETRANDOM, sizeof(nonce), (LPARAM)nonce); + Utils_GetRandom(nonce, sizeof(nonce)); cnonce = mir_base64_encode((PBYTE)nonce, sizeof(nonce)); char buf[4096]; diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index c866135156..ce01104a1e 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -405,7 +405,7 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) p += sizeof(MsgrUsrKeyHdr); unsigned char iv[8]; - CallService(MS_UTILS_GETRANDOM, sizeof(iv), (LPARAM)iv); + Utils_GetRandom(iv, sizeof(iv)); memcpy(p, iv, sizeof(iv)); p += sizeof(iv); @@ -423,11 +423,10 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) return mir_base64_encode(userKey, (unsigned)pktsz); } - CMStringA CMsnProto::HotmailLogin(const char* url) { unsigned char nonce[24]; - CallService(MS_UTILS_GETRANDOM, sizeof(nonce), (LPARAM)nonce); + Utils_GetRandom(nonce, sizeof(nonce)); unsigned key1len; BYTE *key1 = (BYTE*)mir_base64_decode(hotSecretToken, &key1len); diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index c609a54391..a29db7b667 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -63,6 +63,6 @@ TCHAR* CMsnProto::GetContactNameT(MCONTACT hContact) unsigned MSN_GenRandom(void) { unsigned rndnum; - CallService(MS_UTILS_GETRANDOM, sizeof(rndnum), (LPARAM)&rndnum); + Utils_GetRandom(&rndnum, sizeof(rndnum)); return rndnum & 0x7FFFFFFF; } -- cgit v1.2.3