comparison src/protocols/msn/notification.c @ 10684:72a5babfa8b4

[gaim-migrate @ 12231] the cipher api that grim has been working on for ages is finally done!! big congrats and thanks to him!! lots of modified files in this commit. it builds here. moved the md5 files to src/protocols/oscar so that it continues to depend on nothing in gaim. everything else uses the new centralized cipher api. I'm not sure if src/md5.* needs to be removed or not, so I left it there. someone let me know or do it directly. someone check if these need to be added to potfiles.in and let there be much rejoicing! committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 11 Mar 2005 13:05:31 +0000
parents 7d13c04387ad
children b256ce6b85b8
comparison
equal deleted inserted replaced
10683:e11f3e1599d4 10684:72a5babfa8b4
401 chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 401 chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
402 { 402 {
403 MsnTransaction *trans; 403 MsnTransaction *trans;
404 char buf[33]; 404 char buf[33];
405 const char *challenge_resp; 405 const char *challenge_resp;
406 md5_state_t st; 406 GaimCipher *cipher;
407 md5_byte_t di[16]; 407 GaimCipherContext *context;
408 guint8 digest[16];
408 int i; 409 int i;
409 410
410 md5_init(&st); 411 cipher = gaim_ciphers_find_cipher("md5");
411 md5_append(&st, (const md5_byte_t *)cmd->params[1], 412 context = gaim_cipher_context_new(cipher, NULL);
412 strlen(cmd->params[1])); 413
414 gaim_cipher_context_append(context, cmd->params[1],
415 strlen(cmd->params[1]));
413 416
414 challenge_resp = "VT6PX?UQTM4WM%YR"; 417 challenge_resp = "VT6PX?UQTM4WM%YR";
415 418
416 md5_append(&st, (const md5_byte_t *)challenge_resp, 419 gaim_cipher_context_append(context, challenge_resp,
417 strlen(challenge_resp)); 420 strlen(challenge_resp));
418 md5_finish(&st, di); 421 gaim_cipher_context_digest(context, NULL, digest);
422 gaim_cipher_context_destroy(context);
419 423
420 for (i = 0; i < 16; i++) 424 for (i = 0; i < 16; i++)
421 g_snprintf(buf + (i*2), 3, "%02x", di[i]); 425 g_snprintf(buf + (i*2), 3, "%02x", digest[i]);
422 426
423 trans = msn_transaction_new(cmdproc, "QRY", "%s 32", "PROD0038W!61ZTF9"); 427 trans = msn_transaction_new(cmdproc, "QRY", "%s 32", "PROD0038W!61ZTF9");
424 428
425 msn_transaction_set_payload(trans, buf, 32); 429 msn_transaction_set_payload(trans, buf, 32);
426 430
880 { 884 {
881 MsnSession *session; 885 MsnSession *session;
882 GaimAccount *account; 886 GaimAccount *account;
883 const char *rru; 887 const char *rru;
884 const char *url; 888 const char *url;
885 md5_state_t st; 889 GaimCipher *cipher;
886 md5_byte_t di[16]; 890 GaimCipherContext *context;
891 guint8 digest[16];
887 FILE *fd; 892 FILE *fd;
888 char buf[2048]; 893 char buf[2048];
889 char buf2[3]; 894 char buf2[3];
890 char sendbuf[64]; 895 char sendbuf[64];
891 int i; 896 int i;
899 g_snprintf(buf, sizeof(buf), "%s%lu%s", 904 g_snprintf(buf, sizeof(buf), "%s%lu%s",
900 session->passport_info.mspauth, 905 session->passport_info.mspauth,
901 time(NULL) - session->passport_info.sl, 906 time(NULL) - session->passport_info.sl,
902 gaim_account_get_password(account)); 907 gaim_account_get_password(account));
903 908
904 md5_init(&st); 909 cipher = gaim_ciphers_find_cipher("md5");
905 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); 910 context = gaim_cipher_context_new(cipher, NULL);
906 md5_finish(&st, di); 911
912 gaim_cipher_context_append(context, buf, strlen(buf));
913 gaim_cipher_context_digest(context, NULL, digest);
914 gaim_cipher_context_destroy(context);
907 915
908 memset(sendbuf, 0, sizeof(sendbuf)); 916 memset(sendbuf, 0, sizeof(sendbuf));
909 917
910 for (i = 0; i < 16; i++) 918 for (i = 0; i < 16; i++)
911 { 919 {
912 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); 920 g_snprintf(buf2, sizeof(buf2), "%02x", digest[i]);
913 strcat(sendbuf, buf2); 921 strcat(sendbuf, buf2);
914 } 922 }
915 923
916 if (session->passport_info.file != NULL) 924 if (session->passport_info.file != NULL)
917 { 925 {