2016-11-04 02:12:21 -04:00
|
|
|
/*
|
|
|
|
* wpa_supplicant - WPA definitions
|
2020-07-27 05:11:40 -04:00
|
|
|
* Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi>
|
2016-11-04 02:12:21 -04:00
|
|
|
*
|
2020-07-27 05:11:40 -04:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2016-11-04 02:12:21 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WPA_H
|
|
|
|
#define WPA_H
|
|
|
|
|
2019-08-08 01:27:22 -04:00
|
|
|
#include "sdkconfig.h"
|
2018-08-13 04:37:56 -04:00
|
|
|
#include "utils/common.h"
|
2022-01-17 04:44:25 -05:00
|
|
|
#include "utils/includes.h"
|
2018-08-13 04:37:56 -04:00
|
|
|
#include "common/defs.h"
|
|
|
|
#include "common/wpa_common.h"
|
2019-11-12 01:05:08 -05:00
|
|
|
#include "esp_wifi_types.h"
|
2018-08-13 04:37:56 -04:00
|
|
|
#include "esp_wifi_crypto_types.h"
|
|
|
|
#include "wpa_i.h"
|
2016-11-04 02:12:21 -04:00
|
|
|
|
2020-07-27 05:11:40 -04:00
|
|
|
struct wpa_sm;
|
2021-12-17 03:50:51 -05:00
|
|
|
extern struct wpa_sm gWpaSm;
|
2016-11-04 02:12:21 -04:00
|
|
|
|
|
|
|
#define WPA_SM_STATE(_sm) ((_sm)->wpa_state)
|
|
|
|
|
2019-09-19 07:23:56 -04:00
|
|
|
bool wpa_sta_is_cur_pmksa_set(void);
|
2018-08-13 04:37:56 -04:00
|
|
|
bool wpa_sta_in_4way_handshake(void);
|
2020-07-08 06:26:05 -04:00
|
|
|
bool wpa_sta_cur_pmksa_matches_akm(void);
|
2016-11-04 02:12:21 -04:00
|
|
|
|
2018-08-13 04:37:56 -04:00
|
|
|
#define WPA_ASSERT assert
|
2016-11-04 02:12:21 -04:00
|
|
|
|
|
|
|
struct l2_ethhdr {
|
|
|
|
u8 h_dest[ETH_ALEN];
|
|
|
|
u8 h_source[ETH_ALEN];
|
|
|
|
be16 h_proto;
|
|
|
|
} STRUCT_PACKED;
|
|
|
|
|
2018-08-13 04:37:56 -04:00
|
|
|
|
2016-11-04 02:12:21 -04:00
|
|
|
void wpa_sm_set_state(enum wpa_states state);
|
|
|
|
|
2020-01-20 01:47:53 -05:00
|
|
|
void wpa_set_pmk(uint8_t *pmk, const u8 *pmkid, bool cache_pmksa);
|
2018-08-13 04:37:56 -04:00
|
|
|
|
|
|
|
int wpa_michael_mic_failure(u16 isunicast);
|
|
|
|
|
2020-11-05 23:00:07 -05:00
|
|
|
wifi_cipher_type_t cipher_type_map_supp_to_public(unsigned cipher);
|
2019-11-12 01:05:08 -05:00
|
|
|
|
2020-11-05 23:00:07 -05:00
|
|
|
unsigned cipher_type_map_public_to_supp(wifi_cipher_type_t cipher);
|
2019-11-12 01:05:08 -05:00
|
|
|
|
2020-01-20 01:47:53 -05:00
|
|
|
void wpa_sta_clear_curr_pmksa(void);
|
|
|
|
|
2020-07-27 05:11:40 -04:00
|
|
|
int wpa_sm_set_key(struct install_key *sm, 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);
|
|
|
|
|
|
|
|
#ifdef CONFIG_IEEE80211R
|
|
|
|
|
|
|
|
int wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len);
|
|
|
|
int wpa_ft_prepare_auth_request(struct wpa_sm *sm, const u8 *mdie);
|
|
|
|
int wpa_ft_add_mdie(struct wpa_sm *sm, u8 *ies, size_t ies_len,
|
|
|
|
const u8 *mdie);
|
|
|
|
const u8 * wpa_sm_get_ft_md(struct wpa_sm *sm);
|
|
|
|
int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
|
|
|
|
int ft_action, const u8 *target_ap,
|
|
|
|
const u8 *ric_ies, size_t ric_ies_len);
|
|
|
|
int wpa_ft_is_completed(struct wpa_sm *sm);
|
|
|
|
void wpa_reset_ft_completed(struct wpa_sm *sm);
|
|
|
|
int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
|
|
|
|
size_t ies_len, const u8 *src_addr);
|
|
|
|
int wpa_ft_start_over_ds(struct wpa_sm *sm, const u8 *target_ap,
|
|
|
|
const u8 *mdie);
|
|
|
|
|
|
|
|
#else /* CONFIG_IEEE80211R */
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_ft_prepare_auth_request(struct wpa_sm *sm,
|
|
|
|
const u8 *mdie)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_ft_add_mdie(struct wpa_sm *sm, u8 *ies, size_t ies_len,
|
|
|
|
const u8 *mdie)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
|
|
|
|
int ft_action, const u8 *target_ap)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_ft_is_completed(struct wpa_sm *sm)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void wpa_reset_ft_completed(struct wpa_sm *sm)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
|
|
|
|
const u8 *src_addr)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_IEEE80211R */
|
2016-11-04 02:12:21 -04:00
|
|
|
#endif /* WPA_H */
|