X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fchap_ms.c;h=0a5c126159b71c304daea125b46558992909104c;hp=ae8ab1d461660fdaca14281d9b4a27d43ba924f6;hb=24af3d4d6dbf452f8acaa1a15a9e08f96a0e6eb2;hpb=267d970c5b322243e4efe12c41bed3a420380774 diff --git a/pppd/chap_ms.c b/pppd/chap_ms.c index ae8ab1d..0a5c126 100644 --- a/pppd/chap_ms.c +++ b/pppd/chap_ms.c @@ -32,19 +32,20 @@ */ #ifndef lint -static char rcsid[] = "$Id: chap_ms.c,v 1.7 1998/03/25 03:08:14 paulus Exp $"; +static char rcsid[] = "$Id: chap_ms.c,v 1.12 1998/11/24 19:38:05 christos Exp $"; #endif #ifdef CHAPMS #include +#include #include #include #include #include #include #include -#ifdef USE_CRYPT +#ifdef HAVE_CRYPT_H #include #endif @@ -80,6 +81,11 @@ static void Expand __P((u_char *, u_char *)); static void Collapse __P((u_char *, u_char *)); #endif +#ifdef MSLANMAN +bool ms_lanman = 0; /* Use LanMan password instead of NT */ + /* Has meaning only with MS-CHAP challenges */ +#endif + static void ChallengeResponse(challenge, pwHash, response) u_char *challenge; /* IN 8 octets */ @@ -255,6 +261,12 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response) MS_ChapResponse *response; { int i; +#ifdef __NetBSD__ + /* NetBSD uses the libc md4 routines which take bytes instead of bits */ + int mdlen = secret_len * 2; +#else + int mdlen = secret_len * 2 * 8; +#endif MD4_CTX md4Context; u_char hash[MD4_SIGNATURE_SIZE]; u_char unicodePassword[MAX_NT_PASSWORD * 2]; @@ -266,7 +278,7 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response) unicodePassword[i * 2] = (u_char)secret[i]; MD4Init(&md4Context); - MD4Update(&md4Context, unicodePassword, secret_len * 2 * 8); /* Unicode is 2 bytes/char, *8 for bit count */ + MD4Update(&md4Context, unicodePassword, mdlen); MD4Final(hash, &md4Context); /* Tell MD4 we're done */ @@ -307,9 +319,6 @@ ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len) int secret_len; { MS_ChapResponse response; -#ifdef MSLANMAN - extern int ms_lanman; -#endif #if 0 CHAPDEBUG((LOG_INFO, "ChapMS: secret is '%.*s'", secret_len, secret));