mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-03 21:14:40 +08:00
Minor changes: coding style (tabs, ident, etc...).
This commit is contained in:
parent
37a5a87057
commit
6bce832060
@ -62,7 +62,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: chap.h,v 1.2 2007/11/29 22:19:57 fbernon Exp $
|
||||
* $Id: chap.h,v 1.3 2007/12/02 22:56:19 fbernon Exp $
|
||||
*/
|
||||
|
||||
#ifndef CHAP_H
|
||||
|
@ -138,13 +138,8 @@ static u_char Get7Bits(
|
||||
/***********************************/
|
||||
/*** PUBLIC FUNCTION DEFINITIONS ***/
|
||||
/***********************************/
|
||||
void ChapMS(
|
||||
chap_state *cstate,
|
||||
char *rchallenge,
|
||||
int rchallenge_len,
|
||||
char *secret,
|
||||
int secret_len
|
||||
)
|
||||
void
|
||||
ChapMS( chap_state *cstate, char *rchallenge, int rchallenge_len, char *secret, int secret_len)
|
||||
{
|
||||
MS_ChapResponse response;
|
||||
#ifdef MSLANMAN
|
||||
@ -176,11 +171,10 @@ void ChapMS(
|
||||
/**********************************/
|
||||
/*** LOCAL FUNCTION DEFINITIONS ***/
|
||||
/**********************************/
|
||||
static void ChallengeResponse(
|
||||
u_char *challenge, /* IN 8 octets */
|
||||
static void
|
||||
ChallengeResponse( u_char *challenge, /* IN 8 octets */
|
||||
u_char *pwHash, /* IN 16 octets */
|
||||
u_char *response /* OUT 24 octets */
|
||||
)
|
||||
u_char *response /* OUT 24 octets */)
|
||||
{
|
||||
char ZPasswordHash[21];
|
||||
|
||||
@ -202,11 +196,10 @@ static void ChallengeResponse(
|
||||
|
||||
|
||||
#ifdef USE_CRYPT
|
||||
static void DesEncrypt(
|
||||
u_char *clear, /* IN 8 octets */
|
||||
static void
|
||||
DesEncrypt( u_char *clear, /* IN 8 octets */
|
||||
u_char *key, /* IN 7 octets */
|
||||
u_char *cipher /* OUT 8 octets */
|
||||
)
|
||||
u_char *cipher /* OUT 8 octets */)
|
||||
{
|
||||
u_char des_key[8];
|
||||
u_char crypt_key[66];
|
||||
@ -234,11 +227,10 @@ static void DesEncrypt(
|
||||
|
||||
#else /* USE_CRYPT */
|
||||
|
||||
static void DesEncrypt(
|
||||
u_char *clear, /* IN 8 octets */
|
||||
static void
|
||||
DesEncrypt( u_char *clear, /* IN 8 octets */
|
||||
u_char *key, /* IN 7 octets */
|
||||
u_char *cipher /* OUT 8 octets */
|
||||
)
|
||||
u_char *cipher /* OUT 8 octets */)
|
||||
{
|
||||
des_cblock des_key;
|
||||
des_key_schedule key_schedule;
|
||||
@ -263,10 +255,8 @@ static void DesEncrypt(
|
||||
#endif /* USE_CRYPT */
|
||||
|
||||
|
||||
static u_char Get7Bits(
|
||||
u_char *input,
|
||||
int startBit
|
||||
)
|
||||
static u_char
|
||||
Get7Bits( u_char *input, int startBit)
|
||||
{
|
||||
register unsigned int word;
|
||||
|
||||
@ -284,22 +274,25 @@ static u_char Get7Bits(
|
||||
* out == 64-byte string where each byte is either 1 or 0
|
||||
* Note that the low-order "bit" is always ignored by by setkey()
|
||||
*/
|
||||
static void Expand(u_char *in, u_char *out)
|
||||
static void
|
||||
Expand(u_char *in, u_char *out)
|
||||
{
|
||||
int j, c;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 64; in++){
|
||||
c = *in;
|
||||
for(j = 7; j >= 0; j--)
|
||||
for(j = 7; j >= 0; j--) {
|
||||
*out++ = (c >> j) & 01;
|
||||
}
|
||||
i += 8;
|
||||
}
|
||||
}
|
||||
|
||||
/* The inverse of Expand
|
||||
*/
|
||||
static void Collapse(u_char *in, u_char *out)
|
||||
static void
|
||||
Collapse(u_char *in, u_char *out)
|
||||
{
|
||||
int j;
|
||||
int i;
|
||||
@ -307,17 +300,17 @@ static void Collapse(u_char *in, u_char *out)
|
||||
|
||||
for (i = 0; i < 64; i += 8, out++) {
|
||||
c = 0;
|
||||
for (j = 7; j >= 0; j--, in++)
|
||||
for (j = 7; j >= 0; j--, in++) {
|
||||
c |= *in << j;
|
||||
}
|
||||
*out = c & 0xff;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void MakeKey(
|
||||
u_char *key, /* IN 56 bit DES key missing parity bits */
|
||||
u_char *des_key /* OUT 64 bit DES key with parity bits added */
|
||||
)
|
||||
static void
|
||||
MakeKey( u_char *key, /* IN 56 bit DES key missing parity bits */
|
||||
u_char *des_key /* OUT 64 bit DES key with parity bits added */)
|
||||
{
|
||||
des_key[0] = Get7Bits(key, 0);
|
||||
des_key[1] = Get7Bits(key, 7);
|
||||
@ -340,13 +333,12 @@ static void MakeKey(
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ChapMS_NT(
|
||||
char *rchallenge,
|
||||
static void
|
||||
ChapMS_NT( char *rchallenge,
|
||||
int rchallenge_len,
|
||||
char *secret,
|
||||
int secret_len,
|
||||
MS_ChapResponse *response
|
||||
)
|
||||
MS_ChapResponse *response)
|
||||
{
|
||||
int i;
|
||||
MDstruct md4Context;
|
||||
@ -356,16 +348,18 @@ static void ChapMS_NT(
|
||||
/* Initialize the Unicode version of the secret (== password). */
|
||||
/* This implicitly supports 8-bit ISO8859/1 characters. */
|
||||
BZERO(unicodePassword, sizeof(unicodePassword));
|
||||
for (i = 0; i < secret_len; i++)
|
||||
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 */
|
||||
|
||||
if (low_byte_first == -1)
|
||||
if (low_byte_first == -1) {
|
||||
low_byte_first = (htons((unsigned short int)1) != 1);
|
||||
if (low_byte_first == 0)
|
||||
}
|
||||
if (low_byte_first == 0) {
|
||||
MDreverse((u_long *)&md4Context); /* sfb 961105 */
|
||||
}
|
||||
|
||||
MDupdate(&md4Context, NULL, 0); /* Tell MD4 we're done */
|
||||
|
||||
@ -375,13 +369,12 @@ static void ChapMS_NT(
|
||||
#ifdef MSLANMAN
|
||||
static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
|
||||
|
||||
static ChapMS_LANMan(
|
||||
char *rchallenge,
|
||||
static void
|
||||
ChapMS_LANMan( char *rchallenge,
|
||||
int rchallenge_len,
|
||||
char *secret,
|
||||
int secret_len,
|
||||
MS_ChapResponse *response
|
||||
)
|
||||
MS_ChapResponse *response)
|
||||
{
|
||||
int i;
|
||||
u_char UcasePassword[MAX_NT_PASSWORD]; /* max is actually 14 */
|
||||
@ -389,8 +382,9 @@ static ChapMS_LANMan(
|
||||
|
||||
/* LANMan password is case insensitive */
|
||||
BZERO(UcasePassword, sizeof(UcasePassword));
|
||||
for (i = 0; i < secret_len; i++)
|
||||
for (i = 0; i < secret_len; i++) {
|
||||
UcasePassword[i] = (u_char)toupper(secret[i]);
|
||||
}
|
||||
DesEncrypt( StdText, UcasePassword + 0, PasswordHash + 0 );
|
||||
DesEncrypt( StdText, UcasePassword + 7, PasswordHash + 8 );
|
||||
ChallengeResponse(rchallenge, PasswordHash, response->LANManResp);
|
||||
|
@ -51,7 +51,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: chpms.h,v 1.3 2004/02/07 00:30:03 likewise Exp $
|
||||
* $Id: chpms.h,v 1.4 2007/12/02 22:56:19 fbernon Exp $
|
||||
*/
|
||||
|
||||
#ifndef CHPMS_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user