Deleted Added
full compact
wpa_auth.c (281806) wpa_auth.c (289549)
1/*
2 * IEEE 802.11 RSN / WPA Authenticator
3 * Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8

--- 31 unchanged lines hidden (view full) ---

40 struct wpa_group *group);
41static void wpa_request_new_ptk(struct wpa_state_machine *sm);
42static int wpa_gtk_update(struct wpa_authenticator *wpa_auth,
43 struct wpa_group *group);
44static int wpa_group_config_group_keys(struct wpa_authenticator *wpa_auth,
45 struct wpa_group *group);
46static int wpa_derive_ptk(struct wpa_state_machine *sm, const u8 *snonce,
47 const u8 *pmk, struct wpa_ptk *ptk);
1/*
2 * IEEE 802.11 RSN / WPA Authenticator
3 * Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8

--- 31 unchanged lines hidden (view full) ---

40 struct wpa_group *group);
41static void wpa_request_new_ptk(struct wpa_state_machine *sm);
42static int wpa_gtk_update(struct wpa_authenticator *wpa_auth,
43 struct wpa_group *group);
44static int wpa_group_config_group_keys(struct wpa_authenticator *wpa_auth,
45 struct wpa_group *group);
46static int wpa_derive_ptk(struct wpa_state_machine *sm, const u8 *snonce,
47 const u8 *pmk, struct wpa_ptk *ptk);
48static void wpa_group_free(struct wpa_authenticator *wpa_auth,
49 struct wpa_group *group);
50static void wpa_group_get(struct wpa_authenticator *wpa_auth,
51 struct wpa_group *group);
52static void wpa_group_put(struct wpa_authenticator *wpa_auth,
53 struct wpa_group *group);
48
49static const u32 dot11RSNAConfigGroupUpdateCount = 4;
50static const u32 dot11RSNAConfigPairwiseUpdateCount = 4;
51static const u32 eapol_key_timeout_first = 100; /* ms */
52static const u32 eapol_key_timeout_subseq = 1000; /* ms */
53static const u32 eapol_key_timeout_first_group = 500; /* ms */
54
55/* TODO: make these configurable */

--- 6 unchanged lines hidden (view full) ---

62 struct wpa_authenticator *wpa_auth, const u8 *addr)
63{
64 if (wpa_auth->cb.mic_failure_report)
65 return wpa_auth->cb.mic_failure_report(wpa_auth->cb.ctx, addr);
66 return 0;
67}
68
69
54
55static const u32 dot11RSNAConfigGroupUpdateCount = 4;
56static const u32 dot11RSNAConfigPairwiseUpdateCount = 4;
57static const u32 eapol_key_timeout_first = 100; /* ms */
58static const u32 eapol_key_timeout_subseq = 1000; /* ms */
59static const u32 eapol_key_timeout_first_group = 500; /* ms */
60
61/* TODO: make these configurable */

--- 6 unchanged lines hidden (view full) ---

68 struct wpa_authenticator *wpa_auth, const u8 *addr)
69{
70 if (wpa_auth->cb.mic_failure_report)
71 return wpa_auth->cb.mic_failure_report(wpa_auth->cb.ctx, addr);
72 return 0;
73}
74
75
76static inline void wpa_auth_psk_failure_report(
77 struct wpa_authenticator *wpa_auth, const u8 *addr)
78{
79 if (wpa_auth->cb.psk_failure_report)
80 wpa_auth->cb.psk_failure_report(wpa_auth->cb.ctx, addr);
81}
82
83
70static inline void wpa_auth_set_eapol(struct wpa_authenticator *wpa_auth,
71 const u8 *addr, wpa_eapol_variable var,
72 int value)
73{
74 if (wpa_auth->cb.set_eapol)
75 wpa_auth->cb.set_eapol(wpa_auth->cb.ctx, addr, var, value);
76}
77

--- 171 unchanged lines hidden (view full) ---

