X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fchap_ms.c;h=ae8ab1d461660fdaca14281d9b4a27d43ba924f6;hp=c46ca13f7022eb0f4d3871284286eaa9fd2a7de5;hb=fc6ee88da5baa928aab7603db5e502dc4c4af44e;hpb=2b18ef2f6444c3d18a511de6248f0dbe76cd5356 diff --git a/pppd/chap_ms.c b/pppd/chap_ms.c index c46ca13..ae8ab1d 100644 --- a/pppd/chap_ms.c +++ b/pppd/chap_ms.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: chap_ms.c,v 1.5 1997/11/27 06:08:10 paulus Exp $"; +static char rcsid[] = "$Id: chap_ms.c,v 1.7 1998/03/25 03:08:14 paulus Exp $"; #endif #ifdef CHAPMS @@ -44,6 +44,9 @@ static char rcsid[] = "$Id: chap_ms.c,v 1.5 1997/11/27 06:08:10 paulus Exp $"; #include #include #include +#ifdef USE_CRYPT +#include +#endif #include "pppd.h" #include "chap.h" @@ -253,9 +256,8 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response) { int i; MD4_CTX md4Context; - u_short hash[MD4_SIGNATURE_SIZE/sizeof(u_short)]; + u_char hash[MD4_SIGNATURE_SIZE]; u_char unicodePassword[MAX_NT_PASSWORD * 2]; - static int low_byte_first = -1; /* Initialize the Unicode version of the secret (== password). */ /* This implicitly supports 8-bit ISO8859/1 characters. */ @@ -266,16 +268,9 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response) MD4Init(&md4Context); MD4Update(&md4Context, unicodePassword, secret_len * 2 * 8); /* Unicode is 2 bytes/char, *8 for bit count */ - MD4Final((u_char *) hash, &md4Context); /* Tell MD4 we're done */ - - if (low_byte_first == -1) - low_byte_first = (htons((unsigned short int)1) != 1); - if (low_byte_first == 0) { - for (i = 0; i < MD4_SIGNATURE_SIZE; i += sizeof(u_short)) - hash[i] = htons(hash[i]); - } + MD4Final(hash, &md4Context); /* Tell MD4 we're done */ - ChallengeResponse(rchallenge, (u_char *)hash, response->NTResp); + ChallengeResponse(rchallenge, hash, response->NTResp); } #ifdef MSLANMAN