fixed MS-CHAP and MS-CHAP-V2, MD4 polarssl uses bytes as input length, not bits

This commit is contained in:
Sylvain Rochet 2012-05-21 22:26:20 +02:00
parent 0289055948
commit 4c1b507c07

View File

@ -520,24 +520,11 @@ ascii2unicode(char ascii[], int ascii_len, u_char unicode[])
static void
NTPasswordHash(u_char *secret, int secret_len, u_char hash[MD4_SIGNATURE_SIZE])
{
#ifdef __NetBSD__
/* NetBSD uses the libc md4 routines which take bytes instead of bits */
int mdlen = secret_len;
#else
int mdlen = secret_len * 8;
#endif
md4_context md4Context;
md4_starts(&md4Context);
/* MD4Update can take at most 64 bytes at a time */
while (mdlen > 512) {
md4_update(&md4Context, secret, 512);
secret += 64;
mdlen -= 512;
}
md4_update(&md4Context, secret, mdlen);
md4_update(&md4Context, secret, secret_len);
md4_finish(&md4Context, hash);
}
static void