249 wpa_rekey_gmk, wpa_auth, NULL);
250 }
251}
252
253
254static void wpa_rekey_gtk(void *eloop_ctx, void *timeout_ctx)
255{
256 struct wpa_authenticator *wpa_auth = eloop_ctx;
84static inline void wpa_auth_set_eapol(struct wpa_authenticator *wpa_auth,
85 const u8 *addr, wpa_eapol_variable var,
86 int value)
87{
88 if (wpa_auth->cb.set_eapol)
89 wpa_auth->cb.set_eapol(wpa_auth->cb.ctx, addr, var, value);
90}
91

--- 171 unchanged lines hidden (view full) ---

263 wpa_rekey_gmk, wpa_auth, NULL);
264 }
265}
266
267
268static void wpa_rekey_gtk(void *eloop_ctx, void *timeout_ctx)
269{
270 struct wpa_authenticator *wpa_auth = eloop_ctx;
257 struct wpa_group *group;
271 struct wpa_group *group, *next;
258
259 wpa_auth_logger(wpa_auth, NULL, LOGGER_DEBUG, "rekeying GTK");
272
273 wpa_auth_logger(wpa_auth, NULL, LOGGER_DEBUG, "rekeying GTK");
260 for (group = wpa_auth->group; group; group = group->next) {
274 group = wpa_auth->group;
275 while (group) {
276 wpa_group_get(wpa_auth, group);
277
261 group->GTKReKey = TRUE;
262 do {
263 group->changed = FALSE;
264 wpa_group_sm_step(wpa_auth, group);
265 } while (group->changed);
278 group->GTKReKey = TRUE;
279 do {
280 group->changed = FALSE;
281 wpa_group_sm_step(wpa_auth, group);
282 } while (group->changed);
283
284 next = group->next;
285 wpa_group_put(wpa_auth, group);
286 group = next;
266 }
267
268 if (wpa_auth->conf.wpa_group_rekey) {
269 eloop_register_timeout(wpa_auth->conf.wpa_group_rekey,
270 0, wpa_rekey_gtk, wpa_auth, NULL);
271 }
272}
273

--- 286 unchanged lines hidden (view full) ---

560 if (sm == NULL)
561 return NULL;
562 os_memcpy(sm->addr, addr, ETH_ALEN);
563 if (p2p_dev_addr)
564 os_memcpy(sm->p2p_dev_addr, p2p_dev_addr, ETH_ALEN);
565
566 sm->wpa_auth = wpa_auth;
567 sm->group = wpa_auth->group;
287 }
288
289 if (wpa_auth->conf.wpa_group_rekey) {
290 eloop_register_timeout(wpa_auth->conf.wpa_group_rekey,
291 0, wpa_rekey_gtk, wpa_auth, NULL);
292 }
293}
294

--- 286 unchanged lines hidden (view full) ---

581 if (sm == NULL)
582 return NULL;
583 os_memcpy(sm->addr, addr, ETH_ALEN);
584 if (p2p_dev_addr)
585 os_memcpy(sm->p2p_dev_addr, p2p_dev_addr, ETH_ALEN);
586
587 sm->wpa_auth = wpa_auth;
588 sm->group = wpa_auth->group;
589 wpa_group_get(sm->wpa_auth, sm->group);
568
569 return sm;
570}
571
572
573int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
574 struct wpa_state_machine *sm)
575{

--- 62 unchanged lines hidden (view full) ---

638 sm->GUpdateStationKeys = FALSE;
639 }
640#ifdef CONFIG_IEEE80211R
641 os_free(sm->assoc_resp_ftie);
642 wpabuf_free(sm->ft_pending_req_ies);
643#endif /* CONFIG_IEEE80211R */
644 os_free(sm->last_rx_eapol_key);
645 os_free(sm->wpa_ie);
590
591 return sm;
592}
593
594
595int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
596 struct wpa_state_machine *sm)
597{

--- 62 unchanged lines hidden (view full) ---

660 sm->GUpdateStationKeys = FALSE;
661 }
662#ifdef CONFIG_IEEE80211R
663 os_free(sm->assoc_resp_ftie);
664 wpabuf_free(sm->ft_pending_req_ies);
665#endif /* CONFIG_IEEE80211R */
666 os_free(sm->last_rx_eapol_key);
667 os_free(sm->wpa_ie);
668 wpa_group_put(sm->wpa_auth, sm->group);
646 os_free(sm);
647}
648
649
650void wpa_auth_sta_deinit(struct wpa_state_machine *sm)
651{
652 if (sm == NULL)
653 return;

--- 858 unchanged lines hidden (view full) ---

1512 return;
1513 }
1514 if (mic_len == 24)
1515 WPA_PUT_BE16(key192->key_data_length,
1516 key_data_len);
1517 else
1518 WPA_PUT_BE16(key->key_data_length,
1519 key_data_len);
669 os_free(sm);
670}
671
672
673void wpa_auth_sta_deinit(struct wpa_state_machine *sm)
674{
675 if (sm == NULL)
676 return;

--- 858 unchanged lines hidden (view full) ---

1535 return;
1536 }
1537 if (mic_len == 24)
1538 WPA_PUT_BE16(key192->key_data_length,
1539 key_data_len);
1540 else
1541 WPA_PUT_BE16(key->key_data_length,
1542 key_data_len);
1543#ifndef CONFIG_NO_RC4
1520 } else if (sm->PTK.kek_len == 16) {
1521 u8 ek[32];
1522 os_memcpy(key->key_iv,
1523 sm->group->Counter + WPA_NONCE_LEN - 16, 16);
1524 inc_byte_array(sm->group->Counter, WPA_NONCE_LEN);
1525 os_memcpy(ek, key->key_iv, 16);
1526 os_memcpy(ek + 16, sm->PTK.kek, sm->PTK.kek_len);
1527 os_memcpy(key_data, buf, key_data_len);
1528 rc4_skip(ek, 32, 256, key_data, key_data_len);
1529 if (mic_len == 24)
1530 WPA_PUT_BE16(key192->key_data_length,
1531 key_data_len);
1532 else
1533 WPA_PUT_BE16(key->key_data_length,
1534 key_data_len);
1544 } else if (sm->PTK.kek_len == 16) {
1545 u8 ek[32];
1546 os_memcpy(key->key_iv,
1547 sm->group->Counter + WPA_NONCE_LEN - 16, 16);
1548 inc_byte_array(sm->group->Counter, WPA_NONCE_LEN);
1549 os_memcpy(ek, key->key_iv, 16);
1550 os_memcpy(ek + 16, sm->PTK.kek, sm->PTK.kek_len);
1551 os_memcpy(key_data, buf, key_data_len);
1552 rc4_skip(ek, 32, 256, key_data, key_data_len);
1553 if (mic_len == 24)
1554 WPA_PUT_BE16(key192->key_data_length,
1555 key_data_len);
1556 else
1557 WPA_PUT_BE16(key->key_data_length,
1558 key_data_len);
1559#endif /* CONFIG_NO_RC4 */
1535 } else {
1536 os_free(hdr);
1537 os_free(buf);
1538 return;
1539 }
1540 os_free(buf);
1541 }
1542

