libpurple/protocols/jabber/jutil.c

branch
soc.2013.gobjectification
changeset 34567
ea5103f66b0e
parent 34556
087db73b115d
child 34889
4ea2da14cd0e
equal deleted inserted replaced
34566:e0f887dee077 34567:ea5103f66b0e
30 30
31 #include "chat.h" 31 #include "chat.h"
32 #include "presence.h" 32 #include "presence.h"
33 #include "jutil.h" 33 #include "jutil.h"
34 34
35 #include "ciphers/md4.h" 35 #include "ciphers/md4hash.h"
36 #include "ciphers/md5.h" 36 #include "ciphers/md5hash.h"
37 #include "ciphers/sha1.h" 37 #include "ciphers/sha1hash.h"
38 38
39 #ifdef USE_IDN 39 #ifdef USE_IDN
40 #include <idna.h> 40 #include <idna.h>
41 #include <stringprep.h> 41 #include <stringprep.h>
42 static char idn_buffer[1024]; 42 static char idn_buffer[1024];
737 737
738 char * 738 char *
739 jabber_calculate_data_hash(gconstpointer data, size_t len, 739 jabber_calculate_data_hash(gconstpointer data, size_t len,
740 const gchar *hash_algo) 740 const gchar *hash_algo)
741 { 741 {
742 PurpleCipher *hash = NULL; 742 PurpleHash *hash = NULL;
743 static gchar digest[129]; /* 512 bits hex + \0 */ 743 static gchar digest[129]; /* 512 bits hex + \0 */
744 744
745 /* FIXME: Check the source of this change and what we need here... */ 745 /* FIXME: Check the source of this change and what we need here... */
746 if (g_str_equal(hash_algo, "sha1")) 746 if (g_str_equal(hash_algo, "sha1"))
747 hash = purple_sha1_cipher_new(); 747 hash = purple_sha1_hash_new();
748 else if (g_str_equal(hash_algo, "md4")) 748 else if (g_str_equal(hash_algo, "md4"))
749 hash = purple_md4_cipher_new(); 749 hash = purple_md4_hash_new();
750 else if (g_str_equal(hash_algo, "md5")) 750 else if (g_str_equal(hash_algo, "md5"))
751 hash = purple_md5_cipher_new(); 751 hash = purple_md5_hash_new();
752 if (hash == NULL) 752 if (hash == NULL)
753 { 753 {
754 purple_debug_error("jabber", "Could not find %s cipher\n", hash_algo); 754 purple_debug_error("jabber", "Could not find %s cipher\n", hash_algo);
755 g_return_val_if_reached(NULL); 755 g_return_val_if_reached(NULL);
756 } 756 }
757 757
758 /* Hash the data */ 758 /* Hash the data */
759 purple_cipher_append(hash, data, len); 759 purple_hash_append(hash, data, len);
760 if (!purple_cipher_digest_to_str(hash, digest, sizeof(digest))) 760 if (!purple_hash_digest_to_str(hash, digest, sizeof(digest)))
761 { 761 {
762 purple_debug_error("jabber", "Failed to get digest for %s cipher.\n", 762 purple_debug_error("jabber", "Failed to get digest for %s cipher.\n",
763 hash_algo); 763 hash_algo);
764 g_return_val_if_reached(NULL); 764 g_return_val_if_reached(NULL);
765 } 765 }

mercurial