summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Butter <tbutter@users.sourceforge.net>2006-01-08 20:54:57 +0000
committerThomas Butter <tbutter@users.sourceforge.net>2006-01-08 20:54:57 +0000
commit15bad68dd224f4e6639bfc8514e6473c7dd90bfb (patch)
tree9654351cb4c416ae4ad2392403527fe9ae17042e
parent7de7e17c3efecec72dcea31557ecd2b201303a61 (diff)
downloadpidgin-15bad68dd224f4e6639bfc8514e6473c7dd90bfb.tar.gz
[gaim-migrate @ 15112]
sf patch #1398385, from Thomas Butter "gaim_cipher_context_digest(ctx, sizeof(response), response, NULL); sizeof(response) is always 4 (its a pointer) and thus digest fails. The patch also cleans up a bit in that function." committer: Mark Doliner <markdoliner@pidgin.im>
-rw-r--r--src/proxy.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/proxy.c b/src/proxy.c
index 9352053bc2..39d18bdec1 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1558,25 +1558,23 @@ static void hmacmd5_chap(const unsigned char * challenge, int challen, const cha
unsigned char Kxoripad[65];
unsigned char Kxoropad[65];
int pwlen;
- char * pwinput;
- guchar md5buf[16];
cipher = gaim_ciphers_find_cipher("md5");
ctx = gaim_cipher_context_new(cipher, NULL);
- pwinput=(char *)passwd;
+ memset(Kxoripad,0,sizeof(Kxoripad));
+ memset(Kxoropad,0,sizeof(Kxoropad));
+
pwlen=strlen(passwd);
if (pwlen>64) {
gaim_cipher_context_append(ctx, (const guchar *)passwd, strlen(passwd));
- gaim_cipher_context_digest(ctx, sizeof(md5buf), md5buf, NULL);
- pwinput=(char *)md5buf;
+ gaim_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL);
pwlen=16;
+ } else {
+ memcpy(Kxoripad, passwd, pwlen);
}
+ memcpy(Kxoropad,Kxoripad,pwlen);
- memset(Kxoripad,0,sizeof(Kxoripad));
- memset(Kxoropad,0,sizeof(Kxoropad));
- memcpy(Kxoripad,pwinput,pwlen);
- memcpy(Kxoropad,pwinput,pwlen);
for (i=0;i<64;i++) {
Kxoripad[i]^=0x36;
Kxoropad[i]^=0x5c;
@@ -1590,7 +1588,7 @@ static void hmacmd5_chap(const unsigned char * challenge, int challen, const cha
gaim_cipher_context_reset(ctx, NULL);
gaim_cipher_context_append(ctx, Kxoropad, 64);
gaim_cipher_context_append(ctx, Kxoripad, 16);
- gaim_cipher_context_digest(ctx, sizeof(response), response, NULL);
+ gaim_cipher_context_digest(ctx, 16, response, NULL);
gaim_cipher_context_destroy(ctx);
}