40 #define CHAP_SUPPORT DISABLED
41#elif (CHAP_SUPPORT != ENABLED && CHAP_SUPPORT != DISABLED)
42 #error CHAP_SUPPORT parameter is not valid
46#ifndef CHAP_RESTART_TIMER
47 #define CHAP_RESTART_TIMER 3000
48#elif (CHAP_RESTART_TIMER < 1000)
49 #error CHAP_RESTART_TIMER parameter is not valid
53#ifndef CHAP_MAX_CHALLENGES
54 #define CHAP_MAX_CHALLENGES 5
55#elif (CHAP_MAX_CHALLENGES < 1)
56 #error CHAP_MAX_CHALLENGES parameter is not valid
71 CHAP_STATE_0_INITIAL = 0,
72 CHAP_STATE_1_STARTED = 1,
73 CHAP_STATE_2_CHALLENGE_SENT = 2,
74 CHAP_STATE_3_CHALLENGE_RCVD = 3,
75 CHAP_STATE_4_RESPONSE_SENT = 4,
76 CHAP_STATE_5_RESPONSE_RCVD = 5,
77 CHAP_STATE_6_SUCCESS_SENT = 6,
78 CHAP_STATE_7_SUCCESS_RCVD = 7,
79 CHAP_STATE_8_FAILURE_SENT = 8,
80 CHAP_STATE_9_FAILURE_RCVD = 9
103 CHAP_ALGO_ID_CHAP_MD5 = 5,
104 CHAP_ALGO_ID_MS_CHAP = 128,
105 CHAP_ALGO_ID_MS_CHAP_V2 = 129
110#if defined(__CWCC__) || defined(_WIN32)
111 #pragma pack(push, 1)
126} ChapChallengePacket;
170#if defined(__CWCC__) || defined(_WIN32)
187 uint8_t challenge[16];
193error_t chapStartAuth(PppContext *context);
194error_t chapAbortAuth(PppContext *context);
196void chapTick(PppContext *context);
198void chapProcessPacket(PppContext *context,
199 const PppPacket *packet,
size_t length);
201error_t chapProcessChallenge(PppContext *context,
202 const ChapChallengePacket *challengePacket,
size_t length);
204error_t chapProcessResponse(PppContext *context,
205 const ChapResponsePacket *responsePacket,
size_t length);
207error_t chapProcessSuccess(PppContext *context,
208 const ChapSuccessPacket *successPacket,
size_t length);
210error_t chapProcessFailure(PppContext *context,
211 const ChapFailurePacket *failurePacket,
size_t length);
213error_t chapSendChallenge(PppContext *context);
214error_t chapSendResponse(PppContext *context,
const uint8_t *value);
215error_t chapSendSuccess(PppContext *context);
216error_t chapSendFailure(PppContext *context);
218bool_t chapCheckPassword(PppContext *context,
const char_t *password);
ChapState
CHAP states.
Definition chap.h:70
ChapCode
Code field values.
Definition chap.h:89
@ CHAP_CODE_RESPONSE
Response.
Definition chap.h:91
@ CHAP_CODE_SUCCESS
Success.
Definition chap.h:92
@ CHAP_CODE_CHALLENGE
Challenge.
Definition chap.h:90
@ CHAP_CODE_FAILURE
Failure.
Definition chap.h:93
ChapAlgoId
CHAP algorithm identifiers.
Definition chap.h:102
typedef __packed_struct
Challenge packet.
Definition chap.h:120
error_t
Error codes.
Definition error.h:43
uint32_t systime_t
System time.
Definition os_port_none.h:90
PPP (Point-to-Point Protocol)
CHAP finite state machine.
Definition chap.h:180
uint8_t localIdentifier
Identifier used to match requests and replies.
Definition chap.h:182
uint_t localState
Local state.
Definition chap.h:181
systime_t timestamp
Timestamp to manage retransmissions.
Definition chap.h:186
uint_t peerState
Peer state.
Definition chap.h:183
uint_t restartCounter
Restart counter.
Definition chap.h:185
uint8_t peerIdentifier
Identifier used to match requests and replies.
Definition chap.h:184
const uint8_t * response
Response value from the peer.
Definition chap.h:188