mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(esp_wifi): Backport dpp and other fixes
1) Fix crash while connecting to dpp akm 2) Fix phy ref cnt for power management for offchannel_tx 3) Introduced a variable to indicate dpp ap for scan results 4) Introduced WIFI_AUTH_UNKNOWN for ap with misconfigured security parameter
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -44,11 +44,13 @@ typedef enum {
|
||||
typedef enum {
|
||||
WIFI_OFFCHAN_TX_CANCEL, /**< Cancel off-channel transmission */
|
||||
WIFI_OFFCHAN_TX_REQ, /**< Request off-channel transmission */
|
||||
WIFI_OFFCHAN_TX_CONNECTING_REQ, /**< Off-channel Tx request during connecting state; not recommended for use by public APIs */
|
||||
} wifi_action_tx_t;
|
||||
|
||||
typedef enum {
|
||||
WIFI_ROC_CANCEL, /**< Cancel remain on channel */
|
||||
WIFI_ROC_REQ, /**< Request remain on channel */
|
||||
WIFI_ROC_CONNECTING_REQ, /**< Remain-on-channel request during connecting state; not recommended for use by public APIs */
|
||||
} wifi_roc_t;
|
||||
/**
|
||||
* @brief Wi-Fi country policy
|
||||
@@ -80,6 +82,9 @@ typedef struct {
|
||||
* Strength of authmodes
|
||||
* Personal Networks : OPEN < WEP < WPA_PSK < OWE < WPA2_PSK = WPA_WPA2_PSK < WAPI_PSK < WPA3_PSK = WPA2_WPA3_PSK = DPP
|
||||
* Enterprise Networks : WIFI_AUTH_WPA_ENTERPRISE < WIFI_AUTH_WPA2_ENTERPRISE < WIFI_AUTH_WPA3_ENTERPRISE = WIFI_AUTH_WPA2_WPA3_ENTERPRISE < WIFI_AUTH_WPA3_ENT_192
|
||||
*
|
||||
* @note WIFI_AUTH_UNKNOWN indicates an Access Point with invalid or unparseable security configuration
|
||||
* detected during scan parsing.
|
||||
*/
|
||||
typedef enum {
|
||||
WIFI_AUTH_OPEN = 0, /**< Authenticate mode : open */
|
||||
@@ -100,6 +105,7 @@ typedef enum {
|
||||
WIFI_AUTH_WPA3_ENTERPRISE, /**< Authenticate mode : WPA3-Enterprise Only Mode */
|
||||
WIFI_AUTH_WPA2_WPA3_ENTERPRISE, /**< Authenticate mode : WPA3-Enterprise Transition Mode */
|
||||
WIFI_AUTH_WPA_ENTERPRISE, /**< Authenticate mode : WPA-Enterprise security */
|
||||
WIFI_AUTH_UNKNOWN, /**< Scan parsed authmode: Unknown or invalid security configuration parsed during scan */
|
||||
WIFI_AUTH_MAX
|
||||
} wifi_auth_mode_t;
|
||||
|
||||
@@ -329,7 +335,8 @@ typedef struct {
|
||||
uint32_t wps: 1; /**< Bit: 7 flag to identify if WPS is supported or not */
|
||||
uint32_t ftm_responder: 1; /**< Bit: 8 flag to identify if FTM is supported in responder mode */
|
||||
uint32_t ftm_initiator: 1; /**< Bit: 9 flag to identify if FTM is supported in initiator mode */
|
||||
uint32_t reserved: 22; /**< Bit: 10..31 reserved */
|
||||
uint32_t akm_dpp: 1; /**< Bit: 10 flag set when AP supports mixed DPP AKM (e.g., SAE + DPP or WPA2-PSK + DPP) or when AP only supports DPP AKM */
|
||||
uint32_t reserved: 21; /**< Bit: 11..31 reserved */
|
||||
wifi_country_t country; /**< Country information of AP */
|
||||
wifi_he_ap_info_t he_ap; /**< HE AP info */
|
||||
wifi_bandwidth_t bandwidth; /**< Bandwidth of AP */
|
||||
|
||||
Submodule components/esp_wifi/lib updated: 698adab7e0...809322bc5c
@@ -79,7 +79,9 @@ esp_err_t esp_supp_dpp_deinit(void);
|
||||
* Generates Out Of Band Bootstrap information as an Enrollee which can be
|
||||
* used by a DPP Configurator to provision the Enrollee.
|
||||
*
|
||||
* @param chan_list List of channels device will be available on for listening
|
||||
* @param chan_list Comma-separated list of channels for listening (must not be NULL).
|
||||
* A single channel (e.g., "6") is recommended for reliable discovery.
|
||||
* If using multiple, prefer non-overlapping channels (e.g., "1,6,11").
|
||||
* @param type Bootstrap method type, only QR Code method is supported for now.
|
||||
* @param key (Optional) 32 byte Raw Private Key for generating a Bootstrapping Public Key
|
||||
* @param info (Optional) Ancillary Device Information like Serial Number
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -81,7 +81,7 @@ static uint8_t esp_dpp_deinit_auth(void)
|
||||
|
||||
static void esp_dpp_call_cb(esp_supp_dpp_event_t evt, void *data)
|
||||
{
|
||||
if (s_dpp_ctx.dpp_auth) {
|
||||
if (s_dpp_ctx.dpp_auth && evt != ESP_SUPP_DPP_CFG_RECVD) {
|
||||
esp_dpp_deinit_auth();
|
||||
}
|
||||
s_dpp_ctx.dpp_event_cb(evt, data);
|
||||
@@ -99,7 +99,8 @@ static void esp_dpp_auth_conf_wait_timeout(void *eloop_ctx, void *timeout_ctx)
|
||||
}
|
||||
|
||||
esp_err_t esp_dpp_send_action_frame(uint8_t *dest_mac, const uint8_t *buf, uint32_t len,
|
||||
uint8_t channel, uint32_t wait_time_ms)
|
||||
uint8_t channel, uint32_t wait_time_ms,
|
||||
uint32_t offchan_type)
|
||||
{
|
||||
wifi_action_tx_req_t *req = os_zalloc(sizeof(*req) + len);
|
||||
if (!req) {
|
||||
@@ -113,7 +114,7 @@ esp_err_t esp_dpp_send_action_frame(uint8_t *dest_mac, const uint8_t *buf, uint3
|
||||
req->rx_cb = s_action_rx_cb;
|
||||
req->channel = channel;
|
||||
req->wait_time_ms = wait_time_ms;
|
||||
req->type = WIFI_OFFCHAN_TX_REQ;
|
||||
req->type = offchan_type;
|
||||
memcpy(req->data, buf, req->data_len);
|
||||
|
||||
wpa_printf(MSG_DEBUG, "DPP: Mgmt Tx - MAC:" MACSTR ", Channel-%d, WaitT-%d",
|
||||
@@ -169,18 +170,31 @@ static void esp_dpp_rx_auth_req(struct action_rx_param *rx_param, uint8_t *dpp_d
|
||||
goto fail;
|
||||
}
|
||||
if (s_dpp_ctx.dpp_auth) {
|
||||
wpa_printf(MSG_DEBUG, "DPP: Already in DPP authentication exchange - ignore new one");
|
||||
return;
|
||||
if (s_dpp_ctx.dpp_auth->auth_success || !s_dpp_ctx.dpp_auth->waiting_auth_conf) {
|
||||
wpa_printf(MSG_INFO, "DPP: Cleaning up old completed DPP auth context for new exchange");
|
||||
eloop_cancel_timeout(esp_dpp_auth_conf_wait_timeout, NULL, NULL);
|
||||
dpp_auth_deinit(s_dpp_ctx.dpp_auth);
|
||||
s_dpp_ctx.dpp_auth = NULL;
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "DPP: Already in DPP authentication exchange - ignore new one");
|
||||
return;
|
||||
}
|
||||
}
|
||||
s_dpp_ctx.dpp_auth = dpp_auth_req_rx(NULL, DPP_CAPAB_ENROLLEE, 0, NULL,
|
||||
own_bi, rx_param->channel,
|
||||
(const u8 *)&rx_param->action_frm->u.public_action.v, dpp_data, len);
|
||||
if (!s_dpp_ctx.dpp_auth) {
|
||||
wpa_printf(MSG_ERROR, "DPP: Failed to process Authentication Request");
|
||||
rc = ESP_ERR_DPP_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
os_memcpy(s_dpp_ctx.dpp_auth->peer_mac_addr, rx_param->sa, ETH_ALEN);
|
||||
|
||||
wpa_printf(MSG_DEBUG, "DPP: Sending authentication response.");
|
||||
esp_dpp_send_action_frame(rx_param->sa, wpabuf_head(s_dpp_ctx.dpp_auth->resp_msg),
|
||||
wpabuf_len(s_dpp_ctx.dpp_auth->resp_msg),
|
||||
rx_param->channel, OFFCHAN_TX_WAIT_TIME);
|
||||
s_dpp_ctx.dpp_auth->curr_chan, OFFCHAN_TX_WAIT_TIME,
|
||||
WIFI_OFFCHAN_TX_REQ);
|
||||
eloop_cancel_timeout(esp_dpp_auth_conf_wait_timeout, NULL, NULL);
|
||||
eloop_register_timeout(ESP_DPP_AUTH_TIMEOUT_SECS, 0, esp_dpp_auth_conf_wait_timeout, NULL, NULL);
|
||||
|
||||
@@ -206,7 +220,8 @@ static void gas_query_req_tx(struct dpp_authentication *auth)
|
||||
MAC2STR(auth->peer_mac_addr), auth->curr_chan);
|
||||
|
||||
esp_dpp_send_action_frame(auth->peer_mac_addr, wpabuf_head(buf), wpabuf_len(buf),
|
||||
auth->curr_chan, OFFCHAN_TX_WAIT_TIME);
|
||||
auth->curr_chan, OFFCHAN_TX_WAIT_TIME,
|
||||
WIFI_OFFCHAN_TX_REQ);
|
||||
}
|
||||
|
||||
static int esp_dpp_handle_config_obj(struct dpp_authentication *auth,
|
||||
@@ -219,13 +234,24 @@ static int esp_dpp_handle_config_obj(struct dpp_authentication *auth,
|
||||
os_memcpy(wifi_cfg->sta.ssid, conf->ssid, conf->ssid_len);
|
||||
}
|
||||
|
||||
if (dpp_akm_legacy(conf->akm)) {
|
||||
if (dpp_akm_legacy(conf->akm) || dpp_akm_ver2(conf->akm)) {
|
||||
if (conf->passphrase[0])
|
||||
os_memcpy(wifi_cfg->sta.password, conf->passphrase,
|
||||
sizeof(wifi_cfg->sta.password));
|
||||
if (conf->akm == DPP_AKM_PSK_SAE) {
|
||||
wifi_cfg->sta.pmf_cfg.required = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dpp_akm_sae(conf->akm) || dpp_akm_dpp(conf->akm)) {
|
||||
wifi_cfg->sta.pmf_cfg.capable = true;
|
||||
wifi_cfg->sta.pmf_cfg.required = true;
|
||||
}
|
||||
|
||||
if (dpp_akm_dpp(conf->akm)) {
|
||||
wifi_cfg->sta.threshold.authmode = WIFI_AUTH_DPP;
|
||||
esp_wifi_sta_notify_dpp_config_set_internal(true);
|
||||
} else if (dpp_akm_sae(conf->akm)) {
|
||||
wifi_cfg->sta.threshold.authmode = WIFI_AUTH_WPA3_PSK;
|
||||
} else if (dpp_akm_psk(conf->akm)) {
|
||||
wifi_cfg->sta.threshold.authmode = WIFI_AUTH_WPA2_PSK;
|
||||
}
|
||||
|
||||
if (conf->connector) {
|
||||
@@ -385,9 +411,10 @@ static esp_err_t esp_dpp_rx_peer_disc_resp(struct action_rx_param *rx_param)
|
||||
os_get_reltime(&rnow);
|
||||
entry->expiration = rnow.sec + seconds;
|
||||
entry->reauth_time = rnow.sec + seconds;
|
||||
entry->network_ctx = auth;
|
||||
entry->network_ctx = sm->network_ctx;
|
||||
|
||||
pmksa_cache_add_entry(sm->pmksa, entry);
|
||||
entry = NULL;
|
||||
|
||||
wpa_printf(MSG_INFO, "peer=" MACSTR " status=%u", MAC2STR(rx_param->sa), status[0]);
|
||||
break;
|
||||
@@ -401,7 +428,10 @@ static esp_err_t esp_dpp_rx_peer_disc_resp(struct action_rx_param *rx_param)
|
||||
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"DPP: Try connection after successful network introduction");
|
||||
dpp_connect(rx_param->sa, true);
|
||||
if (dpp_connect(rx_param->sa, true) != 0) {
|
||||
wpa_printf(MSG_ERROR, "DPP: Failed to connect after network introduction");
|
||||
goto fail;
|
||||
}
|
||||
return ESP_OK;
|
||||
fail:
|
||||
os_memset(&intro, 0, sizeof(intro));
|
||||
@@ -448,7 +478,7 @@ static void gas_query_resp_rx(struct action_rx_param *rx_param)
|
||||
uint8_t *pos = rx_param->action_frm->u.public_action.v.pa_gas_resp.data;
|
||||
uint8_t *resp = &pos[10]; /* first byte of DPP attributes */
|
||||
size_t vendor_len = rx_param->vendor_data_len;
|
||||
int i, res;
|
||||
int res;
|
||||
|
||||
/* Basic structural checks on the Advertisement Protocol payload */
|
||||
if (!(pos[1] == WLAN_EID_VENDOR_SPECIFIC && pos[2] == 5 &&
|
||||
@@ -466,8 +496,8 @@ static void gas_query_resp_rx(struct action_rx_param *rx_param)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < auth->num_conf_obj; i++) {
|
||||
res = esp_dpp_handle_config_obj(auth, &auth->conf_obj[i]);
|
||||
if (auth->num_conf_obj > 0) {
|
||||
res = esp_dpp_handle_config_obj(auth, &auth->conf_obj[0]);
|
||||
if (res < 0) {
|
||||
wpa_printf(MSG_INFO, "DPP: Configuration parsing failed");
|
||||
goto fail;
|
||||
@@ -991,12 +1021,18 @@ esp_err_t esp_dpp_start_net_intro_protocol(uint8_t *bssid)
|
||||
{
|
||||
struct dpp_authentication *auth = s_dpp_ctx.dpp_auth;
|
||||
struct wpabuf *buf;
|
||||
|
||||
if (!auth) {
|
||||
wpa_printf(MSG_ERROR, "DPP: No authentication context for network introduction");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
for (int i = 0; i < auth->num_conf_obj; i++) {
|
||||
os_memcpy(auth->peer_mac_addr, bssid, ETH_ALEN);
|
||||
buf = dpp_build_peer_disc_req(auth, &auth->conf_obj[i]);
|
||||
|
||||
if (buf) {
|
||||
if (esp_dpp_send_action_frame(bssid, wpabuf_head(buf), wpabuf_len(buf), auth->curr_chan, OFFCHAN_TX_WAIT_TIME) != ESP_OK) {
|
||||
if (esp_dpp_send_action_frame(bssid, wpabuf_head(buf), wpabuf_len(buf), auth->curr_chan, OFFCHAN_TX_WAIT_TIME, WIFI_OFFCHAN_TX_CONNECTING_REQ) != ESP_OK) {
|
||||
wpabuf_free(buf);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ struct esp_dpp_context_t {
|
||||
struct dpp_global *dpp_global;
|
||||
wifi_config_t wifi_cfg;
|
||||
int id;
|
||||
bool peer_disc_resp_received;
|
||||
};
|
||||
|
||||
int esp_supp_rx_action(uint8_t *hdr, uint8_t *payload, size_t len, uint8_t channel);
|
||||
|
||||
@@ -292,6 +292,7 @@ uint8_t esp_wifi_sta_get_config_sae_pk_internal(void);
|
||||
void esp_wifi_sta_disable_sae_pk_internal(void);
|
||||
void esp_wifi_sta_disable_wpa2_authmode_internal(void);
|
||||
void esp_wifi_sta_disable_owe_trans_internal(void);
|
||||
void esp_wifi_sta_notify_dpp_config_set_internal(bool configured);
|
||||
uint8_t esp_wifi_ap_get_max_sta_conn(void);
|
||||
uint8_t esp_wifi_get_config_sae_pwe_h2e_internal(uint8_t ifx);
|
||||
bool esp_wifi_ap_notify_node_sae_auth_done(uint8_t *mac);
|
||||
|
||||
@@ -262,7 +262,7 @@ int wpa_sta_connect(uint8_t *bssid)
|
||||
|
||||
#ifdef CONFIG_DPP
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
if (sm->key_mgmt == WPA_KEY_MGMT_DPP) {
|
||||
if (wpa_key_mgmt_dpp(sm->key_mgmt)) {
|
||||
ret = dpp_connect(bssid, false);
|
||||
} else
|
||||
#endif
|
||||
@@ -522,10 +522,23 @@ int esp_supplicant_init(void)
|
||||
esp_wifi_register_owe_cb(wpa_cb);
|
||||
#endif /* CONFIG_OWE_STA */
|
||||
|
||||
eloop_init();
|
||||
if (eloop_init() != 0) {
|
||||
wpa_printf(MSG_ERROR, "Failed to initialize eloop");
|
||||
os_free(wpa_cb);
|
||||
wpa_cb = NULL;
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
ret = esp_supplicant_common_init(wpa_cb);
|
||||
|
||||
if (ret != 0) {
|
||||
/*
|
||||
* Note: We don't need to explicitly call eloop_destroy() here because
|
||||
* returning an error causes the caller (esp_wifi_init) to trigger the
|
||||
* deinit path, which invokes esp_supplicant_deinit() and frees the eloop.
|
||||
*/
|
||||
os_free(wpa_cb);
|
||||
wpa_cb = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -543,6 +556,7 @@ int esp_supplicant_deinit(void)
|
||||
esp_supplicant_common_deinit();
|
||||
esp_supplicant_unset_all_appie();
|
||||
eloop_destroy();
|
||||
/* wpa_cb is freed by esp_wifi_unregister_wpa_cb_internal() */
|
||||
wpa_cb = NULL;
|
||||
#if CONFIG_ESP_WIFI_WAPI_PSK
|
||||
esp_wifi_internal_wapi_deinit();
|
||||
|
||||
@@ -353,7 +353,7 @@ extern const wifi_osi_funcs_t *wifi_funcs;
|
||||
#define os_mutex_lock(a) wifi_funcs->_mutex_lock((a))
|
||||
#define os_mutex_unlock(a) wifi_funcs->_mutex_unlock((a))
|
||||
#define os_recursive_mutex_create() wifi_funcs->_recursive_mutex_create()
|
||||
#define os_mutex_create() wifi_funcs->_mutex_create();
|
||||
#define os_mutex_create() wifi_funcs->_mutex_create()
|
||||
#define os_mutex_delete(a) wifi_funcs->_mutex_delete(a)
|
||||
|
||||
#define os_queue_create(a, b) wifi_funcs->_queue_create((a), (b))
|
||||
|
||||
@@ -124,7 +124,7 @@ static inline int wpa_key_mgmt_owe(int akm)
|
||||
|
||||
static inline int wpa_key_mgmt_dpp(int akm)
|
||||
{
|
||||
return akm == WPA_KEY_MGMT_DPP;
|
||||
return !!(akm & WPA_KEY_MGMT_DPP);
|
||||
}
|
||||
|
||||
static inline int wpa_key_mgmt_wpa(int akm)
|
||||
|
||||
@@ -1117,7 +1117,7 @@ struct dpp_authentication * dpp_auth_init(void *msg_ctx,
|
||||
{
|
||||
struct dpp_authentication *auth;
|
||||
size_t nonce_len;
|
||||
size_t secret_len;
|
||||
size_t secret_len = 0;
|
||||
struct wpabuf *pi = NULL;
|
||||
const u8 *r_pubkey_hash, *i_pubkey_hash;
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
@@ -1475,7 +1475,7 @@ static void dpp_auth_success(struct dpp_authentication *auth)
|
||||
static int dpp_auth_build_resp_ok(struct dpp_authentication *auth)
|
||||
{
|
||||
size_t nonce_len;
|
||||
size_t secret_len;
|
||||
size_t secret_len = 0;
|
||||
struct wpabuf *msg, *pr = NULL;
|
||||
u8 r_auth[4 + DPP_MAX_HASH_LEN];
|
||||
u8 wrapped_r_auth[4 + DPP_MAX_HASH_LEN + AES_BLOCK_SIZE], *w_r_auth;
|
||||
@@ -1540,6 +1540,7 @@ static int dpp_auth_build_resp_ok(struct dpp_authentication *auth)
|
||||
if (dpp_ecdh(auth->own_protocol_key, auth->peer_protocol_key,
|
||||
auth->Nx, &secret_len) < 0)
|
||||
goto fail;
|
||||
auth->secret_len = secret_len;
|
||||
|
||||
wpa_hexdump_key(MSG_DEBUG, "DPP: ECDH shared secret (N.x)",
|
||||
auth->Nx, auth->secret_len);
|
||||
@@ -1727,7 +1728,7 @@ dpp_auth_req_rx(void *msg_ctx, u8 dpp_allowed_roles, int qr_mutual,
|
||||
size_t attr_len)
|
||||
{
|
||||
struct crypto_ec_key *pi = NULL;
|
||||
size_t secret_len;
|
||||
size_t secret_len = 0;
|
||||
const u8 *addr[2];
|
||||
size_t len[2];
|
||||
u8 *unwrapped = NULL;
|
||||
@@ -1737,11 +1738,13 @@ dpp_auth_req_rx(void *msg_ctx, u8 dpp_allowed_roles, int qr_mutual,
|
||||
const u8 *i_nonce;
|
||||
const u8 *i_capab;
|
||||
const u8 *i_bootstrap;
|
||||
const u8 *channel;
|
||||
u16 wrapped_data_len;
|
||||
u16 i_proto_len;
|
||||
u16 i_nonce_len;
|
||||
u16 i_capab_len;
|
||||
u16 i_bootstrap_len;
|
||||
u16 channel_len;
|
||||
struct dpp_authentication *auth = NULL;
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
u64 start_us = dpp_time_us();
|
||||
@@ -1781,37 +1784,30 @@ dpp_auth_req_rx(void *msg_ctx, u8 dpp_allowed_roles, int qr_mutual,
|
||||
|
||||
auth->peer_version = 1; /* default to the first version */
|
||||
|
||||
#if 0
|
||||
channel = dpp_get_attr(attr_start, attr_len, DPP_ATTR_CHANNEL,
|
||||
&channel_len);
|
||||
if (channel) {
|
||||
//int neg_freq;
|
||||
|
||||
if (channel_len < 2) {
|
||||
dpp_auth_fail(auth, "Too short Channel attribute");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
neg_freq = ieee80211_chan_to_freq(NULL, channel[0], channel[1]);
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"DPP: Initiator requested different channel for negotiation: op_class=%u channel=%u --> freq=%d",
|
||||
channel[0], channel[1], neg_freq);
|
||||
if (neg_freq < 0) {
|
||||
"DPP: Initiator requested different channel for negotiation: op_class=%u channel=%u",
|
||||
channel[0], channel[1]);
|
||||
if (!channel[0] || !channel[1]) {
|
||||
dpp_auth_fail(auth,
|
||||
"Unsupported Channel attribute value");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (auth->curr_freq != (unsigned int) neg_freq) {
|
||||
if (auth->curr_chan != channel[1]) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"DPP: Changing negotiation channel from %u MHz to %u MHz",
|
||||
freq, neg_freq);
|
||||
auth->curr_freq = neg_freq;
|
||||
"DPP: Changing negotiation channel from %u to %u",
|
||||
auth->curr_chan, channel[1]);
|
||||
}
|
||||
/* rename it to chan */
|
||||
auth->curr_chan = *channel;
|
||||
auth->curr_chan = channel[1];
|
||||
}
|
||||
#endif
|
||||
|
||||
i_proto = dpp_get_attr(attr_start, attr_len, DPP_ATTR_I_PROTOCOL_KEY,
|
||||
&i_proto_len);
|
||||
@@ -2297,7 +2293,7 @@ dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
|
||||
const u8 *attr_start, size_t attr_len)
|
||||
{
|
||||
struct crypto_ec_key *pr;
|
||||
size_t secret_len;
|
||||
size_t secret_len = 0;
|
||||
const u8 *addr[2];
|
||||
size_t len[2];
|
||||
u8 *unwrapped = NULL, *unwrapped2 = NULL;
|
||||
@@ -2432,6 +2428,7 @@ dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
|
||||
dpp_auth_fail(auth, "Failed to derive ECDH shared secret");
|
||||
goto fail;
|
||||
}
|
||||
auth->secret_len = secret_len;
|
||||
crypto_ec_key_deinit(auth->peer_protocol_key);
|
||||
auth->peer_protocol_key = pr;
|
||||
pr = NULL;
|
||||
@@ -3432,7 +3429,7 @@ skip_groups:
|
||||
if (!hash) {
|
||||
goto fail;
|
||||
}
|
||||
if (dpp_get_config_obj_hash(signed1, signed1_len, signed2, signed1_len, hash, curve->hash_len) < 0)
|
||||
if (dpp_get_config_obj_hash(signed1, signed1_len, signed2, signed2_len, hash, curve->hash_len) < 0)
|
||||
goto fail;
|
||||
|
||||
r = crypto_bignum_init();
|
||||
@@ -4861,7 +4858,7 @@ dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector,
|
||||
struct wpabuf *own_key_pub = NULL;
|
||||
const struct dpp_curve_params *curve, *own_curve;
|
||||
struct dpp_signed_connector_info info;
|
||||
size_t Nx_len;
|
||||
size_t Nx_len = 0;
|
||||
u8 Nx[DPP_MAX_SHARED_SECRET_LEN];
|
||||
|
||||
os_memset(intro, 0, sizeof(*intro));
|
||||
|
||||
@@ -864,7 +864,7 @@ int wpa_pmk_r1_to_ptk(const u8 *pmk_r1, const u8 *snonce, const u8 *anonce,
|
||||
int wpa_use_akm_defined(int akmp){
|
||||
return akmp == WPA_KEY_MGMT_OSEN ||
|
||||
akmp == WPA_KEY_MGMT_OWE ||
|
||||
akmp == WPA_KEY_MGMT_DPP ||
|
||||
wpa_key_mgmt_dpp(akmp) ||
|
||||
wpa_key_mgmt_sae(akmp) ||
|
||||
wpa_key_mgmt_suite_b(akmp);
|
||||
}
|
||||
@@ -882,7 +882,7 @@ int wpa_use_aes_key_wrap(int akmp)
|
||||
{
|
||||
return akmp == WPA_KEY_MGMT_OSEN ||
|
||||
akmp == WPA_KEY_MGMT_OWE ||
|
||||
akmp == WPA_KEY_MGMT_DPP ||
|
||||
wpa_key_mgmt_dpp(akmp) ||
|
||||
wpa_key_mgmt_ft(akmp) ||
|
||||
wpa_key_mgmt_sha256(akmp) ||
|
||||
wpa_key_mgmt_sae(akmp) ||
|
||||
|
||||
@@ -857,7 +857,8 @@ void wpa_supplicant_key_neg_complete(struct wpa_sm *sm,
|
||||
sm, addr, MLME_SETPROTECTION_PROTECT_TYPE_RX_TX,
|
||||
MLME_SETPROTECTION_KEY_TYPE_PAIRWISE);
|
||||
|
||||
if (wpa_key_mgmt_wpa_psk(sm->key_mgmt) || sm->key_mgmt == WPA_KEY_MGMT_OWE || sm->key_mgmt == WPA_KEY_MGMT_DPP)
|
||||
if (wpa_key_mgmt_wpa_psk(sm->key_mgmt) || sm->key_mgmt == WPA_KEY_MGMT_OWE ||
|
||||
wpa_key_mgmt_dpp(sm->key_mgmt))
|
||||
eapol_sm_notify_eap_success(TRUE);
|
||||
/*
|
||||
* Start preauthentication after a short wait to avoid a
|
||||
@@ -2349,6 +2350,11 @@ int wpa_set_bss(char *macddr, char * bssid, u8 pairwise_cipher, u8 group_cipher,
|
||||
(os_memcmp(sm->ssid, ssid, ssid_len) != 0)) {
|
||||
use_pmk_cache = false;
|
||||
}
|
||||
|
||||
if (wpa_key_mgmt_dpp(sm->key_mgmt)) {
|
||||
use_pmk_cache = true;
|
||||
}
|
||||
|
||||
sm->pairwise_cipher = BIT(pairwise_cipher);
|
||||
sm->group_cipher = BIT(group_cipher);
|
||||
sm->renew_snonce = 1;
|
||||
@@ -2488,13 +2494,13 @@ wpa_set_passphrase(char * passphrase, u8 *ssid, size_t ssid_len)
|
||||
if (sm->key_mgmt == WPA_KEY_MGMT_SAE ||
|
||||
sm->key_mgmt == WPA_KEY_MGMT_OWE ||
|
||||
sm->key_mgmt == WPA_KEY_MGMT_SAE_EXT_KEY ||
|
||||
sm->key_mgmt == WPA_KEY_MGMT_DPP)
|
||||
wpa_key_mgmt_dpp(sm->key_mgmt))
|
||||
return;
|
||||
|
||||
/* This is really SLOW, so just re cacl while reset param */
|
||||
if (esp_wifi_sta_get_reset_nvs_pmk_internal() != 0) {
|
||||
// check it's psk
|
||||
if (strlen((char *)esp_wifi_sta_get_prof_password_internal()) == 64) {
|
||||
if (os_strlen((char *)esp_wifi_sta_get_prof_password_internal()) == 64) {
|
||||
if (hexstr2bin((char *)esp_wifi_sta_get_prof_password_internal(),
|
||||
esp_wifi_sta_get_ap_info_prof_pmk_internal(), PMK_LEN) != 0)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user