summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-06-29 22:04:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-06-29 22:04:45 +0000
commit2235761a3b73f67f5b425b465d3528b98c74e829 (patch)
tree9dc524c8f9489cfc541be8f3f32cd37e04091b2c /usr.sbin
parent79b6ed55d038fb662433df4fb561d440a1a75c8f (diff)
Fix MS chap; our libc md4 routines take the number of bytes, not bits,
as the count. Found by Mike Tekiela.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pppd/chap_ms.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/pppd/chap_ms.c b/usr.sbin/pppd/chap_ms.c
index 06bdf932127..f808f09477e 100644
--- a/usr.sbin/pppd/chap_ms.c
+++ b/usr.sbin/pppd/chap_ms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chap_ms.c,v 1.8 2003/06/11 23:33:29 deraadt Exp $ */
+/* $OpenBSD: chap_ms.c,v 1.9 2004/06/29 22:04:44 millert Exp $ */
/*
* chap_ms.c - Microsoft MS-CHAP compatible implementation.
@@ -45,7 +45,7 @@
#if 0
static char rcsid[] = "Id: chap_ms.c,v 1.8 1998/04/01 00:15:43 paulus Exp $";
#else
-static char rcsid[] = "$OpenBSD: chap_ms.c,v 1.8 2003/06/11 23:33:29 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: chap_ms.c,v 1.9 2004/06/29 22:04:44 millert Exp $";
#endif
#endif
@@ -280,8 +280,11 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response)
unicodePassword[i * 2] = (u_char)secret[i];
MD4Init(&md4Context);
+#ifdef __OpenBSD__
+ MD4Update(&md4Context, unicodePassword, secret_len * 2); /* Unicode is 2 bytes/char */
+#else
MD4Update(&md4Context, unicodePassword, secret_len * 2 * 8); /* Unicode is 2 bytes/char, *8 for bit count */
-
+#endif
MD4Final(hash, &md4Context); /* Tell MD4 we're done */
ChallengeResponse(rchallenge, hash, response->NTResp);