mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/wpa_sm_cleanup' into 'master'
esp_wifi: Remove unnecessary function pointers from wpa_sm_init See merge request espressif/esp-idf!19833
This commit is contained in:
commit
6fb6bdf6dd
@ -124,8 +124,7 @@ void wpa_neg_complete(void)
|
||||
bool wpa_attach(void)
|
||||
{
|
||||
bool ret = true;
|
||||
ret = wpa_sm_init(NULL, wpa_sendto_wrapper,
|
||||
wpa_config_assoc_ie, wpa_install_key, wpa_get_key, wpa_deauthenticate, wpa_neg_complete);
|
||||
ret = wpa_sm_init();
|
||||
if(ret) {
|
||||
ret = (esp_wifi_register_tx_cb_internal(eapol_txcb, WIFI_TXCB_EAPOL_ID) == ESP_OK);
|
||||
}
|
||||
|
@ -107,11 +107,10 @@ void wpa_sm_free_eapol(u8 *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);
|
||||
sm->wpa_deauthenticate(reason_code);
|
||||
wpa_deauthenticate(reason_code);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -818,7 +818,7 @@ void wpa_supplicant_key_neg_complete(struct wpa_sm *sm,
|
||||
wpa_sm_cancel_auth_timeout(sm);
|
||||
wpa_sm_set_state(WPA_COMPLETED);
|
||||
|
||||
sm->wpa_neg_complete();
|
||||
wpa_neg_complete();
|
||||
|
||||
if (secure) {
|
||||
wpa_sm_mlme_setprotection(
|
||||
@ -2192,26 +2192,14 @@ void wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef ESP_SUPPLICANT
|
||||
bool wpa_sm_init(char * payload, WPA_SEND_FUNC snd_func,
|
||||
WPA_SET_ASSOC_IE set_assoc_ie_func, WPA_INSTALL_KEY ppinstallkey, WPA_GET_KEY ppgetkey, WPA_DEAUTH_FUNC wpa_deauth,
|
||||
WPA_NEG_COMPLETE wpa_neg_complete)
|
||||
bool wpa_sm_init(void)
|
||||
{
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
u16 spp_attrubute = 0;
|
||||
|
||||
os_memset(sm, 0, sizeof(struct wpa_sm));
|
||||
|
||||
sm->eapol_version = DEFAULT_EAPOL_VERSION; /* DEFAULT_EAPOL_VERSION */
|
||||
sm->sendto = snd_func;
|
||||
sm->config_assoc_ie = set_assoc_ie_func;
|
||||
sm->install_ppkey = ppinstallkey;
|
||||
sm->get_ppkey = ppgetkey;
|
||||
sm->wpa_deauthenticate = wpa_deauth;
|
||||
sm->wpa_neg_complete = wpa_neg_complete;
|
||||
sm->key_install = false;
|
||||
sm->ap_rsnxe = NULL;
|
||||
sm->assoc_rsnxe = NULL;
|
||||
|
||||
spp_attrubute = esp_wifi_get_spp_attrubute_internal(WIFI_IF_STA);
|
||||
sm->spp_sup.capable = ((spp_attrubute & WPA_CAPABILITY_SPP_CAPABLE) ? SPP_AMSDU_CAP_ENABLE : SPP_AMSDU_CAP_DISABLE);
|
||||
@ -2242,6 +2230,7 @@ void wpa_sm_deinit(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef ESP_SUPPLICANT
|
||||
void wpa_set_profile(u32 wpa_proto, u8 auth_mode)
|
||||
{
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
@ -2468,7 +2457,7 @@ set_assoc_ie(u8 * assoc_buf)
|
||||
else
|
||||
sm->assoc_wpa_ie_len = ASSOC_IE_LEN - 2;
|
||||
|
||||
sm->config_assoc_ie(sm->proto, assoc_buf, sm->assoc_wpa_ie_len);
|
||||
wpa_config_assoc_ie(sm->proto, assoc_buf, sm->assoc_wpa_ie_len);
|
||||
}
|
||||
|
||||
int wpa_sm_set_key(struct install_key *key_sm, enum wpa_alg alg,
|
||||
@ -2492,15 +2481,14 @@ int wpa_sm_set_key(struct install_key *key_sm, enum wpa_alg alg,
|
||||
key_sm->set_tx = set_tx;
|
||||
memcpy(key_sm->key, key, key_len);
|
||||
|
||||
sm->install_ppkey(alg, addr, key_idx, set_tx, seq, seq_len, key, key_len, key_flag);
|
||||
wpa_install_key(alg, addr, key_idx, set_tx, seq, seq_len, key, key_len, key_flag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
wpa_sm_get_key(uint8_t *ifx, int *alg, u8 *addr, int *key_idx, u8 *key, size_t key_len, enum key_flag key_flag)
|
||||
{
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
return sm->get_ppkey(ifx, alg, addr, key_idx, key, key_len, key_flag);
|
||||
return wpa_get_key(ifx, alg, addr, key_idx, key, key_len, key_flag);
|
||||
}
|
||||
|
||||
void wpa_supplicant_clr_countermeasures(u16 *pisunicast)
|
||||
|
@ -76,14 +76,6 @@ struct wpa_sm {
|
||||
struct install_key install_gtk;
|
||||
int mic_errors_seen; /* Michael MIC errors with the current PTK */
|
||||
|
||||
void (* sendto) (void *buffer, uint16_t len);
|
||||
void (*config_assoc_ie) (u8 proto, u8 *assoc_buf, u32 assoc_wpa_ie_len);
|
||||
void (*install_ppkey) (enum wpa_alg alg, u8 *addr, int key_idx, int set_tx,
|
||||
u8 *seq, unsigned int seq_len, u8 *key, unsigned int key_len, enum key_flag key_flag);
|
||||
int (*get_ppkey) (uint8_t *ifx, int *alg, uint8_t *addr, int *key_idx,
|
||||
uint8_t *key, size_t key_len, enum key_flag key_flag);
|
||||
void (*wpa_deauthenticate)(u8 reason_code);
|
||||
void (*wpa_neg_complete)(void);
|
||||
struct wpa_gtk_data gd; //used for calllback save param
|
||||
u16 key_info; //used for txcallback param
|
||||
u16 txcb_flags;
|
||||
@ -165,8 +157,6 @@ struct wpa_sm {
|
||||
*/
|
||||
|
||||
|
||||
typedef void (* WPA_SEND_FUNC)(void *buffer, u16 len);
|
||||
|
||||
int wpa_sm_update_ft_ies(struct wpa_sm *sm, const u8 *md,
|
||||
const u8 *ies, size_t ies_len, bool auth_ie);
|
||||
|
||||
@ -183,24 +173,20 @@ static inline int wpa_sm_mark_authenticated(struct wpa_sm *sm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef void (* WPA_SET_ASSOC_IE)(u8 proto, u8 *assoc_buf, u32 assoc_wpa_ie_len);
|
||||
void wpa_config_assoc_ie(u8 proto, u8 *assoc_buf, u32 assoc_wpa_ie_len);
|
||||
|
||||
typedef void (*WPA_INSTALL_KEY) (enum wpa_alg alg, u8 *addr, int key_idx, int set_tx,
|
||||
u8 *seq, size_t seq_len, u8 *key, size_t key_len, enum key_flag key_flag);
|
||||
void wpa_install_key(enum wpa_alg alg, u8 *addr, int key_idx, int set_tx,
|
||||
u8 *seq, size_t seq_len, u8 *key, size_t key_len, enum key_flag key_flag);
|
||||
|
||||
typedef int (*WPA_GET_KEY) (u8 *ifx, int *alg, u8 *addt, int *keyidx, u8 *key, size_t key_len, enum key_flag key_flag);
|
||||
int wpa_get_key(uint8_t *ifx, int *alg, u8 *addr, int *key_idx,
|
||||
u8 *key, size_t key_len, enum key_flag key_flag);
|
||||
|
||||
typedef void (*WPA_DEAUTH_FUNC)(u8 reason_code);
|
||||
void wpa_deauthenticate(u8 reason_code);
|
||||
|
||||
typedef void (*WPA_NEG_COMPLETE)(void);
|
||||
void wpa_neg_complete(void);
|
||||
|
||||
|
||||
bool wpa_sm_init(char * payload, WPA_SEND_FUNC snd_func, \
|
||||
WPA_SET_ASSOC_IE set_assoc_ie_func, \
|
||||
WPA_INSTALL_KEY ppinstallkey, \
|
||||
WPA_GET_KEY ppgetkey, \
|
||||
WPA_DEAUTH_FUNC wpa_deauth, \
|
||||
WPA_NEG_COMPLETE wpa_neg_complete);
|
||||
bool wpa_sm_init(void);
|
||||
|
||||
void wpa_sm_deinit(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user