--- 98 unchanged lines hidden (view full) ---

1641 sm->PTK_valid = FALSE;
1642 os_memset(&sm->PTK, 0, sizeof(sm->PTK));
1643 wpa_auth_set_key(sm->wpa_auth, 0, WPA_ALG_NONE, sm->addr, 0, NULL, 0);
1644 sm->pairwise_set = FALSE;
1645 eloop_cancel_timeout(wpa_rekey_ptk, sm->wpa_auth, sm);
1646}
1647
1648
1560 } else {
1561 os_free(hdr);
1562 os_free(buf);
1563 return;
1564 }
1565 os_free(buf);
1566 }
1567

--- 98 unchanged lines hidden (view full) ---

1666 sm->PTK_valid = FALSE;
1667 os_memset(&sm->PTK, 0, sizeof(sm->PTK));
1668 wpa_auth_set_key(sm->wpa_auth, 0, WPA_ALG_NONE, sm->addr, 0, NULL, 0);
1669 sm->pairwise_set = FALSE;
1670 eloop_cancel_timeout(wpa_rekey_ptk, sm->wpa_auth, sm);
1671}
1672
1673
1649int wpa_auth_sm_event(struct wpa_state_machine *sm, wpa_event event)
1674int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
1650{
1651 int remove_ptk = 1;
1652
1653 if (sm == NULL)
1654 return -1;
1655
1656 wpa_auth_vlogger(sm->wpa_auth, sm->addr, LOGGER_DEBUG,
1657 "event %d notification", event);

--- 71 unchanged lines hidden (view full) ---

1729 if (remove_ptk) {
1730 sm->PTK_valid = FALSE;
1731 os_memset(&sm->PTK, 0, sizeof(sm->PTK));
1732
1733 if (event != WPA_REAUTH_EAPOL)
1734 wpa_remove_ptk(sm);
1735 }
1736
1675{
1676 int remove_ptk = 1;
1677
1678 if (sm == NULL)
1679 return -1;
1680
1681 wpa_auth_vlogger(sm->wpa_auth, sm->addr, LOGGER_DEBUG,
1682 "event %d notification", event);

--- 71 unchanged lines hidden (view full) ---

1754 if (remove_ptk) {
1755 sm->PTK_valid = FALSE;
1756 os_memset(&sm->PTK, 0, sizeof(sm->PTK));
1757
1758 if (event != WPA_REAUTH_EAPOL)
1759 wpa_remove_ptk(sm);
1760 }
1761
1762 if (sm->in_step_loop) {
1763 /*
1764 * wpa_sm_step() is already running - avoid recursive call to
1765 * it by making the existing loop process the new update.
1766 */
1767 sm->changed = TRUE;
1768 return 0;
1769 }
1737 return wpa_sm_step(sm);
1738}
1739
1740
1741SM_STATE(WPA_PTK, INITIALIZE)
1742{
1743 SM_ENTRY_MA(WPA_PTK, INITIALIZE, wpa_ptk);
1744 if (sm->Init) {

--- 68 unchanged lines hidden (view full) ---

1813 wpa_printf(MSG_INFO, "WPA: Not enough entropy in random pool "
1814 "to proceed - reject first 4-way handshake");
1815 group->reject_4way_hs_for_entropy = TRUE;
1816 } else {
1817 group->first_sta_seen = TRUE;
1818 group->reject_4way_hs_for_entropy = FALSE;
1819 }
1820
1770 return wpa_sm_step(sm);
1771}
1772
1773
1774SM_STATE(WPA_PTK, INITIALIZE)
1775{
1776 SM_ENTRY_MA(WPA_PTK, INITIALIZE, wpa_ptk);
1777 if (sm->Init) {

--- 68 unchanged lines hidden (view full) ---

1846 wpa_printf(MSG_INFO, "WPA: Not enough entropy in random pool "
1847 "to proceed - reject first 4-way handshake");
1848 group->reject_4way_hs_for_entropy = TRUE;
1849 } else {
1850 group->first_sta_seen = TRUE;
1851 group->reject_4way_hs_for_entropy = FALSE;
1852 }
1853
1821 wpa_group_init_gmk_and_counter(wpa_auth, group);
1822 wpa_gtk_update(wpa_auth, group);
1823 wpa_group_config_group_keys(wpa_auth, group);
1854 if (wpa_group_init_gmk_and_counter(wpa_auth, group) < 0 ||
1855 wpa_gtk_update(wpa_auth, group) < 0 ||
1856 wpa_group_config_group_keys(wpa_auth, group) < 0) {
1857 wpa_printf(MSG_INFO, "WPA: GMK/GTK setup failed");
1858 group->first_sta_seen = FALSE;
1859 group->reject_4way_hs_for_entropy = TRUE;
1860 }
1824}
1825
1826
1827SM_STATE(WPA_PTK, AUTHENTICATION2)
1828{
1829 SM_ENTRY_MA(WPA_PTK, AUTHENTICATION2, wpa_ptk);
1830
1831 wpa_group_ensure_init(sm->wpa_auth, sm->group);

--- 148 unchanged lines hidden (view full) ---

1980 sm->wpa_auth->addr, sm->addr, sm->ANonce, snonce,
1981 ptk, sm->wpa_key_mgmt, sm->pairwise);
1982}
1983
1984
1985SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
1986{
1987 struct wpa_ptk PTK;
1861}
1862
1863
1864SM_STATE(WPA_PTK, AUTHENTICATION2)
1865{
1866 SM_ENTRY_MA(WPA_PTK, AUTHENTICATION2, wpa_ptk);
1867
1868 wpa_group_ensure_init(sm->wpa_auth, sm->group);

--- 148 unchanged lines hidden (view full) ---

2017 sm->wpa_auth->addr, sm->addr, sm->ANonce, snonce,
2018 ptk, sm->wpa_key_mgmt, sm->pairwise);
2019}
2020
2021
2022SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
2023{
2024 struct wpa_ptk PTK;
1988 int ok = 0;
2025 int ok = 0, psk_found = 0;
1989 const u8 *pmk = NULL;
1990
1991 SM_ENTRY_MA(WPA_PTK, PTKCALCNEGOTIATING, wpa_ptk);
1992 sm->EAPOLKeyReceived = FALSE;
1993 sm->update_snonce = FALSE;
1994
1995 /* WPA with IEEE 802.1X: use the derived PMK from EAP
1996 * WPA-PSK: iterate through possible PSKs and select the one matching
1997 * the packet */
1998 for (;;) {
1999 if (wpa_key_mgmt_wpa_psk(sm->wpa_key_mgmt)) {
2000 pmk = wpa_auth_get_psk(sm->wpa_auth, sm->addr,
2001 sm->p2p_dev_addr, pmk);
2002 if (pmk == NULL)
2003 break;
2026 const u8 *pmk = NULL;
2027
2028 SM_ENTRY_MA(WPA_PTK, PTKCALCNEGOTIATING, wpa_ptk);
2029 sm->EAPOLKeyReceived = FALSE;
2030 sm->update_snonce = FALSE;
2031
2032 /* WPA with IEEE 802.1X: use the derived PMK from EAP
2033 * WPA-PSK: iterate through possible PSKs and select the one matching
2034 * the packet */
2035 for (;;) {
2036 if (wpa_key_mgmt_wpa_psk(sm->wpa_key_mgmt)) {
2037 pmk = wpa_auth_get_psk(sm->wpa_auth, sm->addr,
2038 sm->p2p_dev_addr, pmk);
2039 if (pmk == NULL)
2040 break;
2041 psk_found = 1;
2004 } else
2005 pmk = sm->PMK;
2006
2007 wpa_derive_ptk(sm, sm->SNonce, pmk, &PTK);
2008
2009 if (wpa_verify_key_mic(sm->wpa_key_mgmt, &PTK,
2010 sm->last_rx_eapol_key,
2011 sm->last_rx_eapol_key_len) == 0) {
2012 ok = 1;
2013 break;
2014 }
2015
2016 if (!wpa_key_mgmt_wpa_psk(sm->wpa_key_mgmt))
2017 break;
2018 }
2019
2020 if (!ok) {
2021 wpa_auth_logger(sm->wpa_auth, sm->addr, LOGGER_DEBUG,
2022 "invalid MIC in msg 2/4 of 4-Way Handshake");
2042 } else
2043 pmk = sm->PMK;
2044
2045 wpa_derive_ptk(sm, sm->SNonce, pmk, &PTK);
2046
2047 if (wpa_verify_key_mic(sm->wpa_key_mgmt, &PTK,
2048 sm->last_rx_eapol_key,
2049 sm->last_rx_eapol_key_len) == 0) {
2050 ok = 1;
2051 break;
2052 }
2053
2054 if (!wpa_key_mgmt_wpa_psk(sm->wpa_key_mgmt))
2055 break;
2056 }
2057
2058 if (!ok) {
2059 wpa_auth_logger(sm->wpa_auth, sm->addr, LOGGER_DEBUG,
2060 "invalid MIC in msg 2/4 of 4-Way Handshake");
2061 if (psk_found)
2062 wpa_auth_psk_failure_report(sm->wpa_auth, sm->addr);
2023 return;
2024 }
2025
2026#ifdef CONFIG_IEEE80211R
2027 if (sm->wpa == WPA_VERSION_WPA2 && wpa_key_mgmt_ft(sm->wpa_key_mgmt)) {
2028 /*
2029 * Verify that PMKR1Name from EAPOL-Key message 2/4 matches
2030 * with the value we derived.

--- 947 unchanged lines hidden (view full) ---

2978 group->GN_igtk = tmp;
2979#endif /* CONFIG_IEEE80211W */
2980 wpa_gtk_update(wpa_auth, group);
2981 wpa_group_config_group_keys(wpa_auth, group);
2982 }
2983}
2984
2985
2063 return;
2064 }
2065
2066#ifdef CONFIG_IEEE80211R
2067 if (sm->wpa == WPA_VERSION_WPA2 && wpa_key_mgmt_ft(sm->wpa_key_mgmt)) {
2068 /*
2069 * Verify that PMKR1Name from EAPOL-Key message 2/4 matches
2070 * with the value we derived.

--- 947 unchanged lines hidden (view full) ---

3018 group->GN_igtk = tmp;
3019#endif /* CONFIG_IEEE80211W */
3020 wpa_gtk_update(wpa_auth, group);
3021 wpa_group_config_group_keys(wpa_auth, group);
3022 }
3023}
3024
3025
2986static const char * wpa_bool_txt(int bool)
3026static const char * wpa_bool_txt(int val)
2987{
3027{
2988 return bool ? "TRUE" : "FALSE";
3028 return val ? "TRUE" : "FALSE";
2989}
2990
2991
2992#define RSN_SUITE "%02x-%02x-%02x-%d"
2993#define RSN_SUITE_ARG(s) \
2994((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
2995
2996int wpa_get_mib(struct wpa_authenticator *wpa_auth, char *buf, size_t buflen)

--- 268 unchanged lines hidden (view full) ---

3265 if (pmksa) {
3266 wpa_printf(MSG_DEBUG, "WPA: Remove PMKSA cache entry for "
3267 MACSTR " based on request", MAC2STR(sta_addr));
3268 pmksa_cache_free_entry(wpa_auth->pmksa, pmksa);
3269 }
3270}
3271
3272
3029}
3030
3031
3032#define RSN_SUITE "%02x-%02x-%02x-%d"
3033#define RSN_SUITE_ARG(s) \
3034((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
3035
3036int wpa_get_mib(struct wpa_authenticator *wpa_auth, char *buf, size_t buflen)

--- 268 unchanged lines hidden (view full) ---

3305 if (pmksa) {
3306 wpa_printf(MSG_DEBUG, "WPA: Remove PMKSA cache entry for "
3307 MACSTR " based on request", MAC2STR(sta_addr));
3308 pmksa_cache_free_entry(wpa_auth->pmksa, pmksa);
3309 }
3310}
3311
3312
3313/*
3314 * Remove and free the group from wpa_authenticator. This is triggered by a
3315 * callback to make sure nobody is currently iterating the group list while it
3316 * gets modified.
3317 */
3318static void wpa_group_free(struct wpa_authenticator *wpa_auth,
3319 struct wpa_group *group)
3320{
3321 struct wpa_group *prev = wpa_auth->group;
3322
3323 wpa_printf(MSG_DEBUG, "WPA: Remove group state machine for VLAN-ID %d",
3324 group->vlan_id);
3325
3326 while (prev) {
3327 if (prev->next == group) {
3328 /* This never frees the special first group as needed */
3329 prev->next = group->next;
3330 os_free(group);
3331 break;
3332 }
3333 prev = prev->next;
3334 }
3335
3336}
3337
3338
3339/* Increase the reference counter for group */
3340static void wpa_group_get(struct wpa_authenticator *wpa_auth,
3341 struct wpa_group *group)
3342{
3343 /* Skip the special first group */
3344 if (wpa_auth->group == group)
3345 return;
3346
3347 group->references++;
3348}
3349
3350
3351/* Decrease the reference counter and maybe free the group */
3352static void wpa_group_put(struct wpa_authenticator *wpa_auth,
3353 struct wpa_group *group)
3354{
3355 /* Skip the special first group */
3356 if (wpa_auth->group == group)
3357 return;
3358
3359 group->references--;
3360 if (group->references)
3361 return;
3362 wpa_group_free(wpa_auth, group);
3363}
3364
3365
3366/*
3367 * Add a group that has its references counter set to zero. Caller needs to
3368 * call wpa_group_get() on the return value to mark the entry in use.
3369 */
3273static struct wpa_group *
3274wpa_auth_add_group(struct wpa_authenticator *wpa_auth, int vlan_id)
3275{
3276 struct wpa_group *group;
3277
3278 if (wpa_auth == NULL || wpa_auth->group == NULL)
3279 return NULL;
3280

--- 34 unchanged lines hidden (view full) ---

3315 return 0;
3316
3317 if (group->wpa_group_state == WPA_GROUP_FATAL_FAILURE)
3318 return -1;
3319
3320 wpa_printf(MSG_DEBUG, "WPA: Moving STA " MACSTR " to use group state "
3321 "machine for VLAN ID %d", MAC2STR(sm->addr), vlan_id);
3322
3370static struct wpa_group *
3371wpa_auth_add_group(struct wpa_authenticator *wpa_auth, int vlan_id)
3372{
3373 struct wpa_group *group;
3374
3375 if (wpa_auth == NULL || wpa_auth->group == NULL)
3376 return NULL;
3377

--- 34 unchanged lines hidden (view full) ---

3412 return 0;
3413
3414 if (group->wpa_group_state == WPA_GROUP_FATAL_FAILURE)
3415 return -1;
3416
3417 wpa_printf(MSG_DEBUG, "WPA: Moving STA " MACSTR " to use group state "
3418 "machine for VLAN ID %d", MAC2STR(sm->addr), vlan_id);
3419
3420 wpa_group_get(sm->wpa_auth, group);
3421 wpa_group_put(sm->wpa_auth, sm->group);
3323 sm->group = group;
3422 sm->group = group;
3423
3324 return 0;
3325}
3326
3327
3328void wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth,
3329 struct wpa_state_machine *sm, int ack)
3330{
3331 if (wpa_auth == NULL || sm == NULL)

--- 69 unchanged lines hidden ---
3424 return 0;
3425}
3426
3427
3428void wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth,
3429 struct wpa_state_machine *sm, int ack)
3430{
3431 if (wpa_auth == NULL || sm == NULL)

--- 69 unchanged lines hidden ---