diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-16 12:31:41 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-16 12:31:41 +0000 |
commit | 49fc1a8b9b5858974f90b9d2ed14ba5442c8cbfc (patch) | |
tree | 0f2e69541ce8636e696459326872299a4c201489 /protocols | |
parent | 30ee89a6764a8d38a078374c6ed5de70635b42c0 (diff) |
mir_md5_byte_t => BYTE;
macros mir_base64_encode_bufsize for calculating buffer size
macros mir_base64_encodebuf for in-place base64 encoding
git-svn-id: http://svn.miranda-ng.org/main/trunk@5716 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/AimOscar/src/client.cpp | 12 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/oauth.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_17signon.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_avatar.cpp | 12 | ||||
-rw-r--r-- | protocols/Skype/src/skype_avatars.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_profile.cpp | 2 | ||||
-rw-r--r-- | protocols/Yahoo/src/libyahoo2/crypt.c | 24 | ||||
-rw-r--r-- | protocols/Yahoo/src/libyahoo2/libyahoo2.c | 12 |
8 files changed, 34 insertions, 34 deletions
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp index ceb89c11dd..c7d4bf04b7 100644 --- a/protocols/AimOscar/src/client.cpp +++ b/protocols/AimOscar/src/client.cpp @@ -38,17 +38,17 @@ int CAimProto::aim_auth_request(HANDLE hServerConn,unsigned short &seqno,const c const char* country, const char* username, const char* password)
{
unsigned short offset=0;
- mir_md5_byte_t pass_hash[16];
- mir_md5_byte_t auth_hash[16];
+ BYTE pass_hash[16];
+ BYTE auth_hash[16];
mir_md5_state_t state;
mir_md5_init(&state);
- mir_md5_append(&state,(const mir_md5_byte_t *)password, (int)strlen(password));
+ mir_md5_append(&state,(const BYTE *)password, (int)strlen(password));
mir_md5_finish(&state,pass_hash);
mir_md5_init(&state);
- mir_md5_append(&state,(mir_md5_byte_t*)key, (int)strlen(key));
- mir_md5_append(&state,(mir_md5_byte_t*)pass_hash,MD5_HASH_LENGTH);
- mir_md5_append(&state,(mir_md5_byte_t*)AIM_MD5_STRING, sizeof(AIM_MD5_STRING)-1);
+ mir_md5_append(&state,(BYTE*)key, (int)strlen(key));
+ mir_md5_append(&state,(BYTE*)pass_hash,MD5_HASH_LENGTH);
+ mir_md5_append(&state,(BYTE*)AIM_MD5_STRING, sizeof(AIM_MD5_STRING)-1);
mir_md5_finish(&state,auth_hash);
char client_id[64], mirver[64];
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 7f428319e7..361b3ff81c 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -229,7 +229,7 @@ char *oauth_generate_nonce() strcpy(str, timestamp);
strcat(str, randnum);
- mir_md5_byte_t digest[16];
+ BYTE digest[16];
mir_md5_hash((BYTE*)(char*)str, (int)strlen(str), digest);
return bin2hex(digest, sizeof(digest), (char *)mir_alloc(32 + 1));
}
diff --git a/protocols/IcqOscarJ/src/fam_17signon.cpp b/protocols/IcqOscarJ/src/fam_17signon.cpp index dae5c38a0e..c4c546ca60 100644 --- a/protocols/IcqOscarJ/src/fam_17signon.cpp +++ b/protocols/IcqOscarJ/src/fam_17signon.cpp @@ -132,7 +132,7 @@ void CIcqProto::handleAuthKeyResponse(BYTE *buf, WORD wPacketLen, serverthread_i WORD wKeyLen;
char szKey[64] = {0};
mir_md5_state_t state;
- mir_md5_byte_t digest[16];
+ BYTE digest[16];
#ifdef _DEBUG
NetLog_Server("Received %s", "ICQ_SIGNON_AUTH_KEY");
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 363a9f2884..07dd17fc0f 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -196,11 +196,11 @@ BYTE* calcMD5HashOfFile(const TCHAR *tszFile) {
long cbFileSize = GetFileSize(hFile, NULL);
- res = (BYTE*)SAFE_MALLOC(16 * sizeof(mir_md5_byte_t));
+ res = (BYTE*)SAFE_MALLOC(16 * sizeof(BYTE));
if (cbFileSize != 0 && res)
{
mir_md5_state_t state;
- mir_md5_byte_t digest[16];
+ BYTE digest[16];
int dwOffset = 0;
mir_md5_init(&state);
@@ -211,12 +211,12 @@ BYTE* calcMD5HashOfFile(const TCHAR *tszFile) if (!(ppMap = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, dwOffset, dwBlockSize)))
break;
- mir_md5_append(&state, (const mir_md5_byte_t *)ppMap, dwBlockSize);
+ mir_md5_append(&state, (const BYTE *)ppMap, dwBlockSize);
UnmapViewOfFile(ppMap);
dwOffset += dwBlockSize;
}
mir_md5_finish(&state, digest);
- memcpy(res, digest, 16 * sizeof(mir_md5_byte_t));
+ memcpy(res, digest, 16 * sizeof(BYTE));
}
}
@@ -1593,10 +1593,10 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt if (pCookieData->hashlen == 0x14 && pCookieData->hash[3] == 0x10 && ppro->getByte("StrictAvatarCheck", DEFAULT_AVATARS_CHECK))
{ // check only standard hashes
mir_md5_state_t state;
- mir_md5_byte_t digest[16];
+ BYTE digest[16];
mir_md5_init(&state);
- mir_md5_append(&state, (const mir_md5_byte_t *)pBuffer, datalen);
+ mir_md5_append(&state, (const BYTE *)pBuffer, datalen);
mir_md5_finish(&state, digest);
// check if received data corresponds to specified hash
if (memcmp(pCookieData->hash+4, digest, 0x10)) aValid = 0;
diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp index fbf8af6138..a1e9a72e26 100644 --- a/protocols/Skype/src/skype_avatars.cpp +++ b/protocols/Skype/src/skype_avatars.cpp @@ -4,7 +4,7 @@ bool CSkypeProto::IsAvatarChanged(const SEBinary &avatar, HANDLE hContact) {
bool result = false;
- ::mir_md5_byte_t digest[16];
+ BYTE digest[16];
::mir_md5_hash((PBYTE)avatar.data(), (int)avatar.size(), digest);
DBVARIANT dbv;
diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index faf8e27e08..f76b238d80 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -34,7 +34,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) }
else
{
- ::mir_md5_byte_t digest[16];
+ BYTE digest[16];
::mir_md5_hash((BYTE*)data.data(), (int)data.size(), digest);
::db_set_blob(hContact, this->m_szModuleName, "AvatarHash", digest, 16);
diff --git a/protocols/Yahoo/src/libyahoo2/crypt.c b/protocols/Yahoo/src/libyahoo2/crypt.c index d8c50a08f6..b54456fd85 100644 --- a/protocols/Yahoo/src/libyahoo2/crypt.c +++ b/protocols/Yahoo/src/libyahoo2/crypt.c @@ -50,7 +50,7 @@ char *yahoo_crypt(char *key, char *salt) int buflen = 0;
int needed = 3 + strlen (salt) + 1 + 26 + 1;
- mir_md5_byte_t alt_result[16];
+ BYTE alt_result[16];
mir_md5_state_t ctx;
mir_md5_state_t alt_ctx;
int salt_len;
@@ -77,29 +77,29 @@ char *yahoo_crypt(char *key, char *salt) mir_md5_init(&ctx);
/* Add the key string. */
- mir_md5_append(&ctx, (mir_md5_byte_t *)key, (int)key_len);
+ mir_md5_append(&ctx, (BYTE *)key, (int)key_len);
/* Because the SALT argument need not always have the salt prefix we
add it separately. */
- mir_md5_append(&ctx, (mir_md5_byte_t *)md5_salt_prefix, sizeof (md5_salt_prefix) - 1);
+ mir_md5_append(&ctx, (BYTE *)md5_salt_prefix, sizeof (md5_salt_prefix) - 1);
/* The last part is the salt string. This must be at most 8
characters and it ends at the first `$' character (for
compatibility which existing solutions). */
- mir_md5_append(&ctx, (mir_md5_byte_t *)salt, (int)salt_len);
+ mir_md5_append(&ctx, (BYTE *)salt, (int)salt_len);
/* Compute alternate MD5 sum with input KEY, SALT, and KEY. The
final result will be added to the first context. */
mir_md5_init(&alt_ctx);
/* Add key. */
- mir_md5_append(&alt_ctx, (mir_md5_byte_t *)key, key_len);
+ mir_md5_append(&alt_ctx, (BYTE *)key, key_len);
/* Add salt. */
- mir_md5_append(&alt_ctx, (mir_md5_byte_t *)salt, salt_len);
+ mir_md5_append(&alt_ctx, (BYTE *)salt, salt_len);
/* Add key again. */
- mir_md5_append(&alt_ctx, (mir_md5_byte_t *)key, key_len);
+ mir_md5_append(&alt_ctx, (BYTE *)key, key_len);
/* Now get result of this (16 bytes) and add it to the other
context. */
@@ -118,7 +118,7 @@ char *yahoo_crypt(char *key, char *salt) bit the first character of the key. This does not seem to be
what was intended but we have to follow this to be compatible. */
for (cnt = key_len; cnt > 0; cnt >>= 1)
- mir_md5_append(&ctx, (cnt & 1) != 0 ? alt_result : (mir_md5_byte_t *)key, 1);
+ mir_md5_append(&ctx, (cnt & 1) != 0 ? alt_result : (BYTE *)key, 1);
/* Create intermediate result. */
mir_md5_finish(&ctx, alt_result);
@@ -132,23 +132,23 @@ char *yahoo_crypt(char *key, char *salt) /* Add key or last result. */
if ((cnt & 1) != 0)
- mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len);
+ mir_md5_append(&ctx, (BYTE *)key, key_len);
else
mir_md5_append(&ctx, alt_result, 16);
/* Add salt for numbers not divisible by 3. */
if (cnt % 3 != 0)
- mir_md5_append(&ctx, (mir_md5_byte_t *)salt, salt_len);
+ mir_md5_append(&ctx, (BYTE *)salt, salt_len);
/* Add key for numbers not divisible by 7. */
if (cnt % 7 != 0)
- mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len);
+ mir_md5_append(&ctx, (BYTE *)key, key_len);
/* Add key or last result. */
if ((cnt & 1) != 0)
mir_md5_append(&ctx, alt_result, 16);
else
- mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len);
+ mir_md5_append(&ctx, (BYTE *)key, key_len);
/* Create intermediate result. */
mir_md5_finish(&ctx, alt_result);
diff --git a/protocols/Yahoo/src/libyahoo2/libyahoo2.c b/protocols/Yahoo/src/libyahoo2/libyahoo2.c index 3da50e7b67..71b0fb4886 100644 --- a/protocols/Yahoo/src/libyahoo2/libyahoo2.c +++ b/protocols/Yahoo/src/libyahoo2/libyahoo2.c @@ -2397,7 +2397,7 @@ static void yahoo_process_auth_0x0f(struct yahoo_input_data *yid, const char *se char *response = NULL;
char url[1024];
char *c, *t;
- mir_md5_byte_t result[16];
+ BYTE result[16];
mir_md5_state_t ctx;
unsigned char *magic_hash = (unsigned char*) malloc(50); /* this one is like 26 bytes? */
int i;
@@ -2657,8 +2657,8 @@ LBL_FAILED: */
mir_md5_init(&ctx);
- mir_md5_append(&ctx, (mir_md5_byte_t *)crumb, strlen(crumb));
- mir_md5_append(&ctx, (mir_md5_byte_t *)seed, strlen(seed));
+ mir_md5_append(&ctx, (BYTE *)crumb, strlen(crumb));
+ mir_md5_append(&ctx, (BYTE *)seed, strlen(seed));
mir_md5_finish(&ctx, result);
to_y64(magic_hash, result, 16);
@@ -6477,17 +6477,17 @@ char *yahoo_ft7dc_send(int id, const char *buddy, YList *files) struct yahoo_packet *pkt = NULL;
char ft_token[32]; // we only need 23 chars actually
YList *l=files;
- mir_md5_byte_t result[16];
+ BYTE result[16];
mir_md5_state_t ctx;
if (!yid)
return NULL;
mir_md5_init(&ctx);
- mir_md5_append(&ctx, (mir_md5_byte_t *)buddy, strlen(buddy));
+ mir_md5_append(&ctx, (BYTE *)buddy, strlen(buddy));
snprintf(ft_token, 32, "%lu", time(NULL));
- mir_md5_append(&ctx, (mir_md5_byte_t *)ft_token, strlen(ft_token));
+ mir_md5_append(&ctx, (BYTE *)ft_token, strlen(ft_token));
mir_md5_finish(&ctx, result);
to_y64((unsigned char *)ft_token, result, 16);
|