summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-03-21 18:01:50 +0000
committerpeter <peter@FreeBSD.org>1998-03-21 18:01:50 +0000
commit05306d256836dac6fb20c72e5e35f6a546e0135e (patch)
treec2f8853dcfb252a4a4bd8238286e97426d82eeca /usr.sbin
parent8f0a0f9c29655b25dcc0b10c2eb21ffda94642b9 (diff)
downloadFreeBSD-src-05306d256836dac6fb20c72e5e35f6a546e0135e.zip
FreeBSD-src-05306d256836dac6fb20c72e5e35f6a546e0135e.tar.gz
Import pppd from ppp-2.3.3 onto the vendor branch (on 1.1.2 hopefully)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pppd/chap_ms.c34
-rw-r--r--usr.sbin/pppd/chap_ms.h3
-rw-r--r--usr.sbin/pppd/demand.c4
3 files changed, 24 insertions, 17 deletions
diff --git a/usr.sbin/pppd/chap_ms.c b/usr.sbin/pppd/chap_ms.c
index 89f95b5..db6f4cf 100644
--- a/usr.sbin/pppd/chap_ms.c
+++ b/usr.sbin/pppd/chap_ms.c
@@ -32,15 +32,18 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: chap_ms.c,v 1.4 1997/05/22 06:46:19 paulus Exp $";
+static char rcsid[] = "$Id: chap_ms.c,v 1.5 1997/11/27 06:08:10 paulus Exp $";
#endif
#ifdef CHAPMS
#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
#include <sys/types.h>
#include <sys/time.h>
#include <syslog.h>
+#include <unistd.h>
#include "pppd.h"
#include "chap.h"
@@ -60,8 +63,14 @@ typedef struct {
in case this struct gets padded. */
+static void ChallengeResponse __P((u_char *, u_char *, u_char *));
static void DesEncrypt __P((u_char *, u_char *, u_char *));
static void MakeKey __P((u_char *, u_char *));
+static u_char Get7Bits __P((u_char *, int));
+static void ChapMS_NT __P((char *, int, char *, int, MS_ChapResponse *));
+#ifdef MSLANMAN
+static void ChapMS_LANMan __P((char *, int, char *, int, MS_ChapResponse *));
+#endif
#ifdef USE_CRYPT
static void Expand __P((u_char *, u_char *));
@@ -77,7 +86,7 @@ ChallengeResponse(challenge, pwHash, response)
char ZPasswordHash[21];
BZERO(ZPasswordHash, sizeof(ZPasswordHash));
- BCOPY(pwHash, ZPasswordHash, 16);
+ BCOPY(pwHash, ZPasswordHash, MD4_SIGNATURE_SIZE);
#if 0
log_packet(ZPasswordHash, sizeof(ZPasswordHash), "ChallengeResponse - ZPasswordHash", LOG_DEBUG);
@@ -243,7 +252,8 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response)
MS_ChapResponse *response;
{
int i;
- MDstruct md4Context;
+ MD4_CTX md4Context;
+ u_char hash[MD4_SIGNATURE_SIZE];
u_char unicodePassword[MAX_NT_PASSWORD * 2];
static int low_byte_first = -1;
@@ -253,23 +263,19 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response)
for (i = 0; i < secret_len; i++)
unicodePassword[i * 2] = (u_char)secret[i];
- MDbegin(&md4Context);
- MDupdate(&md4Context, unicodePassword, secret_len * 2 * 8); /* Unicode is 2 bytes/char, *8 for bit count */
+ MD4Init(&md4Context);
+ MD4Update(&md4Context, unicodePassword, secret_len * 2 * 8); /* Unicode is 2 bytes/char, *8 for bit count */
- if (low_byte_first == -1)
- low_byte_first = (htons((unsigned short int)1) != 1);
- if (low_byte_first == 0)
- MDreverse(&md4Context); /* sfb 961105 */
+ MD4Final(hash, &md4Context); /* Tell MD4 we're done */
- MDupdate(&md4Context, NULL, 0); /* Tell MD4 we're done */
-
- ChallengeResponse(rchallenge, (char *)md4Context.buffer, response->NTResp);
+ ChallengeResponse(rchallenge, hash, response->NTResp);
}
#ifdef MSLANMAN
static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
-static ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response)
+static void
+ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response)
char *rchallenge;
int rchallenge_len;
char *secret;
@@ -278,7 +284,7 @@ static ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response)
{
int i;
u_char UcasePassword[MAX_NT_PASSWORD]; /* max is actually 14 */
- u_char PasswordHash[16];
+ u_char PasswordHash[MD4_SIGNATURE_SIZE];
/* LANMan password is case insensitive */
BZERO(UcasePassword, sizeof(UcasePassword));
diff --git a/usr.sbin/pppd/chap_ms.h b/usr.sbin/pppd/chap_ms.h
index 2d7c7e9..1f0ea2b 100644
--- a/usr.sbin/pppd/chap_ms.h
+++ b/usr.sbin/pppd/chap_ms.h
@@ -19,11 +19,12 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: chap_ms.h,v 1.1 1996/05/28 00:42:31 paulus Exp $
+ * $Id: chap_ms.h,v 1.2 1997/11/27 06:08:10 paulus Exp $
*/
#ifndef __CHAPMS_INCLUDE__
+#define MD4_SIGNATURE_SIZE 16 /* 16 bytes in a MD4 message digest */
#define MAX_NT_PASSWORD 256 /* Maximum number of (Unicode) chars in an NT password */
void ChapMS __P((chap_state *, char *, int, char *, int));
diff --git a/usr.sbin/pppd/demand.c b/usr.sbin/pppd/demand.c
index dc13ba7..cbd8980 100644
--- a/usr.sbin/pppd/demand.c
+++ b/usr.sbin/pppd/demand.c
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: demand.c,v 1.6 1997/04/30 05:51:56 paulus Exp $";
+static char rcsid[] = "$Id: demand.c,v 1.7 1997/11/27 06:08:26 paulus Exp $";
#endif
#include <stdio.h>
@@ -35,8 +35,8 @@ static char rcsid[] = "$Id: demand.c,v 1.6 1997/04/30 05:51:56 paulus Exp $";
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/socket.h>
-#include <net/if.h>
#ifdef PPP_FILTER
+#include <net/if.h>
#include <net/bpf.h>
#include <pcap.h>
#endif
OpenPOWER on IntegriCloud