From 9e1e5b0e4e95cf70196ba2383d371b41d4731a44 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Eivind=20N=C3=A6ss?= Date: Wed, 28 Jul 2021 16:39:43 -0700 Subject: [PATCH] Using OpenSSL for MD4 isn't compatibile how NTPasswordHash is using it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Eivind Næss --- pppd/chap_ms.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pppd/chap_ms.c b/pppd/chap_ms.c index 52d4890..2f31bb5 100644 --- a/pppd/chap_ms.c +++ b/pppd/chap_ms.c @@ -569,7 +569,7 @@ 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__ +#if defined(__NetBSD__) || !defined(USE_MD4) /* NetBSD uses the libc md4 routines which take bytes instead of bits */ int mdlen = secret_len; #else @@ -578,12 +578,14 @@ NTPasswordHash(u_char *secret, int secret_len, u_char hash[MD4_SIGNATURE_SIZE]) MD4_CTX md4Context; MD4Init(&md4Context); - /* MD4Update can take at most 64 bytes at a time */ +#if !defined(USE_MD4) + /* Internal MD4Update can take at most 64 bytes at a time */ while (mdlen > 512) { MD4Update(&md4Context, secret, 512); secret += 64; mdlen -= 512; } +#endif MD4Update(&md4Context, secret, mdlen); MD4Final(hash, &md4Context); -- 2.39.2