diff options
Diffstat (limited to 'libpurple/ntlm.c')
-rw-r--r-- | libpurple/ntlm.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/libpurple/ntlm.c b/libpurple/ntlm.c index 82a865c9b4..0934d92a33 100644 --- a/libpurple/ntlm.c +++ b/libpurple/ntlm.c @@ -28,8 +28,11 @@ #include "util.h" #include "ntlm.h" -#include "cipher.h" #include "debug.h" + +#include "ciphers/descipher.h" +#include "ciphers/md4hash.h" + #include <string.h> #define NTLM_NEGOTIATE_NTLM2_KEY 0x00080000 @@ -191,13 +194,11 @@ static void des_ecb_encrypt(const guint8 *plaintext, guint8 *result, const guint8 *key) { PurpleCipher *cipher; - PurpleCipherContext *context; - cipher = purple_ciphers_find_cipher("des"); - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_set_key(context, key, 8); - purple_cipher_context_encrypt(context, plaintext, 8, result, 8); - purple_cipher_context_destroy(context); + cipher = purple_des_cipher_new(); + purple_cipher_set_key(cipher, key, 8); + purple_cipher_encrypt(cipher, plaintext, 8, result, 8); + g_object_unref(cipher); } /* @@ -273,8 +274,7 @@ purple_ntlm_gen_type3(const gchar *username, const gchar *passw, const gchar *ho unsigned char magic[] = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 }; unsigned char nt_hpw[21]; char nt_pw[128]; - PurpleCipher *cipher; - PurpleCipherContext *context; + PurpleHash *hash; char *tmp; int idx; gchar *ucs2le; @@ -375,11 +375,10 @@ purple_ntlm_gen_type3(const gchar *username, const gchar *passw, const gchar *ho nt_pw[2 * idx + 1] = 0; } - cipher = purple_ciphers_find_cipher("md4"); - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, (guint8 *)nt_pw, 2 * lennt); - purple_cipher_context_digest(context, nt_hpw, sizeof(nt_hpw)); - purple_cipher_context_destroy(context); + hash = purple_md4_hash_new(); + purple_hash_append(hash, (guint8 *)nt_pw, 2 * lennt); + purple_hash_digest(hash, nt_hpw, sizeof(nt_hpw)); + g_object_unref(hash); memset(nt_hpw + 16, 0, 5); calc_resp(nt_hpw, nonce, nt_resp); |