diff options
author | Brian Somers <brian@FreeBSD.org> | 2000-11-05 03:25:09 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2000-11-05 03:25:09 +0000 |
commit | 1c25c5e077d4ae386e3850b93756f2721c14f117 (patch) | |
tree | 4f62846723b41efe3ec78cfb93ff840c9fcb9f6d /usr.sbin/ppp/chap_ms.c | |
parent | 19d0f858b4578f1f6175ab1668b1f14d4ba589da (diff) | |
download | src-1c25c5e077d4ae386e3850b93756f2721c14f117.tar.gz src-1c25c5e077d4ae386e3850b93756f2721c14f117.zip |
Merge some OpenBSD/NetBSD fixes to the recent MPPE/CHAP0x81 update.
Notes
Notes:
svn path=/head/; revision=68344
Diffstat (limited to 'usr.sbin/ppp/chap_ms.c')
-rw-r--r-- | usr.sbin/ppp/chap_ms.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/usr.sbin/ppp/chap_ms.c b/usr.sbin/ppp/chap_ms.c index a3df295acede..e482296ef794 100644 --- a/usr.sbin/ppp/chap_ms.c +++ b/usr.sbin/ppp/chap_ms.c @@ -28,10 +28,12 @@ #include <ctype.h> #ifdef __FreeBSD__ #include <openssl/des.h> +#include <sha.h> #else +#include <stdlib.h> #include <des.h> +#include <openssl/sha.h> #endif -#include <sha.h> #include <md4.h> #include <string.h> @@ -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, |