Mercurial > pidgin.yaz
comparison src/protocols/yahoo/yahoo.c @ 11183:8dca96cbcd64
[gaim-migrate @ 13295]
I changed the cipher API to use guchar instead of guint8
This seems to be what gtk/glib uses for random bits of data
I don't know what got into me
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 03 Aug 2005 02:57:00 +0000 |
parents | 5d103f550f6a |
children | 12fc7a3fbc88 |
comparison
equal
deleted
inserted
replaced
11182:5389d7d497ce | 11183:8dca96cbcd64 |
---|---|
1099 sv = sv % 8; | 1099 sv = sv % 8; |
1100 | 1100 |
1101 cipher = gaim_ciphers_find_cipher("md5"); | 1101 cipher = gaim_ciphers_find_cipher("md5"); |
1102 context = gaim_cipher_context_new(cipher, NULL); | 1102 context = gaim_cipher_context_new(cipher, NULL); |
1103 | 1103 |
1104 gaim_cipher_context_append(context, (const guint8 *)pass, strlen(pass)); | 1104 gaim_cipher_context_append(context, (const guchar *)pass, strlen(pass)); |
1105 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 1105 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); |
1106 | 1106 |
1107 to_y64(password_hash, digest, 16); | 1107 to_y64(password_hash, digest, 16); |
1108 | 1108 |
1109 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$"); | 1109 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$"); |
1110 | 1110 |
1111 gaim_cipher_context_reset(context, NULL); | 1111 gaim_cipher_context_reset(context, NULL); |
1112 gaim_cipher_context_append(context, (const guint8 *)crypt_result, strlen(crypt_result)); | 1112 gaim_cipher_context_append(context, (const guchar *)crypt_result, strlen(crypt_result)); |
1113 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 1113 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); |
1114 to_y64(crypt_hash, digest, 16); | 1114 to_y64(crypt_hash, digest, 16); |
1115 | 1115 |
1116 switch (sv) { | 1116 switch (sv) { |
1117 case 1: | 1117 case 1: |
1153 "%c%s%s%s", checksum, crypt_hash, name, seed); | 1153 "%c%s%s%s", checksum, crypt_hash, name, seed); |
1154 break; | 1154 break; |
1155 } | 1155 } |
1156 | 1156 |
1157 gaim_cipher_context_reset(context, NULL); | 1157 gaim_cipher_context_reset(context, NULL); |
1158 gaim_cipher_context_append(context, (const guint8 *)hash_string_p, strlen(hash_string_p)); | 1158 gaim_cipher_context_append(context, (const guchar *)hash_string_p, strlen(hash_string_p)); |
1159 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 1159 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); |
1160 to_y64(result6, digest, 16); | 1160 to_y64(result6, digest, 16); |
1161 | 1161 |
1162 gaim_cipher_context_reset(context, NULL); | 1162 gaim_cipher_context_reset(context, NULL); |
1163 gaim_cipher_context_append(context, (const guint8 *)hash_string_c, strlen(hash_string_c)); | 1163 gaim_cipher_context_append(context, (const guchar *)hash_string_c, strlen(hash_string_c)); |
1164 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 1164 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); |
1165 gaim_cipher_context_destroy(context); | 1165 gaim_cipher_context_destroy(context); |
1166 to_y64(result96, digest, 16); | 1166 to_y64(result96, digest, 16); |
1167 | 1167 |
1168 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); | 1168 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); |
1417 magic_key_char[3] = (updated_key >> 24) & 0xff; | 1417 magic_key_char[3] = (updated_key >> 24) & 0xff; |
1418 } | 1418 } |
1419 | 1419 |
1420 /* Get password and crypt hashes as per usual. */ | 1420 /* Get password and crypt hashes as per usual. */ |
1421 gaim_cipher_context_reset(md5_ctx, NULL); | 1421 gaim_cipher_context_reset(md5_ctx, NULL); |
1422 gaim_cipher_context_append(md5_ctx, (const guint8 *)pass, strlen(pass)); | 1422 gaim_cipher_context_append(md5_ctx, (const guchar *)pass, strlen(pass)); |
1423 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest), | 1423 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest), |
1424 md5_digest, NULL); | 1424 md5_digest, NULL); |
1425 to_y64(password_hash, md5_digest, 16); | 1425 to_y64(password_hash, md5_digest, 16); |
1426 | 1426 |
1427 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$"); | 1427 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$"); |
1428 gaim_cipher_context_reset(md5_ctx, NULL); | 1428 gaim_cipher_context_reset(md5_ctx, NULL); |
1429 gaim_cipher_context_append(md5_ctx, (const guint8 *)crypt_result, strlen(crypt_result)); | 1429 gaim_cipher_context_append(md5_ctx, (const guchar *)crypt_result, strlen(crypt_result)); |
1430 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest), | 1430 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest), |
1431 md5_digest, NULL); | 1431 md5_digest, NULL); |
1432 to_y64(crypt_hash, md5_digest, 16); | 1432 to_y64(crypt_hash, md5_digest, 16); |
1433 | 1433 |
1434 /* Our first authentication response is based off of the password hash. */ | 1434 /* Our first authentication response is based off of the password hash. */ |
2329 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); | 2329 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); |
2330 char md5[33], *hashp = md5, *chal; | 2330 char md5[33], *hashp = md5, *chal; |
2331 int i; | 2331 int i; |
2332 GaimCipher *cipher; | 2332 GaimCipher *cipher; |
2333 GaimCipherContext *context; | 2333 GaimCipherContext *context; |
2334 guint8 digest[16]; | 2334 guchar digest[16]; |
2335 | 2335 |
2336 url = g_string_append(url, sn); | 2336 url = g_string_append(url, sn); |
2337 url = g_string_append(url, "&passwd="); | 2337 url = g_string_append(url, "&passwd="); |
2338 | 2338 |
2339 cipher = gaim_ciphers_find_cipher("md5"); | 2339 cipher = gaim_ciphers_find_cipher("md5"); |
2340 context = gaim_cipher_context_new(cipher, NULL); | 2340 context = gaim_cipher_context_new(cipher, NULL); |
2341 | 2341 |
2342 gaim_cipher_context_append(context, (const guint8 *)pass, strlen(pass)); | 2342 gaim_cipher_context_append(context, (const guchar *)pass, strlen(pass)); |
2343 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 2343 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); |
2344 for (i = 0; i < 16; ++i) { | 2344 for (i = 0; i < 16; ++i) { |
2345 g_snprintf(hashp, 3, "%02x", digest[i]); | 2345 g_snprintf(hashp, 3, "%02x", digest[i]); |
2346 hashp += 2; | 2346 hashp += 2; |
2347 } | 2347 } |
2348 | 2348 |
2349 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); | 2349 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); |
2350 gaim_cipher_context_reset(context, NULL); | 2350 gaim_cipher_context_reset(context, NULL); |
2351 gaim_cipher_context_append(context, (const guint8 *)chal, strlen(chal)); | 2351 gaim_cipher_context_append(context, (const guchar *)chal, strlen(chal)); |
2352 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 2352 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); |
2353 hashp = md5; | 2353 hashp = md5; |
2354 for (i = 0; i < 16; ++i) { | 2354 for (i = 0; i < 16; ++i) { |
2355 g_snprintf(hashp, 3, "%02x", digest[i]); | 2355 g_snprintf(hashp, 3, "%02x", digest[i]); |
2356 hashp += 2; | 2356 hashp += 2; |