summaryrefslogtreecommitdiff
path: root/protocols/Yahoo
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-26 23:41:55 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-26 23:41:55 +0000
commit25221b7d2afb70f82eb3805330fd39a6f6708049 (patch)
tree6fdd3eb5c5642788e1f8286385b15535f9a7ec16 /protocols/Yahoo
parentef81e9edc10e2478f514e1fbfb0828ad1e7d8e49 (diff)
mk: removed all LIST_INTERFACE, MI_INTERFACE & UTF8_INTERFACE instances.
all related functions moved to mir_core. git-svn-id: http://svn.miranda-ng.org/main/trunk@644 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Yahoo')
-rw-r--r--protocols/Yahoo/libyahoo2/config.h12
-rw-r--r--protocols/Yahoo/libyahoo2/crypt.c52
-rw-r--r--protocols/Yahoo/libyahoo2/libyahoo2.c36
-rw-r--r--protocols/Yahoo/main.cpp14
-rw-r--r--protocols/Yahoo/yahoo.h1
5 files changed, 44 insertions, 71 deletions
diff --git a/protocols/Yahoo/libyahoo2/config.h b/protocols/Yahoo/libyahoo2/config.h
index c512971fa6..53ef7ca7cf 100644
--- a/protocols/Yahoo/libyahoo2/config.h
+++ b/protocols/Yahoo/libyahoo2/config.h
@@ -56,16 +56,4 @@
*/
#include <m_utils.h>
-#define md5_byte_t mir_md5_byte_t
-#define md5_state_t mir_md5_state_t
-
-#define md5_init(A) md5i.md5_init(A)
-#define md5_append(A,B,C) md5i.md5_append(A,B,C)
-#define md5_finish(A,B) md5i.md5_finish(A,B)
-
-#define sha1_ctx mir_sha1_ctx
-#define sha1_init(A) sha1i.sha1_init(A)
-#define sha1_append(A,B,C) sha1i.sha1_append(A,B,C)
-#define sha1_finish(A,B) sha1i.sha1_finish(A,B)
-
#endif
diff --git a/protocols/Yahoo/libyahoo2/crypt.c b/protocols/Yahoo/libyahoo2/crypt.c
index d84ecd0644..d8c50a08f6 100644
--- a/protocols/Yahoo/libyahoo2/crypt.c
+++ b/protocols/Yahoo/libyahoo2/crypt.c
@@ -50,9 +50,9 @@ char *yahoo_crypt(char *key, char *salt)
int buflen = 0;
int needed = 3 + strlen (salt) + 1 + 26 + 1;
- md5_byte_t alt_result[16];
- md5_state_t ctx;
- md5_state_t alt_ctx;
+ mir_md5_byte_t alt_result[16];
+ mir_md5_state_t ctx;
+ mir_md5_state_t alt_ctx;
int salt_len;
int key_len;
int cnt;
@@ -74,41 +74,41 @@ char *yahoo_crypt(char *key, char *salt)
key_len = (int)strlen (key);
/* Prepare for the real work. */
- md5_init(&ctx);
+ mir_md5_init(&ctx);
/* Add the key string. */
- md5_append(&ctx, (md5_byte_t *)key, (int)key_len);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)key, (int)key_len);
/* Because the SALT argument need not always have the salt prefix we
add it separately. */
- md5_append(&ctx, (md5_byte_t *)md5_salt_prefix, sizeof (md5_salt_prefix) - 1);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)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). */
- md5_append(&ctx, (md5_byte_t *)salt, (int)salt_len);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)salt, (int)salt_len);
/* Compute alternate MD5 sum with input KEY, SALT, and KEY. The
final result will be added to the first context. */
- md5_init(&alt_ctx);
+ mir_md5_init(&alt_ctx);
/* Add key. */
- md5_append(&alt_ctx, (md5_byte_t *)key, key_len);
+ mir_md5_append(&alt_ctx, (mir_md5_byte_t *)key, key_len);
/* Add salt. */
- md5_append(&alt_ctx, (md5_byte_t *)salt, salt_len);
+ mir_md5_append(&alt_ctx, (mir_md5_byte_t *)salt, salt_len);
/* Add key again. */
- md5_append(&alt_ctx, (md5_byte_t *)key, key_len);
+ mir_md5_append(&alt_ctx, (mir_md5_byte_t *)key, key_len);
/* Now get result of this (16 bytes) and add it to the other
context. */
- md5_finish(&alt_ctx, alt_result);
+ mir_md5_finish(&alt_ctx, alt_result);
/* Add for any character in the key one byte of the alternate sum. */
for (cnt = key_len; cnt > 16; cnt -= 16)
- md5_append(&ctx, alt_result, 16);
- md5_append(&ctx, alt_result, cnt);
+ mir_md5_append(&ctx, alt_result, 16);
+ mir_md5_append(&ctx, alt_result, cnt);
/* For the following code we need a NUL byte. */
alt_result[0] = '\0';
@@ -118,40 +118,40 @@ 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)
- md5_append(&ctx, (cnt & 1) != 0 ? alt_result : (md5_byte_t *)key, 1);
+ mir_md5_append(&ctx, (cnt & 1) != 0 ? alt_result : (mir_md5_byte_t *)key, 1);
/* Create intermediate result. */
- md5_finish(&ctx, alt_result);
+ mir_md5_finish(&ctx, alt_result);
/* Now comes another weirdness. In fear of password crackers here
comes a quite long loop which just processes the output of the
previous round again. We cannot ignore this here. */
for (cnt = 0; cnt < 1000; ++cnt) {
/* New context. */
- md5_init(&ctx);
+ mir_md5_init(&ctx);
/* Add key or last result. */
if ((cnt & 1) != 0)
- md5_append(&ctx, (md5_byte_t *)key, key_len);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len);
else
- md5_append(&ctx, alt_result, 16);
+ mir_md5_append(&ctx, alt_result, 16);
/* Add salt for numbers not divisible by 3. */
if (cnt % 3 != 0)
- md5_append(&ctx, (md5_byte_t *)salt, salt_len);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)salt, salt_len);
/* Add key for numbers not divisible by 7. */
if (cnt % 7 != 0)
- md5_append(&ctx, (md5_byte_t *)key, key_len);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len);
/* Add key or last result. */
if ((cnt & 1) != 0)
- md5_append(&ctx, alt_result, 16);
+ mir_md5_append(&ctx, alt_result, 16);
else
- md5_append(&ctx, (md5_byte_t *)key, key_len);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len);
/* Create intermediate result. */
- md5_finish(&ctx, alt_result);
+ mir_md5_finish(&ctx, alt_result);
}
/* Now we can construct the result string. It consists of three
@@ -196,8 +196,8 @@ char *yahoo_crypt(char *key, char *salt)
attaching to processes or reading core dumps cannot get any
information. We do it in this way to clear correct_words[]
inside the MD5 implementation as well. */
- md5_init(&ctx);
- md5_finish(&ctx, alt_result);
+ mir_md5_init(&ctx);
+ mir_md5_finish(&ctx, alt_result);
memset (&ctx, '\0', sizeof (ctx));
memset (&alt_ctx, '\0', sizeof (alt_ctx));
diff --git a/protocols/Yahoo/libyahoo2/libyahoo2.c b/protocols/Yahoo/libyahoo2/libyahoo2.c
index 77802f4ca2..f51475a5ca 100644
--- a/protocols/Yahoo/libyahoo2/libyahoo2.c
+++ b/protocols/Yahoo/libyahoo2/libyahoo2.c
@@ -2393,14 +2393,14 @@ static void yahoo_process_auth_0x0f(struct yahoo_input_data *yid, const char *se
struct yahoo_data *yd = yid->yd;
struct yahoo_server_settings *yss;
- char *crumb=NULL;
- char *response = NULL;
- char url[1024];
- char *c, *t;
- md5_byte_t result[16];
- md5_state_t ctx;
- unsigned char *magic_hash = (unsigned char*) malloc(50); /* this one is like 26 bytes? */
- int i;
+ char *crumb=NULL;
+ char *response = NULL;
+ char url[1024];
+ char *c, *t;
+ mir_md5_byte_t result[16];
+ mir_md5_state_t ctx;
+ unsigned char *magic_hash = (unsigned char*) malloc(50); /* this one is like 26 bytes? */
+ int i;
/**
case 2: Totally Cracked... Yay.. no more crypt tables.. just need some SSL magic.
@@ -2655,11 +2655,11 @@ LBL_FAILED:
278:z=xUvdFBxaEeFBfOaVlmk3RSXNDMxBjU2MjQyNjFPNTE-&a=QAE&sk=DAAWDRZBoXexNr&d=c2wBTXpRMkFUSXhOVE0xTVRZNE1qWS0BYQFRQUUBenoBeFV2ZEZCZ1dBAXRpcAFNSVlVN0Q-; path=/; domain=.yahoo.com
307:VATg29jzHSXlp_2LL7J4Fw--
*/
- md5_init(&ctx);
+ mir_md5_init(&ctx);
- md5_append(&ctx, (md5_byte_t *)crumb, strlen(crumb));
- md5_append(&ctx, (md5_byte_t *)seed, strlen(seed));
- md5_finish(&ctx, result);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)crumb, strlen(crumb));
+ mir_md5_append(&ctx, (mir_md5_byte_t *)seed, strlen(seed));
+ mir_md5_finish(&ctx, result);
to_y64(magic_hash, result, 16);
LOG(("Y64 Hash: %s", magic_hash));
@@ -6477,18 +6477,18 @@ 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;
- md5_byte_t result[16];
- md5_state_t ctx;
+ mir_md5_byte_t result[16];
+ mir_md5_state_t ctx;
if (!yid)
return NULL;
- md5_init(&ctx);
- md5_append(&ctx, (md5_byte_t *)buddy, strlen(buddy));
+ mir_md5_init(&ctx);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)buddy, strlen(buddy));
snprintf(ft_token, 32, "%lu", time(NULL));
- md5_append(&ctx, (md5_byte_t *)ft_token, strlen(ft_token));
- md5_finish(&ctx, result);
+ mir_md5_append(&ctx, (mir_md5_byte_t *)ft_token, strlen(ft_token));
+ mir_md5_finish(&ctx, result);
to_y64((unsigned char *)ft_token, result, 16);
yd = yid->yd;
diff --git a/protocols/Yahoo/main.cpp b/protocols/Yahoo/main.cpp
index 6f37098361..222c4d6723 100644
--- a/protocols/Yahoo/main.cpp
+++ b/protocols/Yahoo/main.cpp
@@ -25,10 +25,6 @@ PLUGINLINK* pluginLink;
HANDLE g_hNetlibUser;
-MM_INTERFACE mmi;
-UTF8_INTERFACE utfi;
-MD5_INTERFACE md5i;
-LIST_INTERFACE li;
int hLangpack;
PLUGININFOEX pluginInfo={
@@ -106,16 +102,6 @@ extern "C" int __declspec(dllexport)Load(PLUGINLINK *link)
/**
* Grab the interface handles (through pluginLink)
*/
- int i = mir_getLI( &li );
-
- if (i) {
- MessageBox(NULL, _T("Can not retrieve the core List Interface."), _T("Yahoo Plugin Load Failed"), MB_ICONERROR | MB_OK);
- return 1;
- }
-
- mir_getMMI( &mmi );
- mir_getUTFI( &utfi );
- mir_getMD5I( &md5i );
mir_getLP( &pluginInfo );
PROTOCOLDESCRIPTOR pd = { 0 };
diff --git a/protocols/Yahoo/yahoo.h b/protocols/Yahoo/yahoo.h
index ec11ecb520..552f40cc46 100644
--- a/protocols/Yahoo/yahoo.h
+++ b/protocols/Yahoo/yahoo.h
@@ -17,7 +17,6 @@
extern "C"
{
- extern struct MD5_INTERFACE md5i;
extern struct tagPLUGINLINK* pluginLink;
};