Select one of the symbols to view example projects that use it.
 
Outline
#include "utils/includes.h"
#include "utils/common.h"
#include "common/eapol_common.h"
#include "rsn_supp/wpa.h"
#include "rsn_supp/pmksa_cache.h"
#include "esp_wpas_glue.h"
#include "esp_private/wifi.h"
wpa_alloc_eapol(void *, u8, const void *, u16, size_t *, void **)
wpa_free_eapol(u8 *)
wpa_ether_send(void *, const u8 *, u16, const u8 *, size_t)
hostapd_send_eapol(const u8 *, const u8 *, const u8 *, size_t)
disable_wpa_wpa2()
wpa_supplicant_transition_disable(struct wpa_sm *, u8)
wpa_sm_alloc_eapol(struct wpa_sm *, u8, const void *, u16, size_t *, void **)
wpa_sm_free_eapol(u8 *)
wpa_sm_deauthenticate(struct wpa_sm *, u8)
wpa_sm_mlme_setprotection(struct wpa_sm *, const u8 *, int, int)
wpa_sm_get_beacon_ie(struct wpa_sm *)
wpa_sm_disassociate(struct wpa_sm *, int)
Files
loading (4/5)...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/wpa_supplicant/esp_supplicant/src/esp_wpas_glue.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #ifdef ESP_SUPPLICANT #include "utils/includes.h" #include "utils/common.h" #include "common/eapol_common.h" #include "rsn_supp/wpa.h" #include "rsn_supp/pmksa_cache.h" #include "esp_wpas_glue.h" #include "esp_private/wifi.h"7 includes u8 *wpa_alloc_eapol(void *sm, u8 type, const void *data, u16 data_len, size_t *msg_len, void **data_pos) { void *buffer; struct ieee802_1x_hdr *hdr; *msg_len = sizeof(struct ieee802_1x_hdr) + data_len; buffer = os_malloc(*msg_len + sizeof(struct l2_ethhdr)); if (buffer == NULL) { return NULL; }{...} /* XXX: reserve l2_ethhdr is enough */ hdr = (struct ieee802_1x_hdr *)((char *)buffer + sizeof(struct l2_ethhdr)); hdr->version = DEFAULT_EAPOL_VERSION; hdr->type = type; hdr->length = host_to_be16(data_len); if (data) { memcpy(hdr + 1, data, data_len); }{...} else { memset(hdr + 1, 0, data_len); }{...} if (data_pos) { *data_pos = hdr + 1; }{...} return (u8 *) hdr; }{ ... } void wpa_free_eapol(u8 *buffer) { if (!buffer) { return; }{...} buffer = buffer - sizeof(struct l2_ethhdr); os_free(buffer); }{ ... } int wpa_ether_send(void *ctx, const u8 *dest, u16 proto, const u8 *data, size_t data_len) { void *buffer = (void *)(data - sizeof(struct l2_ethhdr)); struct l2_ethhdr *eth = (struct l2_ethhdr *)buffer; os_memcpy(eth->h_dest, dest, ETH_ALEN); os_memcpy(eth->h_source, gWpaSm.own_addr, ETH_ALEN); eth->h_proto = host_to_be16(proto); return esp_wifi_internal_tx(WIFI_IF_STA, buffer, sizeof(struct l2_ethhdr) + data_len); }{ ... } int hostapd_send_eapol(const u8 *source, const u8 *sta_addr, const u8 *data, size_t data_len) { void *buffer = os_malloc(data_len + sizeof(struct l2_ethhdr)); struct l2_ethhdr *eth = buffer; if (!buffer) { wpa_printf(MSG_DEBUG, "send_eapol, buffer=%p", buffer); return -1; }{...} memcpy(eth->h_dest, sta_addr, ETH_ALEN); memcpy(eth->h_source, source, ETH_ALEN); eth->h_proto = host_to_be16(ETH_P_EAPOL); memcpy((char *)buffer + sizeof(struct l2_ethhdr), data, data_len); esp_wifi_internal_tx(WIFI_IF_AP, buffer, sizeof(struct l2_ethhdr) + data_len); os_free(buffer); return 0; }{ ... } static void disable_wpa_wpa2(void) { esp_wifi_sta_disable_wpa2_authmode_internal(); }{ ... } void wpa_supplicant_transition_disable(struct wpa_sm *sm, u8 bitmap) { wpa_printf(MSG_DEBUG, "TRANSITION_DISABLE %02x", bitmap); if ((bitmap & TRANSITION_DISABLE_WPA3_PERSONAL) && wpa_key_mgmt_sae(sm->key_mgmt)) { disable_wpa_wpa2(); }{...} if ((bitmap & TRANSITION_DISABLE_SAE_PK) && wpa_key_mgmt_sae(sm->key_mgmt)) { wpa_printf(MSG_INFO, "SAE-PK: SAE authentication without PK disabled based on AP notification"); disable_wpa_wpa2(); esp_wifi_enable_sae_pk_only_mode_internal(); }{...} if ((bitmap & TRANSITION_DISABLE_WPA3_ENTERPRISE) && wpa_key_mgmt_wpa_ieee8021x(sm->key_mgmt)) { disable_wpa_wpa2(); }{...} if ((bitmap & TRANSITION_DISABLE_ENHANCED_OPEN) && wpa_key_mgmt_owe(sm->key_mgmt)) { esp_wifi_sta_disable_owe_trans_internal(); }{...} }{ ... } u8 *wpa_sm_alloc_eapol(struct wpa_sm *sm, u8 type, const void *data, u16 data_len, size_t *msg_len, void **data_pos) { return wpa_alloc_eapol(sm, type, data, data_len, msg_len, data_pos); }{ ... } void wpa_sm_free_eapol(u8 *buffer) { return wpa_free_eapol(buffer); }{ ... } void wpa_sm_deauthenticate(struct wpa_sm *sm, u8 reason_code) { /*only need send deauth frame when associated*/ if (WPA_SM_STATE(sm) >= WPA_ASSOCIATED) { pmksa_cache_clear_current(sm); wpa_deauthenticate(reason_code); }{...} }{ ... } /** * mlme_setprotection - MLME-SETPROTECTION.request primitive * @priv: Private driver interface data * @addr: Address of the station for which to set protection (may be * %NULL for group keys) * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_* * @key_type: MLME_SETPROTECTION_KEY_TYPE_* * Returns: 0 on success, -1 on failure * * This is an optional function that can be used to set the driver to * require protection for Tx and/or Rx frames. This uses the layer * interface defined in IEEE 802.11i-2004 clause 10.3.22.1 * (MLME-SETPROTECTION.request). Many drivers do not use explicit * set protection operation; instead, they set protection implicitly * based on configured keys. *//* ... */ int wpa_sm_mlme_setprotection(struct wpa_sm *sm, const u8 *addr, int protect_type, int key_type) { return 0; }{ ... } /* *use above two functions to get wpa_ie and rsn_ie, then don't need wpa_sm_get_beacon_ie function *//* ... */ int wpa_sm_get_beacon_ie(struct wpa_sm *sm) { return 0; }{ ... } /** * wpa_supplicant_disassociate - Disassociate the current connection * @wpa_s: Pointer to wpa_supplicant data * @reason_code: IEEE 802.11 reason code for the disassociate frame * * This function is used to request %wpa_supplicant to disassociate with the * current AP. *//* ... */ void wpa_sm_disassociate(struct wpa_sm *sm, int reason_code) { /*check if need clear internal state and data value*/ }{ ... } #endif/* ... */
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.