Merge some OpenBSD/NetBSD fixes to the recent MPPE/CHAP0x81 update.
This commit is contained in:
parent
19d0f858b4
commit
1c25c5e077
@ -28,10 +28,12 @@
|
||||
#include <ctype.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <openssl/des.h>
|
||||
#else
|
||||
#include <des.h>
|
||||
#endif
|
||||
#include <sha.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <des.h>
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
#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,
|
||||
|
@ -31,7 +31,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <sha.h>
|
||||
#else
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
#include <openssl/rc4.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
Loading…
Reference in New Issue
Block a user