blob: a96655f7786e98e4baf021d4cf05b80d9ea84365 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * RSN pre-authentication (supplicant)
Dmitry Shmidt40b07202015-01-27 13:40:23 -08003 * Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#include "includes.h"
10
11#include "common.h"
12#include "wpa.h"
13#include "eloop.h"
14#include "l2_packet/l2_packet.h"
15#include "eapol_supp/eapol_supp_sm.h"
16#include "preauth.h"
17#include "pmksa_cache.h"
18#include "wpa_i.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070019
20
Dmitry Shmidt1d6bf422016-01-19 15:51:35 -080021#if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070022
23#define PMKID_CANDIDATE_PRIO_SCAN 1000
24
25
26struct rsn_pmksa_candidate {
27 struct dl_list list;
28 u8 bssid[ETH_ALEN];
29 int priority;
30};
31
32
33/**
34 * pmksa_candidate_free - Free all entries in PMKSA candidate list
35 * @sm: Pointer to WPA state machine data from wpa_sm_init()
36 */
37void pmksa_candidate_free(struct wpa_sm *sm)
38{
39 struct rsn_pmksa_candidate *entry, *n;
40
41 if (sm == NULL)
42 return;
43
44 dl_list_for_each_safe(entry, n, &sm->pmksa_candidates,
45 struct rsn_pmksa_candidate, list) {
46 dl_list_del(&entry->list);
47 os_free(entry);
48 }
49}
50
51
Hai Shalomfdcde762020-04-02 11:19:20 -070052static int rsn_preauth_key_mgmt(int akmp)
53{
54 return !!(akmp & (WPA_KEY_MGMT_IEEE8021X |
55 WPA_KEY_MGMT_IEEE8021X_SHA256 |
56 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
57 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192));
58}
59
60
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070061static void rsn_preauth_receive(void *ctx, const u8 *src_addr,
62 const u8 *buf, size_t len)
63{
64 struct wpa_sm *sm = ctx;
65
66 wpa_printf(MSG_DEBUG, "RX pre-auth from " MACSTR, MAC2STR(src_addr));
67 wpa_hexdump(MSG_MSGDUMP, "RX pre-auth", buf, len);
68
69 if (sm->preauth_eapol == NULL ||
70 is_zero_ether_addr(sm->preauth_bssid) ||
71 os_memcmp(sm->preauth_bssid, src_addr, ETH_ALEN) != 0) {
72 wpa_printf(MSG_WARNING, "RSN pre-auth frame received from "
73 "unexpected source " MACSTR " - dropped",
74 MAC2STR(src_addr));
75 return;
76 }
77
Sunil8cd6f4d2022-06-28 18:40:46 +000078 eapol_sm_rx_eapol(sm->preauth_eapol, src_addr, buf, len,
79 FRAME_ENCRYPTION_UNKNOWN);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070080}
81
82
Dmitry Shmidt344abd32014-01-14 13:17:00 -080083static void rsn_preauth_eapol_cb(struct eapol_sm *eapol,
84 enum eapol_supp_result result,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070085 void *ctx)
86{
87 struct wpa_sm *sm = ctx;
88 u8 pmk[PMK_LEN];
89
Dmitry Shmidt344abd32014-01-14 13:17:00 -080090 if (result == EAPOL_SUPP_RESULT_SUCCESS) {
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070091 int res, pmk_len;
92 pmk_len = PMK_LEN;
93 res = eapol_sm_get_key(eapol, pmk, PMK_LEN);
94 if (res) {
95 /*
96 * EAP-LEAP is an exception from other EAP methods: it
97 * uses only 16-byte PMK.
98 */
99 res = eapol_sm_get_key(eapol, pmk, 16);
100 pmk_len = 16;
101 }
102 if (res == 0) {
103 wpa_hexdump_key(MSG_DEBUG, "RSN: PMK from pre-auth",
104 pmk, pmk_len);
105 sm->pmk_len = pmk_len;
Dmitry Shmidt57c2d392016-02-23 13:40:19 -0800106 pmksa_cache_add(sm->pmksa, pmk, pmk_len, NULL,
Dmitry Shmidtfb45fd52015-01-05 13:08:17 -0800107 NULL, 0,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700108 sm->preauth_bssid, sm->own_addr,
109 sm->network_ctx,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700110 WPA_KEY_MGMT_IEEE8021X, NULL);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700111 } else {
112 wpa_msg(sm->ctx->msg_ctx, MSG_INFO,
113 "RSN: failed to get master session key from "
114 "pre-auth EAPOL state machines");
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800115 result = EAPOL_SUPP_RESULT_FAILURE;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700116 }
117 }
118
119 wpa_msg(sm->ctx->msg_ctx, MSG_INFO, "RSN: pre-authentication with "
120 MACSTR " %s", MAC2STR(sm->preauth_bssid),
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800121 result == EAPOL_SUPP_RESULT_SUCCESS ? "completed successfully" :
122 "failed");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700123
124 rsn_preauth_deinit(sm);
125 rsn_preauth_candidate_process(sm);
126}
127
128
129static void rsn_preauth_timeout(void *eloop_ctx, void *timeout_ctx)
130{
131 struct wpa_sm *sm = eloop_ctx;
132
133 wpa_msg(sm->ctx->msg_ctx, MSG_INFO, "RSN: pre-authentication with "
134 MACSTR " timed out", MAC2STR(sm->preauth_bssid));
135 rsn_preauth_deinit(sm);
136 rsn_preauth_candidate_process(sm);
137}
138
139
140static int rsn_preauth_eapol_send(void *ctx, int type, const u8 *buf,
141 size_t len)
142{
143 struct wpa_sm *sm = ctx;
144 u8 *msg;
145 size_t msglen;
146 int res;
147
148 /* TODO: could add l2_packet_sendmsg that allows fragments to avoid
149 * extra copy here */
150
151 if (sm->l2_preauth == NULL)
152 return -1;
153
154 msg = wpa_sm_alloc_eapol(sm, type, buf, len, &msglen, NULL);
155 if (msg == NULL)
156 return -1;
157
158 wpa_hexdump(MSG_MSGDUMP, "TX EAPOL (preauth)", msg, msglen);
159 res = l2_packet_send(sm->l2_preauth, sm->preauth_bssid,
160 ETH_P_RSN_PREAUTH, msg, msglen);
161 os_free(msg);
162 return res;
163}
164
165
166/**
167 * rsn_preauth_init - Start new RSN pre-authentication
168 * @sm: Pointer to WPA state machine data from wpa_sm_init()
169 * @dst: Authenticator address (BSSID) with which to preauthenticate
170 * @eap_conf: Current EAP configuration
171 * Returns: 0 on success, -1 on another pre-authentication is in progress,
172 * -2 on layer 2 packet initialization failure, -3 on EAPOL state machine
173 * initialization failure, -4 on memory allocation failure
174 *
175 * This function request an RSN pre-authentication with a given destination
176 * address. This is usually called for PMKSA candidates found from scan results
177 * or from driver reports. In addition, ctrl_iface PREAUTH command can trigger
178 * pre-authentication.
179 */
180int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
181 struct eap_peer_config *eap_conf)
182{
183 struct eapol_config eapol_conf;
184 struct eapol_ctx *ctx;
Dmitry Shmidtaff761d2015-02-06 10:50:36 -0800185 int ret;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700186
187 if (sm->preauth_eapol)
188 return -1;
189
190 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG,
191 "RSN: starting pre-authentication with " MACSTR, MAC2STR(dst));
192
193 sm->l2_preauth = l2_packet_init(sm->ifname, sm->own_addr,
194 ETH_P_RSN_PREAUTH,
195 rsn_preauth_receive, sm, 0);
196 if (sm->l2_preauth == NULL) {
197 wpa_printf(MSG_WARNING, "RSN: Failed to initialize L2 packet "
198 "processing for pre-authentication");
199 return -2;
200 }
201
202 if (sm->bridge_ifname) {
203 sm->l2_preauth_br = l2_packet_init(sm->bridge_ifname,
204 sm->own_addr,
205 ETH_P_RSN_PREAUTH,
206 rsn_preauth_receive, sm, 0);
207 if (sm->l2_preauth_br == NULL) {
208 wpa_printf(MSG_WARNING, "RSN: Failed to initialize L2 "
209 "packet processing (bridge) for "
210 "pre-authentication");
Dmitry Shmidtaff761d2015-02-06 10:50:36 -0800211 ret = -2;
212 goto fail;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700213 }
214 }
215
216 ctx = os_zalloc(sizeof(*ctx));
217 if (ctx == NULL) {
218 wpa_printf(MSG_WARNING, "Failed to allocate EAPOL context.");
Dmitry Shmidtaff761d2015-02-06 10:50:36 -0800219 ret = -4;
220 goto fail;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700221 }
222 ctx->ctx = sm->ctx->ctx;
223 ctx->msg_ctx = sm->ctx->ctx;
224 ctx->preauth = 1;
225 ctx->cb = rsn_preauth_eapol_cb;
226 ctx->cb_ctx = sm;
227 ctx->scard_ctx = sm->scard_ctx;
228 ctx->eapol_send = rsn_preauth_eapol_send;
229 ctx->eapol_send_ctx = sm;
230 ctx->set_config_blob = sm->ctx->set_config_blob;
231 ctx->get_config_blob = sm->ctx->get_config_blob;
232
233 sm->preauth_eapol = eapol_sm_init(ctx);
234 if (sm->preauth_eapol == NULL) {
235 os_free(ctx);
236 wpa_printf(MSG_WARNING, "RSN: Failed to initialize EAPOL "
237 "state machines for pre-authentication");
Dmitry Shmidtaff761d2015-02-06 10:50:36 -0800238 ret = -3;
239 goto fail;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700240 }
241 os_memset(&eapol_conf, 0, sizeof(eapol_conf));
242 eapol_conf.accept_802_1x_keys = 0;
243 eapol_conf.required_keys = 0;
244 eapol_conf.fast_reauth = sm->fast_reauth;
245 eapol_conf.workaround = sm->eap_workaround;
246 eapol_sm_notify_config(sm->preauth_eapol, eap_conf, &eapol_conf);
247 /*
248 * Use a shorter startPeriod with preauthentication since the first
249 * preauth EAPOL-Start frame may end up being dropped due to race
250 * condition in the AP between the data receive and key configuration
251 * after the 4-Way Handshake.
252 */
253 eapol_sm_configure(sm->preauth_eapol, -1, -1, 5, 6);
254 os_memcpy(sm->preauth_bssid, dst, ETH_ALEN);
255
Hai Shalome21d4e82020-04-29 16:34:06 -0700256 eapol_sm_notify_portValid(sm->preauth_eapol, true);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700257 /* 802.1X::portControl = Auto */
Hai Shalome21d4e82020-04-29 16:34:06 -0700258 eapol_sm_notify_portEnabled(sm->preauth_eapol, true);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700259
260 eloop_register_timeout(sm->dot11RSNAConfigSATimeout, 0,
261 rsn_preauth_timeout, sm, NULL);
262
263 return 0;
Dmitry Shmidtaff761d2015-02-06 10:50:36 -0800264
265fail:
266 if (sm->l2_preauth_br) {
267 l2_packet_deinit(sm->l2_preauth_br);
268 sm->l2_preauth_br = NULL;
269 }
270 l2_packet_deinit(sm->l2_preauth);
271 sm->l2_preauth = NULL;
272 return ret;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700273}
274
275
276/**
277 * rsn_preauth_deinit - Abort RSN pre-authentication
278 * @sm: Pointer to WPA state machine data from wpa_sm_init()
279 *
280 * This function aborts the current RSN pre-authentication (if one is started)
281 * and frees resources allocated for it.
282 */
283void rsn_preauth_deinit(struct wpa_sm *sm)
284{
285 if (sm == NULL || !sm->preauth_eapol)
286 return;
287
288 eloop_cancel_timeout(rsn_preauth_timeout, sm, NULL);
289 eapol_sm_deinit(sm->preauth_eapol);
290 sm->preauth_eapol = NULL;
291 os_memset(sm->preauth_bssid, 0, ETH_ALEN);
292
293 l2_packet_deinit(sm->l2_preauth);
294 sm->l2_preauth = NULL;
295 if (sm->l2_preauth_br) {
296 l2_packet_deinit(sm->l2_preauth_br);
297 sm->l2_preauth_br = NULL;
298 }
299}
300
301
302/**
303 * rsn_preauth_candidate_process - Process PMKSA candidates
304 * @sm: Pointer to WPA state machine data from wpa_sm_init()
305 *
306 * Go through the PMKSA candidates and start pre-authentication if a candidate
307 * without an existing PMKSA cache entry is found. Processed candidates will be
308 * removed from the list.
309 */
310void rsn_preauth_candidate_process(struct wpa_sm *sm)
311{
312 struct rsn_pmksa_candidate *candidate, *n;
313
314 if (dl_list_empty(&sm->pmksa_candidates))
315 return;
316
317 /* TODO: drop priority for old candidate entries */
318
319 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: processing PMKSA candidate "
320 "list");
321 if (sm->preauth_eapol ||
322 sm->proto != WPA_PROTO_RSN ||
323 wpa_sm_get_state(sm) != WPA_COMPLETED ||
Hai Shalomfdcde762020-04-02 11:19:20 -0700324 !rsn_preauth_key_mgmt(sm->key_mgmt)) {
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700325 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: not in suitable "
326 "state for new pre-authentication");
327 return; /* invalid state for new pre-auth */
328 }
329
330 dl_list_for_each_safe(candidate, n, &sm->pmksa_candidates,
331 struct rsn_pmksa_candidate, list) {
332 struct rsn_pmksa_cache_entry *p = NULL;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700333 p = pmksa_cache_get(sm->pmksa, candidate->bssid, NULL, NULL, 0);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700334 if (os_memcmp(sm->bssid, candidate->bssid, ETH_ALEN) != 0 &&
335 (p == NULL || p->opportunistic)) {
336 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: PMKSA "
337 "candidate " MACSTR
338 " selected for pre-authentication",
339 MAC2STR(candidate->bssid));
340 dl_list_del(&candidate->list);
341 rsn_preauth_init(sm, candidate->bssid,
342 sm->eap_conf_ctx);
343 os_free(candidate);
344 return;
345 }
346 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: PMKSA candidate "
347 MACSTR " does not need pre-authentication anymore",
348 MAC2STR(candidate->bssid));
349 /* Some drivers (e.g., NDIS) expect to get notified about the
350 * PMKIDs again, so report the existing data now. */
351 if (p) {
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700352 wpa_sm_add_pmkid(sm, NULL, candidate->bssid, p->pmkid,
Hai Shalom899fcc72020-10-19 14:38:18 -0700353 NULL, p->pmk, p->pmk_len, 0, 0,
354 p->akmp);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700355 }
356
357 dl_list_del(&candidate->list);
358 os_free(candidate);
359 }
360 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: no more pending PMKSA "
361 "candidates");
362}
363
364
365/**
366 * pmksa_candidate_add - Add a new PMKSA candidate
367 * @sm: Pointer to WPA state machine data from wpa_sm_init()
368 * @bssid: BSSID (authenticator address) of the candidate
369 * @prio: Priority (the smaller number, the higher priority)
370 * @preauth: Whether the candidate AP advertises support for pre-authentication
371 *
372 * This function is used to add PMKSA candidates for RSN pre-authentication. It
373 * is called from scan result processing and from driver events for PMKSA
374 * candidates, i.e., EVENT_PMKID_CANDIDATE events to wpa_supplicant_event().
375 */
376void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
377 int prio, int preauth)
378{
379 struct rsn_pmksa_candidate *cand, *pos;
380
381 if (sm->network_ctx && sm->proactive_key_caching)
382 pmksa_cache_get_opportunistic(sm->pmksa, sm->network_ctx,
Roshan Pius3a1667e2018-07-03 15:17:14 -0700383 bssid, 0);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700384
385 if (!preauth) {
386 wpa_printf(MSG_DEBUG, "RSN: Ignored PMKID candidate without "
387 "preauth flag");
388 return;
389 }
390
391 /* If BSSID already on candidate list, update the priority of the old
392 * entry. Do not override priority based on normal scan results. */
393 cand = NULL;
394 dl_list_for_each(pos, &sm->pmksa_candidates,
395 struct rsn_pmksa_candidate, list) {
396 if (os_memcmp(pos->bssid, bssid, ETH_ALEN) == 0) {
397 cand = pos;
398 break;
399 }
400 }
401
402 if (cand) {
403 dl_list_del(&cand->list);
404 if (prio < PMKID_CANDIDATE_PRIO_SCAN)
405 cand->priority = prio;
406 } else {
407 cand = os_zalloc(sizeof(*cand));
408 if (cand == NULL)
409 return;
410 os_memcpy(cand->bssid, bssid, ETH_ALEN);
411 cand->priority = prio;
412 }
413
414 /* Add candidate to the list; order by increasing priority value. i.e.,
415 * highest priority (smallest value) first. */
416 dl_list_for_each(pos, &sm->pmksa_candidates,
417 struct rsn_pmksa_candidate, list) {
418 if (cand->priority <= pos->priority) {
Dmitry Shmidtfb45fd52015-01-05 13:08:17 -0800419 if (!pos->list.prev) {
420 /*
421 * This cannot really happen in pracrice since
422 * pos was fetched from the list and the prev
423 * pointer must be set. It looks like clang
424 * static analyzer gets confused with the
425 * dl_list_del(&cand->list) call above and ends
426 * up assuming pos->list.prev could be NULL.
427 */
428 os_free(cand);
429 return;
430 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700431 dl_list_add(pos->list.prev, &cand->list);
432 cand = NULL;
433 break;
434 }
435 }
436 if (cand)
437 dl_list_add_tail(&sm->pmksa_candidates, &cand->list);
438
439 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: added PMKSA cache "
440 "candidate " MACSTR " prio %d", MAC2STR(bssid), prio);
441 rsn_preauth_candidate_process(sm);
442}
443
444
445/* TODO: schedule periodic scans if current AP supports preauth */
446
447/**
448 * rsn_preauth_scan_results - Start processing scan results for canditates
449 * @sm: Pointer to WPA state machine data from wpa_sm_init()
450 * Returns: 0 if ready to process results or -1 to skip processing
451 *
452 * This functions is used to notify RSN code about start of new scan results
453 * processing. The actual scan results will be provided by calling
454 * rsn_preauth_scan_result() for each BSS if this function returned 0.
455 */
456int rsn_preauth_scan_results(struct wpa_sm *sm)
457{
458 if (sm->ssid_len == 0)
459 return -1;
460
461 /*
462 * TODO: is it ok to free all candidates? What about the entries
463 * received from EVENT_PMKID_CANDIDATE?
464 */
465 pmksa_candidate_free(sm);
466
467 return 0;
468}
469
470
471/**
472 * rsn_preauth_scan_result - Processing scan result for PMKSA canditates
473 * @sm: Pointer to WPA state machine data from wpa_sm_init()
474 *
475 * Add all suitable APs (Authenticators) from scan results into PMKSA
476 * candidate list.
477 */
478void rsn_preauth_scan_result(struct wpa_sm *sm, const u8 *bssid,
479 const u8 *ssid, const u8 *rsn)
480{
481 struct wpa_ie_data ie;
482 struct rsn_pmksa_cache_entry *pmksa;
483
484 if (ssid[1] != sm->ssid_len ||
485 os_memcmp(ssid + 2, sm->ssid, sm->ssid_len) != 0)
486 return; /* Not for the current SSID */
487
488 if (os_memcmp(bssid, sm->bssid, ETH_ALEN) == 0)
489 return; /* Ignore current AP */
490
491 if (wpa_parse_wpa_ie(rsn, 2 + rsn[1], &ie))
492 return;
493
Roshan Pius3a1667e2018-07-03 15:17:14 -0700494 pmksa = pmksa_cache_get(sm->pmksa, bssid, NULL, NULL, 0);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700495 if (pmksa && (!pmksa->opportunistic ||
496 !(ie.capabilities & WPA_CAPABILITY_PREAUTH)))
497 return;
498
Hai Shalomfdcde762020-04-02 11:19:20 -0700499 if (!rsn_preauth_key_mgmt(ie.key_mgmt))
500 return;
501
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700502 /* Give less priority to candidates found from normal scan results. */
503 pmksa_candidate_add(sm, bssid, PMKID_CANDIDATE_PRIO_SCAN,
504 ie.capabilities & WPA_CAPABILITY_PREAUTH);
505}
506
507
508#ifdef CONFIG_CTRL_IFACE
509/**
510 * rsn_preauth_get_status - Get pre-authentication status
511 * @sm: Pointer to WPA state machine data from wpa_sm_init()
512 * @buf: Buffer for status information
513 * @buflen: Maximum buffer length
514 * @verbose: Whether to include verbose status information
515 * Returns: Number of bytes written to buf.
516 *
517 * Query WPA2 pre-authentication for status information. This function fills in
518 * a text area with current status information. If the buffer (buf) is not
519 * large enough, status information will be truncated to fit the buffer.
520 */
521int rsn_preauth_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
522 int verbose)
523{
524 char *pos = buf, *end = buf + buflen;
525 int res, ret;
526
527 if (sm->preauth_eapol) {
528 ret = os_snprintf(pos, end - pos, "Pre-authentication "
529 "EAPOL state machines:\n");
Dmitry Shmidtfb45fd52015-01-05 13:08:17 -0800530 if (os_snprintf_error(end - pos, ret))
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700531 return pos - buf;
532 pos += ret;
533 res = eapol_sm_get_status(sm->preauth_eapol,
534 pos, end - pos, verbose);
535 if (res >= 0)
536 pos += res;
537 }
538
539 return pos - buf;
540}
541#endif /* CONFIG_CTRL_IFACE */
542
543
544/**
545 * rsn_preauth_in_progress - Verify whether pre-authentication is in progress
546 * @sm: Pointer to WPA state machine data from wpa_sm_init()
547 */
548int rsn_preauth_in_progress(struct wpa_sm *sm)
549{
550 return sm->preauth_eapol != NULL;
551}
552
Dmitry Shmidt1d6bf422016-01-19 15:51:35 -0800553#endif /* IEEE8021X_EAPOL && !CONFIG_NO_WPA */