supplicant.h
Go to the documentation of this file.
1 /**
2  * @file supplicant.h
3  * @brief 802.1X supplicant
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2022-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneEAP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _SUPPLICANT_H
32 #define _SUPPLICANT_H
33 
34 //Forward declaration of SupplicantContext structure
35 struct _SupplicantContext;
36 #define SupplicantContext struct _SupplicantContext
37 
38 //Dependencies
39 #include "eap/eap.h"
40 #include "eap/eap_peer_fsm.h"
43 
44 //802.1X supplicant support
45 #ifndef SUPPLICANT_SUPPORT
46  #define SUPPLICANT_SUPPORT ENABLED
47 #elif (SUPPLICANT_SUPPORT != ENABLED && SUPPLICANT_SUPPORT != DISABLED)
48  #error SUPPLICANT_SUPPORT parameter is not valid
49 #endif
50 
51 //Stack size required to run the 802.1X supplicant
52 #ifndef SUPPLICANT_STACK_SIZE
53  #define SUPPLICANT_STACK_SIZE 750
54 #elif (SUPPLICANT_STACK_SIZE < 1)
55  #error SUPPLICANT_STACK_SIZE parameter is not valid
56 #endif
57 
58 //Priority at which the 802.1X supplicant should run
59 #ifndef SUPPLICANT_PRIORITY
60  #define SUPPLICANT_PRIORITY OS_TASK_PRIORITY_NORMAL
61 #endif
62 
63 //802.1X supplicant tick interval (in milliseconds)
64 #ifndef SUPPLICANT_TICK_INTERVAL
65  #define SUPPLICANT_TICK_INTERVAL 1000
66 #elif (SUPPLICANT_TICK_INTERVAL < 10)
67  #error SUPPLICANT_TICK_INTERVAL parameter is not valid
68 #endif
69 
70 //Size of the transmission buffer
71 #ifndef SUPPLICANT_TX_BUFFER_SIZE
72  #define SUPPLICANT_TX_BUFFER_SIZE 3000
73 #elif (SUPPLICANT_TX_BUFFER_SIZE < 1)
74  #error SUPPLICANT_TX_BUFFER_SIZE parameter is not valid
75 #endif
76 
77 //Size of the reception buffer
78 #ifndef SUPPLICANT_RX_BUFFER_SIZE
79  #define SUPPLICANT_RX_BUFFER_SIZE 1500
80 #elif (SUPPLICANT_RX_BUFFER_SIZE < 1)
81  #error SUPPLICANT_RX_BUFFER_SIZE parameter is not valid
82 #endif
83 
84 //Maximum length of user name
85 #ifndef SUPPLICANT_MAX_USERNAME_LEN
86  #define SUPPLICANT_MAX_USERNAME_LEN 64
87 #elif (SUPPLICANT_MAX_USERNAME_LEN < 1)
88  #error SUPPLICANT_MAX_USERNAME_LEN parameter is not valid
89 #endif
90 
91 //Maximum length of password
92 #ifndef SUPPLICANT_MAX_PASSWORD_LEN
93  #define SUPPLICANT_MAX_PASSWORD_LEN 64
94 #elif (SUPPLICANT_MAX_PASSWORD_LEN < 1)
95  #error SUPPLICANT_MAX_PASSWORD_LEN parameter is not valid
96 #endif
97 
98 //Initialization value used for the heldWhile timer
99 #ifndef SUPPLICANT_DEFAULT_HELD_PERIOD
100  #define SUPPLICANT_DEFAULT_HELD_PERIOD 60
101 #elif (SUPPLICANT_DEFAULT_HELD_PERIOD < 0)
102  #error SUPPLICANT_DEFAULT_HELD_PERIOD parameter is not valid
103 #endif
104 
105 //Initialization value used for the authWhile timer
106 #ifndef SUPPLICANT_DEFAULT_AUTH_PERIOD
107  #define SUPPLICANT_DEFAULT_AUTH_PERIOD 30
108 #elif (SUPPLICANT_DEFAULT_AUTH_PERIOD < 0)
109  #error SUPPLICANT_DEFAULT_AUTH_PERIOD parameter is not valid
110 #endif
111 
112 //Initialization value used for the startWhen timer
113 #ifndef SUPPLICANT_DEFAULT_START_PERIOD
114  #define SUPPLICANT_DEFAULT_START_PERIOD 30
115 #elif (SUPPLICANT_DEFAULT_START_PERIOD < 0)
116  #error SUPPLICANT_DEFAULT_START_PERIOD parameter is not valid
117 #endif
118 
119 //Maximum number of successive EAPOL-Start messages
120 #ifndef SUPPLICANT_DEFAULT_MAX_START
121  #define SUPPLICANT_DEFAULT_MAX_START 3
122 #elif (SUPPLICANT_DEFAULT_MAX_START < 0)
123  #error SUPPLICANT_DEFAULT_MAX_START parameter is not valid
124 #endif
125 
126 //EAP-TLS supported?
127 #if (EAP_TLS_SUPPORT == ENABLED)
128  #include "core/crypto.h"
129  #include "tls.h"
130 #endif
131 
132 //C++ guard
133 #ifdef __cplusplus
134 extern "C" {
135 #endif
136 
137 //EAP-TLS supported?
138 #if (EAP_TLS_SUPPORT == ENABLED)
139 
140 /**
141  * @brief TLS negotiation initialization callback function
142  **/
143 
146 
147 /**
148  * @brief TLS negotiation completion callback function
149  **/
150 
152  TlsContext *tlsContext, error_t error);
153 
154 #endif
155 
156 
157 /**
158  * @brief Supplicant PAE state change callback function
159  **/
160 
162  SupplicantPaeState state);
163 
164 
165 /**
166  * @brief Supplicant backend state change callback function
167  **/
168 
170  SupplicantBackendState state);
171 
172 
173 /**
174  * @brief EAP peer state change callback function
175  **/
176 
178  EapPeerState state);
179 
180 
181 /**
182  * @brief Tick callback function
183  **/
184 
185 typedef void (*SupplicantTickCallback)(SupplicantContext *context);
186 
187 
188 /**
189  * @brief 802.1X supplicant settings
190  **/
191 
192 typedef struct
193 {
194  OsTaskParameters task; ///<Task parameters
195  NetInterface *interface; ///<Underlying network interface
196  uint_t portIndex; ///<Port index
197 #if (EAP_TLS_SUPPORT == ENABLED)
198  SupplicantTlsInitCallback tlsInitCallback; ///<TLS negotiation initialization callback function
199  SupplicantTlsCompleteCallback tlsCompleteCallback; ///<TLS negotiation completion callback function
200 #endif
201  SupplicantPaeStateChangeCallback paeStateChangeCallback; ///<Supplicant PAE state change callback function
202  SupplicantBackendStateChangeCallback backendStateChangeCallback; ///<Supplicant backend state change callback function
203  EapPeerStateChangeCallback eapPeerStateChangeCallback; ///<EAP peer state change callback function
204  SupplicantTickCallback tickCallback; ///<Tick callback function
206 
207 
208 /**
209  * @brief 802.1X supplicant context
210  **/
211 
213 {
214  bool_t running; ///<Operational state of the supplicant
215  bool_t stop; ///<Stop request
216  OsMutex mutex; ///<Mutex preventing simultaneous access to 802.1X supplicant context
217  OsEvent event; ///<Event object used to poll the underlying socket
218  OsTaskParameters taskParams; ///<Task parameters
219  OsTaskId taskId; ///<Task identifier
220  NetInterface *interface; ///<Underlying network interface
221  uint_t portIndex; ///<Port index
222  Socket *socket; ///<Underlying socket
224 #if (EAP_MD5_SUPPORT == ENABLED)
226  uint8_t digest[MD5_DIGEST_SIZE]; ///<Calculated hash value
227 #endif
228 #if (EAP_TLS_SUPPORT == ENABLED)
229  TlsContext *tlsContext; ///<TLS context
230  TlsSessionState tlsSession; ///<TLS session state
231  SupplicantTlsInitCallback tlsInitCallback; ///<TLS negotiation initialization callback function
232  SupplicantTlsCompleteCallback tlsCompleteCallback; ///<TLS negotiation completion callback function
233 #endif
234  SupplicantPaeStateChangeCallback paeStateChangeCallback; ///<Supplicant PAE state change callback function
235  SupplicantBackendStateChangeCallback backendStateChangeCallback; ///<Supplicant backend state change callback function
236  EapPeerStateChangeCallback eapPeerStateChangeCallback; ///<EAP peer state change callback function
237  SupplicantTickCallback tickCallback; ///<Tick callback function
238  systime_t timestamp; ///<Timestamp to manage timeout
239 
240  uint8_t txBuffer[SUPPLICANT_TX_BUFFER_SIZE]; ///<Transmission buffer
243  size_t txBufferLen;
244  uint8_t rxBuffer[SUPPLICANT_TX_BUFFER_SIZE]; ///<Reception buffer
245  size_t rxBufferPos;
246  size_t rxBufferLen;
247 
248  SupplicantPaeState suppPaeState; ///<Supplicant PAE state
249  SupplicantBackendState suppBackendState; ///<Supplicant backend state
250 
251  uint_t authWhile; ///<Timer used by the supplicant backend state machine (8.2.2.1 a)
252  uint_t heldWhile; ///<Timer used by the supplicant PAE state machine (8.2.2.1 c)
253  uint_t startWhen; ///<Timer used by the supplicant PAE state machine (8.2.2.1 f)
254 
255  bool_t eapFail; ///<The authentication has failed (8.2.2.2 g)
256  bool_t eapolEap; ///<EAPOL PDU carrying a packet Type of EAP-Packet is received (8.2.2.2 h)
257  bool_t eapSuccess; ///<The authentication process succeeds (8.2.2.2 i)
258  bool_t initialize; ///<Forces all EAPOL state machines to their initial state (8.2.2.2 k)
259  bool_t keyDone; ///<Variable set by the key machine (8.2.2.2 m)
260  bool_t keyRun; ///<Variable set by the PACP machine (8.2.2.2 n)
261  SupplicantPortMode portControl; ///<Port control (8.2.2.2 p)
262  bool_t portEnabled; ///<Operational state of the port (8.2.2.2 q)
263  bool_t portValid; ///<The value of this variable is set externally (8.2.2.2 s)
264  bool_t suppAbort; ///<Aborts an authentication sequence (8.2.2.2 u)
265  bool_t suppFail; ///<Unsuccessful authentication sequence (8.2.2.2 v)
266  SupplicantPortStatus suppPortStatus; ///<Current authorization state of the supplicant PAE state machine (8.2.2.2 w)
267  bool_t suppStart; ///<Start an authentication sequence (8.2.2.2 x)
268  bool_t suppSuccess; ///<Successful authentication sequence (8.2.2.2 y)
269  bool_t suppTimeout; ///<The authentication sequence has timed out (8.2.2.2 z)
270 
271  bool_t eapRestart; ///<The higher layer is ready to establish an authentication session (8.2.11.1.1 a)
272  bool_t logoffSent; ///<An EAPOL-Logoff message has been sent (8.2.11.1.1 b)
273  SupplicantPortMode sPortMode; ///<Used to switch between the auto and non-auto modes of operation (8.2.11.1.1 c)
274  uint_t startCount; ///<Number of EAPOL-Start messages that have been sent (8.2.11.1.1 d)
275  bool_t userLogoff; ///<The user is logged off (8.2.11.1.1 e)
276 
277  uint_t heldPeriod; ///<Initialization value used for the heldWhile timer (8.2.11.1.2 a)
278  uint_t startPeriod; ///<Initialization value used for the startWhen timer (8.2.11.1.2 b)
279  uint_t maxStart; ///<Maximum number of successive EAPOL-Start messages that will be sent (8.2.11.1.2 c)
280 
281  bool_t eapNoResp; ///<No EAP Response for the last EAP frame delivered to EAP (8.2.12.1.1 a)
282  bool_t eapReq; ///<An EAP frame is available for processing by EAP (8.2.12.1.1 b)
283  bool_t eapResp; ///<An EAP frame available for transmission to authenticator (8.2.12.1.1 c)
284 
285  uint_t authPeriod; ///<Initialization value used for the authWhile timer (8.2.12.1.2 a)
286 
287  EapPeerState eapPeerState; ///<EAP peer state
288 
290  const uint8_t *eapReqData; ///<Contents of the EAP request (4.1.1)
291  size_t eapReqDataLen; ///<Length of the EAP request
292  uint_t idleWhile; ///<Timer (4.1.1)
293  bool_t altAccept; ///<Alternate indication of success (4.1.1)
294  bool_t altReject; ///<Alternate indication of failure (4.1.1)
295  uint8_t *eapRespData; ///<EAP response to send (4.1.2)
296  size_t eapRespDataLen; ///<Length of the EAP response
297  uint8_t *eapKeyData; ///<EAP key (4.1.2)
298  bool_t eapKeyAvailable; ///<Keying material is available (4.1.2)
299  uint_t clientTimeout; ///<Time to wait for a valid request before aborting (4.1.3)
300 
301  EapMethodType selectedMethod; ///<The method currently in progress (4.3.1)
302  EapMethodState methodState; ///<Method state (4.3.1)
303  uint_t lastId; ///<EAP identifier value of the last request (4.3.1)
304  uint8_t *lastRespData; ///<Last EAP packet sent from the peer (4.3.1)
305  size_t lastRespDataLen; ///<Length of the last EAP response
306  EapDecision decision; ///<Decision (4.3.1)
307 
308  bool_t rxReq; ///<The current received packet is an EAP Request (4.3.2)
309  bool_t rxSuccess; ///<The current received packet is an EAP Success (4.3.2)
310  bool_t rxFailure; ///<The current received packet is an EAP Failure (4.3.2)
311  uint_t reqId; ///<Identifier value associated with the current EAP request (4.3.2)
312  EapMethodType reqMethod; ///<Method type of the current EAP request (4.3.2)
313  bool_t ignore; ///<Drop the current packet (4.3.2)
314 
315  bool_t allowCanned; ///<Allow canned EAP Success and Failure packets
316  bool_t busy; ///<Busy flag
317 };
318 
319 
320 //Supplicant related functions
322 
324  const SupplicantSettings *settings);
325 
327  const char_t *username);
328 
330  const char_t *password);
331 
336 
338  uint_t clientTimeout);
339 
341  SupplicantPortMode portControl);
342 
345 
348 
349 void supplicantTask(SupplicantContext *context);
350 
351 void supplicantDeinit(SupplicantContext *context);
352 
353 //C++ guard
354 #ifdef __cplusplus
355 }
356 #endif
357 
358 #endif
bool_t keyRun
Variable set by the PACP machine (8.2.2.2 n)
Definition: supplicant.h:260
OsTaskParameters taskParams
Task parameters.
Definition: supplicant.h:218
error_t supplicantLogOff(SupplicantContext *context)
Perform user logoff.
Definition: supplicant.c:439
SupplicantPortMode
Port modes.
bool_t stop
Stop request.
Definition: supplicant.h:215
uint_t heldPeriod
Initialization value used for the heldWhile timer (8.2.11.1.2 a)
Definition: supplicant.h:277
bool_t suppTimeout
The authentication sequence has timed out (8.2.2.2 z)
Definition: supplicant.h:269
int bool_t
Definition: compiler_port.h:53
uint_t maxStart
Maximum number of successive EAPOL-Start messages that will be sent (8.2.11.1.2 c)
Definition: supplicant.h:279
EapMethodType
EAP method types.
Definition: eap.h:164
uint8_t txBuffer[SUPPLICANT_TX_BUFFER_SIZE]
Transmission buffer.
Definition: supplicant.h:240
void supplicantTask(SupplicantContext *context)
802.1X supplicant task
Definition: supplicant.c:614
uint_t idleWhile
Timer (4.1.1)
Definition: supplicant.h:292
size_t lastRespDataLen
Length of the last EAP response.
Definition: supplicant.h:305
bool_t rxSuccess
The current received packet is an EAP Success (4.3.2)
Definition: supplicant.h:309
SupplicantPortStatus
Port status.
OsTaskParameters task
Task parameters.
Definition: supplicant.h:194
bool_t portValid
The value of this variable is set externally (8.2.2.2 s)
Definition: supplicant.h:263
error_t supplicantSetHeldPeriod(SupplicantContext *context, uint_t heldPeriod)
Set the value of the heldPeriod parameter.
Definition: supplicant.c:237
error_t supplicantSetAuthPeriod(SupplicantContext *context, uint_t authPeriod)
Set the value of the authPeriod parameter.
Definition: supplicant.c:262
uint8_t * eapKeyData
EAP key (4.1.2)
Definition: supplicant.h:297
Event object.
bool_t suppFail
Unsuccessful authentication sequence (8.2.2.2 v)
Definition: supplicant.h:265
#define SupplicantContext
Definition: supplicant.h:36
bool_t userLogoff
The user is logged off (8.2.11.1.1 e)
Definition: supplicant.h:275
SupplicantPortMode sPortMode
Used to switch between the auto and non-auto modes of operation (8.2.11.1.1 c)
Definition: supplicant.h:273
uint_t clientTimeout
Time to wait for a valid request before aborting (4.1.3)
Definition: supplicant.h:299
EapPeerStateChangeCallback eapPeerStateChangeCallback
EAP peer state change callback function.
Definition: supplicant.h:203
error_t supplicantStart(SupplicantContext *context)
Start 802.1X supplicant.
Definition: supplicant.c:473
uint_t heldWhile
Timer used by the supplicant PAE state machine (8.2.2.1 c)
Definition: supplicant.h:252
SupplicantTickCallback tickCallback
Tick callback function.
Definition: supplicant.h:237
error_t supplicantInit(SupplicantContext *context, const SupplicantSettings *settings)
Initialize 802.1X supplicant context.
Definition: supplicant.c:86
TlsContext * tlsContext
TLS context.
Definition: supplicant.h:229
bool_t eapolEap
EAPOL PDU carrying a packet Type of EAP-Packet is received (8.2.2.2 h)
Definition: supplicant.h:256
Supplicant backend state machine.
error_t supplicantSetPassword(SupplicantContext *context, const char_t *password)
Set password.
Definition: supplicant.c:206
EapMethodState
EAP method states.
uint_t startPeriod
Initialization value used for the startWhen timer (8.2.11.1.2 b)
Definition: supplicant.h:278
SupplicantPortStatus suppPortStatus
Current authorization state of the supplicant PAE state machine (8.2.2.2 w)
Definition: supplicant.h:266
bool_t logoffSent
An EAPOL-Logoff message has been sent (8.2.11.1.1 b)
Definition: supplicant.h:272
bool_t eapNoResp
No EAP Response for the last EAP frame delivered to EAP (8.2.12.1.1 a)
Definition: supplicant.h:281
SupplicantPaeState
Supplicant PAE states.
size_t txBufferWritePos
Definition: supplicant.h:241
error_t supplicantSetStartPeriod(SupplicantContext *context, uint_t startPeriod)
Set the value of the startPeriod parameter.
Definition: supplicant.c:287
SupplicantPortMode portControl
Port control (8.2.2.2 p)
Definition: supplicant.h:261
OsEvent event
Event object used to poll the underlying socket.
Definition: supplicant.h:217
bool_t altAccept
Alternate indication of success (4.1.1)
Definition: supplicant.h:293
uint_t portIndex
Port index.
Definition: supplicant.h:221
NetInterface * interface
Underlying network interface.
Definition: supplicant.h:220
uint8_t rxBuffer[SUPPLICANT_TX_BUFFER_SIZE]
Reception buffer.
Definition: supplicant.h:244
uint8_t * eapRespData
EAP response to send (4.1.2)
Definition: supplicant.h:295
EapMethodState methodState
Method state (4.3.1)
Definition: supplicant.h:302
NetInterface * interface
Underlying network interface.
Definition: supplicant.h:195
OsTaskId taskId
Task identifier.
Definition: supplicant.h:219
void(* EapPeerStateChangeCallback)(SupplicantContext *context, EapPeerState state)
EAP peer state change callback function.
Definition: supplicant.h:177
#define TlsContext
Definition: tls.h:36
char_t password[SUPPLICANT_MAX_PASSWORD_LEN]
Password.
Definition: supplicant.h:225
error_t
Error codes.
Definition: error.h:43
TlsSessionState tlsSession
TLS session state.
Definition: supplicant.h:230
uint_t authPeriod
Initialization value used for the authWhile timer (8.2.12.1.2 a)
Definition: supplicant.h:285
bool_t eapResp
An EAP frame available for transmission to authenticator (8.2.12.1.1 c)
Definition: supplicant.h:283
bool_t allowNotifications
Definition: supplicant.h:289
EapMethodType reqMethod
Method type of the current EAP request (4.3.2)
Definition: supplicant.h:312
SupplicantTlsCompleteCallback tlsCompleteCallback
TLS negotiation completion callback function.
Definition: supplicant.h:199
uint_t startCount
Number of EAPOL-Start messages that have been sent (8.2.11.1.1 d)
Definition: supplicant.h:274
802.1X supplicant context
Definition: supplicant.h:213
void(* SupplicantBackendStateChangeCallback)(SupplicantContext *context, SupplicantBackendState state)
Supplicant backend state change callback function.
Definition: supplicant.h:169
size_t eapRespDataLen
Length of the EAP response.
Definition: supplicant.h:296
#define SUPPLICANT_TX_BUFFER_SIZE
Definition: supplicant.h:72
#define NetInterface
Definition: net.h:36
EapPeerStateChangeCallback eapPeerStateChangeCallback
EAP peer state change callback function.
Definition: supplicant.h:236
SupplicantBackendState suppBackendState
Supplicant backend state.
Definition: supplicant.h:249
EapDecision decision
Decision (4.3.1)
Definition: supplicant.h:306
General definitions for cryptographic algorithms.
bool_t ignore
Drop the current packet (4.3.2)
Definition: supplicant.h:313
Task parameters.
size_t eapReqDataLen
Length of the EAP request.
Definition: supplicant.h:291
bool_t portEnabled
Operational state of the port (8.2.2.2 q)
Definition: supplicant.h:262
#define SUPPLICANT_MAX_PASSWORD_LEN
Definition: supplicant.h:93
bool_t eapReq
An EAP frame is available for processing by EAP (8.2.12.1.1 b)
Definition: supplicant.h:282
uint_t authWhile
Timer used by the supplicant backend state machine (8.2.2.1 a)
Definition: supplicant.h:251
bool_t eapKeyAvailable
Keying material is available (4.1.2)
Definition: supplicant.h:298
size_t txBufferReadPos
Definition: supplicant.h:242
#define MD5_DIGEST_SIZE
Definition: md5.h:45
error_t(* SupplicantTlsInitCallback)(SupplicantContext *context, TlsContext *tlsContext)
TLS negotiation initialization callback function.
Definition: supplicant.h:144
SupplicantBackendStateChangeCallback backendStateChangeCallback
Supplicant backend state change callback function.
Definition: supplicant.h:202
const uint8_t * eapReqData
Contents of the EAP request (4.1.1)
Definition: supplicant.h:290
Mutex object.
EapDecision
Decisions.
uint32_t systime_t
System time.
OsMutex mutex
Mutex preventing simultaneous access to 802.1X supplicant context.
Definition: supplicant.h:216
error_t supplicantSetPortControl(SupplicantContext *context, SupplicantPortMode portControl)
Set the value of the portControl variable.
Definition: supplicant.c:371
802.1X supplicant settings
Definition: supplicant.h:193
char char_t
Definition: compiler_port.h:48
SupplicantTlsInitCallback tlsInitCallback
TLS negotiation initialization callback function.
Definition: supplicant.h:231
void(* SupplicantPaeStateChangeCallback)(SupplicantContext *context, SupplicantPaeState state)
Supplicant PAE state change callback function.
Definition: supplicant.h:161
SupplicantTickCallback tickCallback
Tick callback function.
Definition: supplicant.h:204
SupplicantPaeStateChangeCallback paeStateChangeCallback
Supplicant PAE state change callback function.
Definition: supplicant.h:201
Socket * socket
Underlying socket.
Definition: supplicant.h:222
EapMethodType selectedMethod
The method currently in progress (4.3.1)
Definition: supplicant.h:301
TLS session state.
Definition: tls.h:2038
char_t username[SUPPLICANT_MAX_USERNAME_LEN]
User name.
Definition: supplicant.h:223
Supplicant PAE state machine.
void supplicantGetDefaultSettings(SupplicantSettings *settings)
Initialize settings with default values.
Definition: supplicant.c:49
error_t supplicantSetMaxStart(SupplicantContext *context, uint_t maxStart)
Set the value of the maxStart parameter.
Definition: supplicant.c:312
#define Socket
Definition: socket.h:36
void(* SupplicantTlsCompleteCallback)(SupplicantContext *context, TlsContext *tlsContext, error_t error)
TLS negotiation completion callback function.
Definition: supplicant.h:151
#define SUPPLICANT_MAX_USERNAME_LEN
Definition: supplicant.h:86
uint_t portIndex
Port index.
Definition: supplicant.h:196
bool_t keyDone
Variable set by the key machine (8.2.2.2 m)
Definition: supplicant.h:259
uint8_t * lastRespData
Last EAP packet sent from the peer (4.3.1)
Definition: supplicant.h:304
void(* SupplicantTickCallback)(SupplicantContext *context)
Tick callback function.
Definition: supplicant.h:185
TLS (Transport Layer Security)
SupplicantPaeStateChangeCallback paeStateChangeCallback
Supplicant PAE state change callback function.
Definition: supplicant.h:234
bool_t allowCanned
Allow canned EAP Success and Failure packets.
Definition: supplicant.h:315
error_t supplicantSetUsername(SupplicantContext *context, const char_t *username)
Set user name.
Definition: supplicant.c:180
bool_t rxReq
The current received packet is an EAP Request (4.3.2)
Definition: supplicant.h:308
systime_t timestamp
Timestamp to manage timeout.
Definition: supplicant.h:238
bool_t eapRestart
The higher layer is ready to establish an authentication session (8.2.11.1.1 a)
Definition: supplicant.h:271
bool_t eapFail
The authentication has failed (8.2.2.2 g)
Definition: supplicant.h:255
uint8_t digest[MD5_DIGEST_SIZE]
Calculated hash value.
Definition: supplicant.h:226
SupplicantTlsInitCallback tlsInitCallback
TLS negotiation initialization callback function.
Definition: supplicant.h:198
bool_t altReject
Alternate indication of failure (4.1.1)
Definition: supplicant.h:294
thread_t * OsTaskId
Task identifier.
error_t supplicantLogOn(SupplicantContext *context)
Perform user logon.
Definition: supplicant.c:405
bool_t busy
Busy flag.
Definition: supplicant.h:316
SupplicantBackendStateChangeCallback backendStateChangeCallback
Supplicant backend state change callback function.
Definition: supplicant.h:235
uint_t reqId
Identifier value associated with the current EAP request (4.3.2)
Definition: supplicant.h:311
bool_t suppStart
Start an authentication sequence (8.2.2.2 x)
Definition: supplicant.h:267
bool_t rxFailure
The current received packet is an EAP Failure (4.3.2)
Definition: supplicant.h:310
unsigned int uint_t
Definition: compiler_port.h:50
error_t supplicantStop(SupplicantContext *context)
Stop 802.1X supplicant.
Definition: supplicant.c:571
SupplicantBackendState
Supplicant backend states.
EAP (Extensible Authentication Protocol)
bool_t suppAbort
Aborts an authentication sequence (8.2.2.2 u)
Definition: supplicant.h:264
void supplicantDeinit(SupplicantContext *context)
Release 802.1X supplicant context.
Definition: supplicant.c:699
uint_t startWhen
Timer used by the supplicant PAE state machine (8.2.2.1 f)
Definition: supplicant.h:253
SupplicantPaeState suppPaeState
Supplicant PAE state.
Definition: supplicant.h:248
bool_t initialize
Forces all EAPOL state machines to their initial state (8.2.2.2 k)
Definition: supplicant.h:258
uint_t lastId
EAP identifier value of the last request (4.3.1)
Definition: supplicant.h:303
bool_t running
Operational state of the supplicant.
Definition: supplicant.h:214
bool_t eapSuccess
The authentication process succeeds (8.2.2.2 i)
Definition: supplicant.h:257
error_t supplicantSetClientTimeout(SupplicantContext *context, uint_t clientTimeout)
Set the value of the clientTimeout parameter.
Definition: supplicant.c:345
EapPeerState eapPeerState
EAP peer state.
Definition: supplicant.h:287
SupplicantTlsCompleteCallback tlsCompleteCallback
TLS negotiation completion callback function.
Definition: supplicant.h:232
EAP peer state machine.
bool_t suppSuccess
Successful authentication sequence (8.2.2.2 y)
Definition: supplicant.h:268
EapPeerState
EAP peer states.
Definition: eap_peer_fsm.h:53