1
8
9
10
11
12
13
14
15
16
17
18
19
22
23
26
27
35
36
39
40
41
44
45
46
49
50
51
54
55
56
57
58
59
65
66
69
70
71
74
75
76
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
268
269
275
276
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
/* ... */
#ifndef EAP_I_H
#define EAP_I_H
#include "utils/wpabuf.h"
#include "eap.h"
#include "eap_common.h"
#include "eap_config.h"
typedef enum {
DECISION_FAIL, DECISION_COND_SUCC, DECISION_UNCOND_SUCC
}{ ... } EapDecision;
typedef enum {
METHOD_NONE, METHOD_INIT, METHOD_CONT, METHOD_MAY_CONT, METHOD_DONE
}{ ... } EapMethodState;
/* ... */
struct eap_method_ret {
/* ... */
Boolean ignore;
/* ... */
EapMethodState methodState;
/* ... */
EapDecision decision;
/* ... */
Boolean allowNotifications;
}{ ... };
struct eap_sm;
/* ... */
struct eap_method {
/* ... */
int vendor;
/* ... */
EapType method;
/* ... */
const char *name;
/* ... */
void * (*init)(struct eap_sm *sm);
/* ... */
void (*deinit)(struct eap_sm *sm, void *priv);
/* ... */
struct wpabuf * (*process)(struct eap_sm *sm, void *priv,
struct eap_method_ret *ret,
const struct wpabuf *reqData);
bool (*isKeyAvailable)(struct eap_sm *sm, void *priv);
u8 * (*getKey)(struct eap_sm *sm, void *priv, size_t *len);
/* ... */
int (*get_status)(struct eap_sm *sm, void *priv, char *buf,
size_t buflen, int verbose);
/* ... */
bool (*has_reauth_data)(struct eap_sm *sm, void *priv);
/* ... */
void (*deinit_for_reauth)(struct eap_sm *sm, void *priv);
/* ... */
void * (*init_for_reauth)(struct eap_sm *sm, void *priv);
/* ... */
const u8 * (*get_identity)(struct eap_sm *sm, void *priv, size_t *len);
/* ... */
void (*free)(struct eap_method *method);
#define EAP_PEER_METHOD_INTERFACE_VERSION 1
/* ... */
int version;
/* ... */
struct eap_method *next;
#ifdef CONFIG_DYNAMIC_EAP_METHODS
/* ... */
void *dl_handle;/* ... */
#endif
/* ... */
u8 * (*get_emsk)(struct eap_sm *sm, void *priv, size_t *len);
/* ... */
u8 * (*getSessionId)(struct eap_sm *sm, void *priv, size_t *len);
}{ ... };
#define CLIENT_CERT_NAME "CLC"
#define CA_CERT_NAME "CAC"
#define PRIVATE_KEY_NAME "PVK"
#define PAC_FILE_NAME "PAC"
#define BLOB_NAME_LEN 3
#define BLOB_NUM 46 defines
enum SIG_WPA2 {
SIG_WPA2_START = 0,
SIG_WPA2_RX,
SIG_WPA2_TASK_DEL,
SIG_WPA2_MAX,
}{ ... };
/* ... */
struct eap_sm {
Boolean changed;
void *eapol_ctx;
const struct eapol_callbacks *eapol_cb;
void *eap_method_priv;
int init_phase2;
void *msg_ctx;
void *ssl_ctx;
unsigned int workaround;
struct pbuf *outbuf;
struct wpa_config_blob blob[BLOB_NUM];
struct eap_peer_config config;
u8 current_identifier;
u8 ownaddr[ETH_ALEN];
#ifdef USE_WPA2_TASK
u8 wpa2_sig_cnt[SIG_WPA2_MAX];
#endif
u8 finish_state;
u8 *peer_challenge, *auth_challenge;
unsigned int expected_failure:1;
unsigned int ext_cert_check:1;
unsigned int waiting_ext_cert_check:1;
bool peap_done;
u8 *eapKeyData;
size_t eapKeyDataLen;
struct wpabuf *lastRespData;
const struct eap_method *m;
}{ ... };
typedef enum {
WPA2_STATE_ENABLED = 0,
WPA2_STATE_DISABLED,
}{ ... } wpa2_state_t;
const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len);
const u8 * eap_get_config_password(struct eap_sm *sm, size_t *len);
const u8 * eap_get_config_password2(struct eap_sm *sm, size_t *len, int *hash);
const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len);
const u8 * eap_get_config_otp(struct eap_sm *sm, size_t *len);
void eap_clear_config_otp(struct eap_sm *sm);
const char * eap_get_config_phase1(struct eap_sm *sm);
const char * eap_get_config_phase2(struct eap_sm *sm);
int eap_get_config_fragment_size(struct eap_sm *sm);
struct eap_peer_config * eap_get_config(struct eap_sm *sm);
void eap_set_config_blob(struct eap_sm *sm, struct wpa_config_blob *blob);
const struct wpa_config_blob * eap_get_config_blob(struct eap_sm *sm, const char *name);
int eap_allowed_method(struct eap_sm *sm, int vendor, u32 method);
bool wifi_sta_get_enterprise_disable_time_check(void);
struct wpabuf * eap_sm_build_identity_resp(struct eap_sm *sm, u8 id, int encrypted);
/* ... */
#endif