From 229a59bc61fb77ffa0216a1c84d309b633f2f0dc Mon Sep 17 00:00:00 2001 From: brian Date: Sun, 5 Nov 2000 03:25:09 +0000 Subject: Merge some OpenBSD/NetBSD fixes to the recent MPPE/CHAP0x81 update. --- usr.sbin/ppp/chap_ms.c | 27 ++++++++++++++++++++++++++- usr.sbin/ppp/mppe.c | 4 ++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/usr.sbin/ppp/chap_ms.c b/usr.sbin/ppp/chap_ms.c index a3df295..e482296 100644 --- a/usr.sbin/ppp/chap_ms.c +++ b/usr.sbin/ppp/chap_ms.c @@ -28,10 +28,12 @@ #include #ifdef __FreeBSD__ #include +#include #else +#include #include +#include #endif -#include #include #include @@ -177,6 +179,29 @@ GenerateNTResponse(char *AuthenticatorChallenge, char *PeerChallenge, ChallengeResponse(Challenge, PasswordHash, Response); } +#ifndef __FreeBSD__ +#define LENGTH 20 +char * +SHA1_End(SHA_CTX *ctx, char *buf) +{ + int i; + unsigned char digest[LENGTH]; + static const char hex[]="0123456789abcdef"; + + if (!buf) + buf = malloc(2*LENGTH + 1); + if (!buf) + return 0; + SHA1_Final(digest, ctx); + for (i = 0; i < LENGTH; i++) { + buf[i+i] = hex[digest[i] >> 4]; + buf[i+i+1] = hex[digest[i] & 0x0f]; + } + buf[i+i] = '\0'; + return buf; +} +#endif + void GenerateAuthenticatorResponse(char *Password, int PasswordLen, char *NTResponse, char *PeerChallenge, diff --git a/usr.sbin/ppp/mppe.c b/usr.sbin/ppp/mppe.c index 85576fe..253bb56 100644 --- a/usr.sbin/ppp/mppe.c +++ b/usr.sbin/ppp/mppe.c @@ -31,7 +31,11 @@ #include #include #include +#ifdef __FreeBSD__ #include +#else +#include +#endif #include #include "defs.h" -- cgit v1.1