mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-07-16 09:47:31 +00:00
PPP: fix constness in PPP related files (GCC -Wcast-qual)
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
This commit is contained in:
parent
ddf899ad1e
commit
79e7201854
|
@ -140,7 +140,7 @@ struct chap_digest_type {
|
||||||
#endif /* PPP_SERVER */
|
#endif /* PPP_SERVER */
|
||||||
void (*make_response)(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
|
void (*make_response)(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
|
||||||
const unsigned char *challenge, const char *secret, int secret_len,
|
const unsigned char *challenge, const char *secret, int secret_len,
|
||||||
const unsigned char *priv);
|
unsigned char *priv);
|
||||||
int (*check_success)(ppp_pcb *pcb, unsigned char *pkt, int len, unsigned char *priv);
|
int (*check_success)(ppp_pcb *pcb, unsigned char *pkt, int len, unsigned char *priv);
|
||||||
void (*handle_failure)(ppp_pcb *pcb, unsigned char *pkt, int len);
|
void (*handle_failure)(ppp_pcb *pcb, unsigned char *pkt, int len);
|
||||||
};
|
};
|
||||||
|
|
|
@ -168,7 +168,7 @@ void fsm_open(fsm *f);
|
||||||
void fsm_close(fsm *f, const char *reason);
|
void fsm_close(fsm *f, const char *reason);
|
||||||
void fsm_input(fsm *f, u_char *inpacket, int l);
|
void fsm_input(fsm *f, u_char *inpacket, int l);
|
||||||
void fsm_protreject(fsm *f);
|
void fsm_protreject(fsm *f);
|
||||||
void fsm_sdata(fsm *f, u_char code, u_char id, u_char *data, int datalen);
|
void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen);
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSM_H */
|
#endif /* FSM_H */
|
||||||
|
|
|
@ -80,7 +80,7 @@ void des_setkey_dec( des_context *ctx, unsigned char key[8] );
|
||||||
* \param output 64-bit output block
|
* \param output 64-bit output block
|
||||||
*/
|
*/
|
||||||
void des_crypt_ecb( des_context *ctx,
|
void des_crypt_ecb( des_context *ctx,
|
||||||
unsigned char input[8],
|
const unsigned char input[8],
|
||||||
unsigned char output[8] );
|
unsigned char output[8] );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -68,7 +68,7 @@ void md4_starts( md4_context *ctx );
|
||||||
* \param input buffer holding the data
|
* \param input buffer holding the data
|
||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
*/
|
*/
|
||||||
void md4_update( md4_context *ctx, unsigned char *input, int ilen );
|
void md4_update( md4_context *ctx, const unsigned char *input, int ilen );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief MD4 final digest
|
* \brief MD4 final digest
|
||||||
|
|
|
@ -68,7 +68,7 @@ void md5_starts( md5_context *ctx );
|
||||||
* \param input buffer holding the data
|
* \param input buffer holding the data
|
||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
*/
|
*/
|
||||||
void md5_update( md5_context *ctx, unsigned char *input, int ilen );
|
void md5_update( md5_context *ctx, const unsigned char *input, int ilen );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief MD5 final digest
|
* \brief MD5 final digest
|
||||||
|
|
|
@ -68,7 +68,7 @@ void sha1_starts( sha1_context *ctx );
|
||||||
* \param input buffer holding the data
|
* \param input buffer holding the data
|
||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
*/
|
*/
|
||||||
void sha1_update( sha1_context *ctx, unsigned char *input, int ilen );
|
void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief SHA-1 final digest
|
* \brief SHA-1 final digest
|
||||||
|
|
|
@ -97,7 +97,7 @@ static int chap_md5_verify_response(ppp_pcb *pcb, int id, const char *name,
|
||||||
|
|
||||||
static void chap_md5_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
|
static void chap_md5_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
|
||||||
const unsigned char *challenge, const char *secret, int secret_len,
|
const unsigned char *challenge, const char *secret, int secret_len,
|
||||||
const unsigned char *private_) {
|
unsigned char *private_) {
|
||||||
md5_context ctx;
|
md5_context ctx;
|
||||||
unsigned char idbyte = id;
|
unsigned char idbyte = id;
|
||||||
int challenge_len = *challenge++;
|
int challenge_len = *challenge++;
|
||||||
|
@ -107,8 +107,8 @@ static void chap_md5_make_response(ppp_pcb *pcb, unsigned char *response, int id
|
||||||
|
|
||||||
md5_starts(&ctx);
|
md5_starts(&ctx);
|
||||||
md5_update(&ctx, &idbyte, 1);
|
md5_update(&ctx, &idbyte, 1);
|
||||||
md5_update(&ctx, (u_char *)secret, secret_len);
|
md5_update(&ctx, (const u_char *)secret, secret_len);
|
||||||
md5_update(&ctx, (unsigned char *)challenge, challenge_len);
|
md5_update(&ctx, challenge, challenge_len);
|
||||||
md5_finish(&ctx, &response[1]);
|
md5_finish(&ctx, &response[1]);
|
||||||
response[0] = MD5_HASH_SIZE;
|
response[0] = MD5_HASH_SIZE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,32 +168,32 @@ extern void set_mppe_enc_types(int, int);
|
||||||
#define MS_CHAP2_AUTHENTICATEE 0
|
#define MS_CHAP2_AUTHENTICATEE 0
|
||||||
#define MS_CHAP2_AUTHENTICATOR 1
|
#define MS_CHAP2_AUTHENTICATOR 1
|
||||||
|
|
||||||
static void ascii2unicode (char[], int, u_char[]);
|
static void ascii2unicode (const char[], int, u_char[]);
|
||||||
static void NTPasswordHash (u_char *, int, u_char[MD4_SIGNATURE_SIZE]);
|
static void NTPasswordHash (u_char *, int, u_char[MD4_SIGNATURE_SIZE]);
|
||||||
static void ChallengeResponse (u_char *, u_char *, u_char[24]);
|
static void ChallengeResponse (const u_char *, const u_char *, u_char[24]);
|
||||||
static void ChallengeHash (u_char[16], u_char *, char *, u_char[8]);
|
static void ChallengeHash (const u_char[16], const u_char *, const char *, u_char[8]);
|
||||||
static void ChapMS_NT (u_char *, char *, int, u_char[24]);
|
static void ChapMS_NT (const u_char *, const char *, int, u_char[24]);
|
||||||
static void ChapMS2_NT (u_char *, u_char[16], char *, char *, int,
|
static void ChapMS2_NT (const u_char *, const u_char[16], const char *, const char *, int,
|
||||||
u_char[24]);
|
u_char[24]);
|
||||||
static void GenerateAuthenticatorResponsePlain
|
static void GenerateAuthenticatorResponsePlain
|
||||||
(char*, int, u_char[24], u_char[16], u_char *,
|
(const char*, int, u_char[24], const u_char[16], const u_char *,
|
||||||
char *, u_char[41]);
|
const char *, u_char[41]);
|
||||||
#ifdef MSLANMAN
|
#ifdef MSLANMAN
|
||||||
static void ChapMS_LANMan (u_char *, char *, int, u_char *);
|
static void ChapMS_LANMan (u_char *, char *, int, u_char *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
|
static void GenerateAuthenticatorResponse(const u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
|
||||||
u_char NTResponse[24], u_char PeerChallenge[16],
|
u_char NTResponse[24], const u_char PeerChallenge[16],
|
||||||
u_char *rchallenge, char *username,
|
const u_char *rchallenge, const char *username,
|
||||||
u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]);
|
u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]);
|
||||||
|
|
||||||
#if MPPE_SUPPORT
|
#if MPPE_SUPPORT
|
||||||
static void Set_Start_Key (ppp_pcb *pcb, u_char *, char *, int);
|
static void Set_Start_Key (ppp_pcb *pcb, const u_char *, const char *, int);
|
||||||
static void SetMasterKeys (ppp_pcb *pcb, char *, int, u_char[24], int);
|
static void SetMasterKeys (ppp_pcb *pcb, const char *, int, u_char[24], int);
|
||||||
#endif /* MPPE_SUPPORT */
|
#endif /* MPPE_SUPPORT */
|
||||||
|
|
||||||
static void ChapMS (ppp_pcb *pcb, u_char *, char *, int, u_char *);
|
static void ChapMS (ppp_pcb *pcb, const u_char *, const char *, int, u_char *);
|
||||||
static void ChapMS2 (ppp_pcb *pcb, u_char *, u_char *, char *, char *, int,
|
static void ChapMS2 (ppp_pcb *pcb, const u_char *, const u_char *, const char *, const char *, int,
|
||||||
u_char *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int);
|
u_char *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int);
|
||||||
|
|
||||||
#ifdef MSLANMAN
|
#ifdef MSLANMAN
|
||||||
|
@ -391,28 +391,28 @@ static int chapms2_verify_response(ppp_pcb *pcb, int id, const char *name,
|
||||||
|
|
||||||
static void chapms_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
|
static void chapms_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
|
||||||
const unsigned char *challenge, const char *secret, int secret_len,
|
const unsigned char *challenge, const char *secret, int secret_len,
|
||||||
const unsigned char *private_) {
|
unsigned char *private_) {
|
||||||
LWIP_UNUSED_ARG(id);
|
LWIP_UNUSED_ARG(id);
|
||||||
LWIP_UNUSED_ARG(our_name);
|
LWIP_UNUSED_ARG(our_name);
|
||||||
LWIP_UNUSED_ARG(private_);
|
LWIP_UNUSED_ARG(private_);
|
||||||
challenge++; /* skip length, should be 8 */
|
challenge++; /* skip length, should be 8 */
|
||||||
*response++ = MS_CHAP_RESPONSE_LEN;
|
*response++ = MS_CHAP_RESPONSE_LEN;
|
||||||
ChapMS(pcb, (u_char*)challenge, (char*)secret, secret_len, response);
|
ChapMS(pcb, challenge, secret, secret_len, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chapms2_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
|
static void chapms2_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
|
||||||
const unsigned char *challenge, const char *secret, int secret_len,
|
const unsigned char *challenge, const char *secret, int secret_len,
|
||||||
const unsigned char *private_) {
|
unsigned char *private_) {
|
||||||
LWIP_UNUSED_ARG(id);
|
LWIP_UNUSED_ARG(id);
|
||||||
challenge++; /* skip length, should be 16 */
|
challenge++; /* skip length, should be 16 */
|
||||||
*response++ = MS_CHAP2_RESPONSE_LEN;
|
*response++ = MS_CHAP2_RESPONSE_LEN;
|
||||||
ChapMS2(pcb, (u_char*)challenge,
|
ChapMS2(pcb, challenge,
|
||||||
#ifdef DEBUGMPPEKEY
|
#ifdef DEBUGMPPEKEY
|
||||||
mschap2_peer_challenge,
|
mschap2_peer_challenge,
|
||||||
#else
|
#else
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
(char*)our_name, (char*)secret, secret_len, response, (u_char*)private_,
|
our_name, secret, secret_len, response, private_,
|
||||||
MS_CHAP2_AUTHENTICATEE);
|
MS_CHAP2_AUTHENTICATEE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,8 +511,8 @@ print_msg:
|
||||||
ppp_error("MS-CHAP authentication failed: %v", p);
|
ppp_error("MS-CHAP authentication failed: %v", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ChallengeResponse(u_char *challenge,
|
static void ChallengeResponse(const u_char *challenge,
|
||||||
u_char PasswordHash[MD4_SIGNATURE_SIZE],
|
const u_char PasswordHash[MD4_SIGNATURE_SIZE],
|
||||||
u_char response[24]) {
|
u_char response[24]) {
|
||||||
u_char ZPasswordHash[21];
|
u_char ZPasswordHash[21];
|
||||||
des_context des;
|
des_context des;
|
||||||
|
@ -543,11 +543,11 @@ static void ChallengeResponse(u_char *challenge,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ChallengeHash(u_char PeerChallenge[16], u_char *rchallenge,
|
static void ChallengeHash(const u_char PeerChallenge[16], const u_char *rchallenge,
|
||||||
char *username, u_char Challenge[8]) {
|
const char *username, u_char Challenge[8]) {
|
||||||
sha1_context sha1Context;
|
sha1_context sha1Context;
|
||||||
u_char sha1Hash[SHA1_SIGNATURE_SIZE];
|
u_char sha1Hash[SHA1_SIGNATURE_SIZE];
|
||||||
char *user;
|
const char *user;
|
||||||
|
|
||||||
/* remove domain from "domain\username" */
|
/* remove domain from "domain\username" */
|
||||||
if ((user = strrchr(username, '\\')) != NULL)
|
if ((user = strrchr(username, '\\')) != NULL)
|
||||||
|
@ -558,7 +558,7 @@ static void ChallengeHash(u_char PeerChallenge[16], u_char *rchallenge,
|
||||||
sha1_starts(&sha1Context);
|
sha1_starts(&sha1Context);
|
||||||
sha1_update(&sha1Context, PeerChallenge, 16);
|
sha1_update(&sha1Context, PeerChallenge, 16);
|
||||||
sha1_update(&sha1Context, rchallenge, 16);
|
sha1_update(&sha1Context, rchallenge, 16);
|
||||||
sha1_update(&sha1Context, (unsigned char *)user, strlen(user));
|
sha1_update(&sha1Context, (const unsigned char*)user, strlen(user));
|
||||||
sha1_finish(&sha1Context, sha1Hash);
|
sha1_finish(&sha1Context, sha1Hash);
|
||||||
|
|
||||||
MEMCPY(Challenge, sha1Hash, 8);
|
MEMCPY(Challenge, sha1Hash, 8);
|
||||||
|
@ -571,7 +571,7 @@ static void ChallengeHash(u_char PeerChallenge[16], u_char *rchallenge,
|
||||||
* is assumed by all M$ CHAP RFCs. (Unicode byte ordering
|
* is assumed by all M$ CHAP RFCs. (Unicode byte ordering
|
||||||
* is machine-dependent.)
|
* is machine-dependent.)
|
||||||
*/
|
*/
|
||||||
static void ascii2unicode(char ascii[], int ascii_len, u_char unicode[]) {
|
static void ascii2unicode(const char ascii[], int ascii_len, u_char unicode[]) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
BZERO(unicode, ascii_len * 2);
|
BZERO(unicode, ascii_len * 2);
|
||||||
|
@ -587,7 +587,7 @@ static void NTPasswordHash(u_char *secret, int secret_len, u_char hash[MD4_SIGNA
|
||||||
md4_finish(&md4Context, hash);
|
md4_finish(&md4Context, hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ChapMS_NT(u_char *rchallenge, char *secret, int secret_len,
|
static void ChapMS_NT(const u_char *rchallenge, const char *secret, int secret_len,
|
||||||
u_char NTResponse[24]) {
|
u_char NTResponse[24]) {
|
||||||
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
||||||
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
||||||
|
@ -599,8 +599,8 @@ static void ChapMS_NT(u_char *rchallenge, char *secret, int secret_len,
|
||||||
ChallengeResponse(rchallenge, PasswordHash, NTResponse);
|
ChallengeResponse(rchallenge, PasswordHash, NTResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ChapMS2_NT(u_char *rchallenge, u_char PeerChallenge[16], char *username,
|
static void ChapMS2_NT(const u_char *rchallenge, const u_char PeerChallenge[16], const char *username,
|
||||||
char *secret, int secret_len, u_char NTResponse[24]) {
|
const char *secret, int secret_len, u_char NTResponse[24]) {
|
||||||
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
||||||
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
||||||
u_char Challenge[8];
|
u_char Challenge[8];
|
||||||
|
@ -643,9 +643,9 @@ static void ChapMS_LANMan(u_char *rchallenge, char *secret, int secret_len,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
|
static void GenerateAuthenticatorResponse(const u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
|
||||||
u_char NTResponse[24], u_char PeerChallenge[16],
|
u_char NTResponse[24], const u_char PeerChallenge[16],
|
||||||
u_char *rchallenge, char *username,
|
const u_char *rchallenge, const char *username,
|
||||||
u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
|
u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
|
||||||
/*
|
/*
|
||||||
* "Magic" constants used in response generation, from RFC 2759.
|
* "Magic" constants used in response generation, from RFC 2759.
|
||||||
|
@ -670,7 +670,7 @@ static void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_
|
||||||
sha1_starts(&sha1Context);
|
sha1_starts(&sha1Context);
|
||||||
sha1_update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
|
sha1_update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
|
||||||
sha1_update(&sha1Context, NTResponse, 24);
|
sha1_update(&sha1Context, NTResponse, 24);
|
||||||
sha1_update(&sha1Context, (unsigned char *)Magic1, sizeof(Magic1));
|
sha1_update(&sha1Context, Magic1, sizeof(Magic1));
|
||||||
sha1_finish(&sha1Context, Digest);
|
sha1_finish(&sha1Context, Digest);
|
||||||
|
|
||||||
ChallengeHash(PeerChallenge, rchallenge, username, Challenge);
|
ChallengeHash(PeerChallenge, rchallenge, username, Challenge);
|
||||||
|
@ -678,7 +678,7 @@ static void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_
|
||||||
sha1_starts(&sha1Context);
|
sha1_starts(&sha1Context);
|
||||||
sha1_update(&sha1Context, Digest, sizeof(Digest));
|
sha1_update(&sha1Context, Digest, sizeof(Digest));
|
||||||
sha1_update(&sha1Context, Challenge, sizeof(Challenge));
|
sha1_update(&sha1Context, Challenge, sizeof(Challenge));
|
||||||
sha1_update(&sha1Context, (unsigned char *)Magic2, sizeof(Magic2));
|
sha1_update(&sha1Context, Magic2, sizeof(Magic2));
|
||||||
sha1_finish(&sha1Context, Digest);
|
sha1_finish(&sha1Context, Digest);
|
||||||
|
|
||||||
/* Convert to ASCII hex string. */
|
/* Convert to ASCII hex string. */
|
||||||
|
@ -687,10 +687,10 @@ static void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void GenerateAuthenticatorResponsePlain
|
static void GenerateAuthenticatorResponsePlain(
|
||||||
(char *secret, int secret_len,
|
const char *secret, int secret_len,
|
||||||
u_char NTResponse[24], u_char PeerChallenge[16],
|
u_char NTResponse[24], const u_char PeerChallenge[16],
|
||||||
u_char *rchallenge, char *username,
|
const u_char *rchallenge, const char *username,
|
||||||
u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
|
u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
|
||||||
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
||||||
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
||||||
|
@ -711,7 +711,7 @@ static void GenerateAuthenticatorResponsePlain
|
||||||
/*
|
/*
|
||||||
* Set mppe_xxxx_key from MS-CHAP credentials. (see RFC 3079)
|
* Set mppe_xxxx_key from MS-CHAP credentials. (see RFC 3079)
|
||||||
*/
|
*/
|
||||||
static void Set_Start_Key(ppp_pcb *pcb, u_char *rchallenge, char *secret, int secret_len) {
|
static void Set_Start_Key(ppp_pcb *pcb, const u_char *rchallenge, const char *secret, int secret_len) {
|
||||||
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
||||||
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
||||||
u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
|
u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
|
||||||
|
@ -739,7 +739,7 @@ static void Set_Start_Key(ppp_pcb *pcb, u_char *rchallenge, char *secret, int se
|
||||||
/*
|
/*
|
||||||
* Set mppe_xxxx_key from MS-CHAPv2 credentials. (see RFC 3079)
|
* Set mppe_xxxx_key from MS-CHAPv2 credentials. (see RFC 3079)
|
||||||
*/
|
*/
|
||||||
static void SetMasterKeys(ppp_pcb *pcb, char *secret, int secret_len, u_char NTResponse[24], int IsServer) {
|
static void SetMasterKeys(ppp_pcb *pcb, const char *secret, int secret_len, u_char NTResponse[24], int IsServer) {
|
||||||
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
u_char unicodePassword[MAX_NT_PASSWORD * 2];
|
||||||
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
u_char PasswordHash[MD4_SIGNATURE_SIZE];
|
||||||
u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
|
u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
|
||||||
|
@ -786,7 +786,7 @@ static void SetMasterKeys(ppp_pcb *pcb, char *secret, int secret_len, u_char NTR
|
||||||
sha1_starts(&sha1Context);
|
sha1_starts(&sha1Context);
|
||||||
sha1_update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
|
sha1_update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
|
||||||
sha1_update(&sha1Context, NTResponse, 24);
|
sha1_update(&sha1Context, NTResponse, 24);
|
||||||
sha1_update(&sha1Context, (unsigned char *)Magic1, sizeof(Magic1));
|
sha1_update(&sha1Context, Magic1, sizeof(Magic1));
|
||||||
sha1_finish(&sha1Context, MasterKey);
|
sha1_finish(&sha1Context, MasterKey);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -798,9 +798,9 @@ static void SetMasterKeys(ppp_pcb *pcb, char *secret, int secret_len, u_char NTR
|
||||||
s = Magic2;
|
s = Magic2;
|
||||||
sha1_starts(&sha1Context);
|
sha1_starts(&sha1Context);
|
||||||
sha1_update(&sha1Context, MasterKey, 16);
|
sha1_update(&sha1Context, MasterKey, 16);
|
||||||
sha1_update(&sha1Context, (unsigned char *)mppe_sha1_pad1, SHA1_PAD_SIZE);
|
sha1_update(&sha1Context, mppe_sha1_pad1, SHA1_PAD_SIZE);
|
||||||
sha1_update(&sha1Context, (unsigned char *)s, 84);
|
sha1_update(&sha1Context, s, 84);
|
||||||
sha1_update(&sha1Context, (unsigned char *)mppe_sha1_pad2, SHA1_PAD_SIZE);
|
sha1_update(&sha1Context, mppe_sha1_pad2, SHA1_PAD_SIZE);
|
||||||
sha1_finish(&sha1Context, Digest);
|
sha1_finish(&sha1Context, Digest);
|
||||||
|
|
||||||
mppe_set_key(pcb, &pcb->mppe_comp, Digest);
|
mppe_set_key(pcb, &pcb->mppe_comp, Digest);
|
||||||
|
@ -814,9 +814,9 @@ static void SetMasterKeys(ppp_pcb *pcb, char *secret, int secret_len, u_char NTR
|
||||||
s = Magic3;
|
s = Magic3;
|
||||||
sha1_starts(&sha1Context);
|
sha1_starts(&sha1Context);
|
||||||
sha1_update(&sha1Context, MasterKey, 16);
|
sha1_update(&sha1Context, MasterKey, 16);
|
||||||
sha1_update(&sha1Context, (unsigned char *)mppe_sha1_pad1, SHA1_PAD_SIZE);
|
sha1_update(&sha1Context, mppe_sha1_pad1, SHA1_PAD_SIZE);
|
||||||
sha1_update(&sha1Context, (unsigned char *)s, 84);
|
sha1_update(&sha1Context, s, 84);
|
||||||
sha1_update(&sha1Context, (unsigned char *)mppe_sha1_pad2, SHA1_PAD_SIZE);
|
sha1_update(&sha1Context, mppe_sha1_pad2, SHA1_PAD_SIZE);
|
||||||
sha1_finish(&sha1Context, Digest);
|
sha1_finish(&sha1Context, Digest);
|
||||||
|
|
||||||
mppe_set_key(pcb, &pcb->mppe_decomp, Digest);
|
mppe_set_key(pcb, &pcb->mppe_decomp, Digest);
|
||||||
|
@ -827,7 +827,7 @@ static void SetMasterKeys(ppp_pcb *pcb, char *secret, int secret_len, u_char NTR
|
||||||
#endif /* MPPE_SUPPORT */
|
#endif /* MPPE_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
static void ChapMS(ppp_pcb *pcb, u_char *rchallenge, char *secret, int secret_len,
|
static void ChapMS(ppp_pcb *pcb, const u_char *rchallenge, const char *secret, int secret_len,
|
||||||
unsigned char *response) {
|
unsigned char *response) {
|
||||||
#if !MPPE_SUPPORT
|
#if !MPPE_SUPPORT
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
|
@ -862,8 +862,8 @@ static void ChapMS(ppp_pcb *pcb, u_char *rchallenge, char *secret, int secret_le
|
||||||
* The PeerChallenge field of response is then used for calculation of the
|
* The PeerChallenge field of response is then used for calculation of the
|
||||||
* Authenticator Response.
|
* Authenticator Response.
|
||||||
*/
|
*/
|
||||||
static void ChapMS2(ppp_pcb *pcb, u_char *rchallenge, u_char *PeerChallenge,
|
static void ChapMS2(ppp_pcb *pcb, const u_char *rchallenge, const u_char *PeerChallenge,
|
||||||
char *user, char *secret, int secret_len, unsigned char *response,
|
const char *user, const char *secret, int secret_len, unsigned char *response,
|
||||||
u_char authResponse[], int authenticator) {
|
u_char authResponse[], int authenticator) {
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
LWIP_UNUSED_ARG(authenticator);
|
LWIP_UNUSED_ARG(authenticator);
|
||||||
|
|
|
@ -208,7 +208,7 @@ static void terminate_layer(fsm *f, int nextstate) {
|
||||||
/* Init restart counter and send Terminate-Request */
|
/* Init restart counter and send Terminate-Request */
|
||||||
f->retransmits = pcb->settings.fsm_max_term_transmits;
|
f->retransmits = pcb->settings.fsm_max_term_transmits;
|
||||||
fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
|
fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
|
||||||
(u_char *) f->term_reason, f->term_reason_len);
|
(const u_char *) f->term_reason, f->term_reason_len);
|
||||||
|
|
||||||
if (f->retransmits == 0) {
|
if (f->retransmits == 0) {
|
||||||
/*
|
/*
|
||||||
|
@ -280,7 +280,7 @@ static void fsm_timeout(void *arg) {
|
||||||
} else {
|
} else {
|
||||||
/* Send Terminate-Request */
|
/* Send Terminate-Request */
|
||||||
fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
|
fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
|
||||||
(u_char *) f->term_reason, f->term_reason_len);
|
(const u_char *) f->term_reason, f->term_reason_len);
|
||||||
TIMEOUT(fsm_timeout, f, pcb->settings.fsm_timeout_time);
|
TIMEOUT(fsm_timeout, f, pcb->settings.fsm_timeout_time);
|
||||||
--f->retransmits;
|
--f->retransmits;
|
||||||
}
|
}
|
||||||
|
@ -767,7 +767,7 @@ static void fsm_sconfreq(fsm *f, int retransmit) {
|
||||||
*
|
*
|
||||||
* Used for all packets sent to our peer by this module.
|
* Used for all packets sent to our peer by this module.
|
||||||
*/
|
*/
|
||||||
void fsm_sdata(fsm *f, u_char code, u_char id, u_char *data, int datalen) {
|
void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen) {
|
||||||
ppp_pcb *pcb = f->pcb;
|
ppp_pcb *pcb = f->pcb;
|
||||||
struct pbuf *p;
|
struct pbuf *p;
|
||||||
u_char *outp;
|
u_char *outp;
|
||||||
|
|
|
@ -80,9 +80,9 @@ static void mppe_rekey(ppp_mppe_state * state, int initial_key)
|
||||||
*/
|
*/
|
||||||
sha1_starts(&sha1);
|
sha1_starts(&sha1);
|
||||||
sha1_update(&sha1, state->master_key, state->keylen);
|
sha1_update(&sha1, state->master_key, state->keylen);
|
||||||
sha1_update(&sha1, (unsigned char *)mppe_sha1_pad1, SHA1_PAD_SIZE);
|
sha1_update(&sha1, mppe_sha1_pad1, SHA1_PAD_SIZE);
|
||||||
sha1_update(&sha1, state->session_key, state->keylen);
|
sha1_update(&sha1, state->session_key, state->keylen);
|
||||||
sha1_update(&sha1, (unsigned char *)mppe_sha1_pad2, SHA1_PAD_SIZE);
|
sha1_update(&sha1, mppe_sha1_pad2, SHA1_PAD_SIZE);
|
||||||
sha1_finish(&sha1, sha1_digest);
|
sha1_finish(&sha1, sha1_digest);
|
||||||
MEMCPY(state->session_key, sha1_digest, state->keylen);
|
MEMCPY(state->session_key, sha1_digest, state->keylen);
|
||||||
|
|
||||||
|
|
|
@ -394,7 +394,7 @@ void des_setkey_dec( des_context *ctx, unsigned char key[8] )
|
||||||
* DES-ECB block encryption/decryption
|
* DES-ECB block encryption/decryption
|
||||||
*/
|
*/
|
||||||
void des_crypt_ecb( des_context *ctx,
|
void des_crypt_ecb( des_context *ctx,
|
||||||
unsigned char input[8],
|
const unsigned char input[8],
|
||||||
unsigned char output[8] )
|
unsigned char output[8] )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -83,7 +83,7 @@ void md4_starts( md4_context *ctx )
|
||||||
ctx->state[3] = 0x10325476;
|
ctx->state[3] = 0x10325476;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void md4_process( md4_context *ctx, unsigned char data[64] )
|
static void md4_process( md4_context *ctx, const unsigned char data[64] )
|
||||||
{
|
{
|
||||||
unsigned long X[16], A, B, C, D;
|
unsigned long X[16], A, B, C, D;
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ static void md4_process( md4_context *ctx, unsigned char data[64] )
|
||||||
/*
|
/*
|
||||||
* MD4 process buffer
|
* MD4 process buffer
|
||||||
*/
|
*/
|
||||||
void md4_update( md4_context *ctx, unsigned char *input, int ilen )
|
void md4_update( md4_context *ctx, const unsigned char *input, int ilen )
|
||||||
{
|
{
|
||||||
int fill;
|
int fill;
|
||||||
unsigned long left;
|
unsigned long left;
|
||||||
|
@ -209,7 +209,7 @@ void md4_update( md4_context *ctx, unsigned char *input, int ilen )
|
||||||
if( left && ilen >= fill )
|
if( left && ilen >= fill )
|
||||||
{
|
{
|
||||||
MEMCPY( (void *) (ctx->buffer + left),
|
MEMCPY( (void *) (ctx->buffer + left),
|
||||||
(void *) input, fill );
|
input, fill );
|
||||||
md4_process( ctx, ctx->buffer );
|
md4_process( ctx, ctx->buffer );
|
||||||
input += fill;
|
input += fill;
|
||||||
ilen -= fill;
|
ilen -= fill;
|
||||||
|
@ -226,7 +226,7 @@ void md4_update( md4_context *ctx, unsigned char *input, int ilen )
|
||||||
if( ilen > 0 )
|
if( ilen > 0 )
|
||||||
{
|
{
|
||||||
MEMCPY( (void *) (ctx->buffer + left),
|
MEMCPY( (void *) (ctx->buffer + left),
|
||||||
(void *) input, ilen );
|
input, ilen );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ void md4_finish( md4_context *ctx, unsigned char output[16] )
|
||||||
last = ctx->total[0] & 0x3F;
|
last = ctx->total[0] & 0x3F;
|
||||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||||
|
|
||||||
md4_update( ctx, (unsigned char *) md4_padding, padn );
|
md4_update( ctx, md4_padding, padn );
|
||||||
md4_update( ctx, msglen, 8 );
|
md4_update( ctx, msglen, 8 );
|
||||||
|
|
||||||
PUT_ULONG_LE( ctx->state[0], output, 0 );
|
PUT_ULONG_LE( ctx->state[0], output, 0 );
|
||||||
|
|
|
@ -82,7 +82,7 @@ void md5_starts( md5_context *ctx )
|
||||||
ctx->state[3] = 0x10325476;
|
ctx->state[3] = 0x10325476;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void md5_process( md5_context *ctx, unsigned char data[64] )
|
static void md5_process( md5_context *ctx, const unsigned char data[64] )
|
||||||
{
|
{
|
||||||
unsigned long X[16], A, B, C, D;
|
unsigned long X[16], A, B, C, D;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ static void md5_process( md5_context *ctx, unsigned char data[64] )
|
||||||
/*
|
/*
|
||||||
* MD5 process buffer
|
* MD5 process buffer
|
||||||
*/
|
*/
|
||||||
void md5_update( md5_context *ctx, unsigned char *input, int ilen )
|
void md5_update( md5_context *ctx, const unsigned char *input, int ilen )
|
||||||
{
|
{
|
||||||
int fill;
|
int fill;
|
||||||
unsigned long left;
|
unsigned long left;
|
||||||
|
@ -228,7 +228,7 @@ void md5_update( md5_context *ctx, unsigned char *input, int ilen )
|
||||||
if( left && ilen >= fill )
|
if( left && ilen >= fill )
|
||||||
{
|
{
|
||||||
MEMCPY( (void *) (ctx->buffer + left),
|
MEMCPY( (void *) (ctx->buffer + left),
|
||||||
(void *) input, fill );
|
input, fill );
|
||||||
md5_process( ctx, ctx->buffer );
|
md5_process( ctx, ctx->buffer );
|
||||||
input += fill;
|
input += fill;
|
||||||
ilen -= fill;
|
ilen -= fill;
|
||||||
|
@ -245,7 +245,7 @@ void md5_update( md5_context *ctx, unsigned char *input, int ilen )
|
||||||
if( ilen > 0 )
|
if( ilen > 0 )
|
||||||
{
|
{
|
||||||
MEMCPY( (void *) (ctx->buffer + left),
|
MEMCPY( (void *) (ctx->buffer + left),
|
||||||
(void *) input, ilen );
|
input, ilen );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void md5_finish( md5_context *ctx, unsigned char output[16] )
|
||||||
last = ctx->total[0] & 0x3F;
|
last = ctx->total[0] & 0x3F;
|
||||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||||
|
|
||||||
md5_update( ctx, (unsigned char *) md5_padding, padn );
|
md5_update( ctx, md5_padding, padn );
|
||||||
md5_update( ctx, msglen, 8 );
|
md5_update( ctx, msglen, 8 );
|
||||||
|
|
||||||
PUT_ULONG_LE( ctx->state[0], output, 0 );
|
PUT_ULONG_LE( ctx->state[0], output, 0 );
|
||||||
|
|
|
@ -83,7 +83,7 @@ void sha1_starts( sha1_context *ctx )
|
||||||
ctx->state[4] = 0xC3D2E1F0;
|
ctx->state[4] = 0xC3D2E1F0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sha1_process( sha1_context *ctx, unsigned char data[64] )
|
static void sha1_process( sha1_context *ctx, const unsigned char data[64] )
|
||||||
{
|
{
|
||||||
unsigned long temp, W[16], A, B, C, D, E;
|
unsigned long temp, W[16], A, B, C, D, E;
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ static void sha1_process( sha1_context *ctx, unsigned char data[64] )
|
||||||
/*
|
/*
|
||||||
* SHA-1 process buffer
|
* SHA-1 process buffer
|
||||||
*/
|
*/
|
||||||
void sha1_update( sha1_context *ctx, unsigned char *input, int ilen )
|
void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen )
|
||||||
{
|
{
|
||||||
int fill;
|
int fill;
|
||||||
unsigned long left;
|
unsigned long left;
|
||||||
|
@ -262,7 +262,7 @@ void sha1_update( sha1_context *ctx, unsigned char *input, int ilen )
|
||||||
if( left && ilen >= fill )
|
if( left && ilen >= fill )
|
||||||
{
|
{
|
||||||
MEMCPY( (void *) (ctx->buffer + left),
|
MEMCPY( (void *) (ctx->buffer + left),
|
||||||
(void *) input, fill );
|
input, fill );
|
||||||
sha1_process( ctx, ctx->buffer );
|
sha1_process( ctx, ctx->buffer );
|
||||||
input += fill;
|
input += fill;
|
||||||
ilen -= fill;
|
ilen -= fill;
|
||||||
|
@ -279,7 +279,7 @@ void sha1_update( sha1_context *ctx, unsigned char *input, int ilen )
|
||||||
if( ilen > 0 )
|
if( ilen > 0 )
|
||||||
{
|
{
|
||||||
MEMCPY( (void *) (ctx->buffer + left),
|
MEMCPY( (void *) (ctx->buffer + left),
|
||||||
(void *) input, ilen );
|
input, ilen );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ void sha1_finish( sha1_context *ctx, unsigned char output[20] )
|
||||||
last = ctx->total[0] & 0x3F;
|
last = ctx->total[0] & 0x3F;
|
||||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||||
|
|
||||||
sha1_update( ctx, (unsigned char *) sha1_padding, padn );
|
sha1_update( ctx, sha1_padding, padn );
|
||||||
sha1_update( ctx, msglen, 8 );
|
sha1_update( ctx, msglen, 8 );
|
||||||
|
|
||||||
PUT_ULONG_BE( ctx->state[0], output, 0 );
|
PUT_ULONG_BE( ctx->state[0], output, 0 );
|
||||||
|
|
|
@ -141,7 +141,7 @@ int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args) {
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
const char *f;
|
const char *f;
|
||||||
char *str, *buf0;
|
char *str, *buf0;
|
||||||
unsigned char *p;
|
const unsigned char *p;
|
||||||
char num[32];
|
char num[32];
|
||||||
#if 0 /* need port */
|
#if 0 /* need port */
|
||||||
time_t t;
|
time_t t;
|
||||||
|
@ -285,11 +285,11 @@ int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args) {
|
||||||
quoted = c == 'q';
|
quoted = c == 'q';
|
||||||
p = va_arg(args, unsigned char *);
|
p = va_arg(args, unsigned char *);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
p = (unsigned char *)"<NULL>";
|
p = (const unsigned char *)"<NULL>";
|
||||||
if (fillch == '0' && prec >= 0) {
|
if (fillch == '0' && prec >= 0) {
|
||||||
n = prec;
|
n = prec;
|
||||||
} else {
|
} else {
|
||||||
n = strlen((char *)p);
|
n = strlen((const char *)p);
|
||||||
if (prec >= 0 && n > prec)
|
if (prec >= 0 && n > prec)
|
||||||
n = prec;
|
n = prec;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user