DPP: Provide peer_mac to PKEX Initiator through function argument

Avoid unnecessary direct write to a struct dpp_pkex member from outside
dpp.c.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2017-11-23 23:32:33 +02:00 committed by Jouni Malinen
parent 918a2ac40f
commit af4103e5e9
4 changed files with 6 additions and 4 deletions

View file

@ -1198,8 +1198,7 @@ hostapd_dpp_rx_pkex_exchange_resp(struct hostapd_data *hapd, const u8 *src,
return; return;
} }
os_memcpy(hapd->dpp_pkex->peer_mac, src, ETH_ALEN); msg = dpp_pkex_rx_exchange_resp(hapd->dpp_pkex, src, buf, len);
msg = dpp_pkex_rx_exchange_resp(hapd->dpp_pkex, buf, len);
if (!msg) { if (!msg) {
wpa_printf(MSG_DEBUG, "DPP: Failed to process the response"); wpa_printf(MSG_DEBUG, "DPP: Failed to process the response");
return; return;

View file

@ -6671,6 +6671,7 @@ fail:
struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex, struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex,
const u8 *peer_mac,
const u8 *buf, size_t buflen) const u8 *buf, size_t buflen)
{ {
const u8 *attr_status, *attr_id, *attr_key, *attr_group; const u8 *attr_status, *attr_id, *attr_key, *attr_group;
@ -6693,6 +6694,8 @@ struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex,
if (pkex->failed || pkex->t >= PKEX_COUNTER_T_LIMIT || !pkex->initiator) if (pkex->failed || pkex->t >= PKEX_COUNTER_T_LIMIT || !pkex->initiator)
return NULL; return NULL;
os_memcpy(pkex->peer_mac, peer_mac, ETH_ALEN);
attr_status = dpp_get_attr(buf, buflen, DPP_ATTR_STATUS, attr_status = dpp_get_attr(buf, buflen, DPP_ATTR_STATUS,
&attr_status_len); &attr_status_len);
if (!attr_status || attr_status_len != 1) { if (!attr_status || attr_status_len != 1) {

View file

@ -396,6 +396,7 @@ struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx,
const char *code, const char *code,
const u8 *buf, size_t len); const u8 *buf, size_t len);
struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex, struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex,
const u8 *peer_mac,
const u8 *buf, size_t len); const u8 *buf, size_t len);
struct wpabuf * dpp_pkex_rx_commit_reveal_req(struct dpp_pkex *pkex, struct wpabuf * dpp_pkex_rx_commit_reveal_req(struct dpp_pkex *pkex,
const u8 *hdr, const u8 *hdr,

View file

@ -1796,8 +1796,7 @@ wpas_dpp_rx_pkex_exchange_resp(struct wpa_supplicant *wpa_s, const u8 *src,
eloop_cancel_timeout(wpas_dpp_pkex_retry_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_pkex_retry_timeout, wpa_s, NULL);
wpa_s->dpp_pkex->exch_req_wait_time = 0; wpa_s->dpp_pkex->exch_req_wait_time = 0;
os_memcpy(wpa_s->dpp_pkex->peer_mac, src, ETH_ALEN); msg = dpp_pkex_rx_exchange_resp(wpa_s->dpp_pkex, src, buf, len);
msg = dpp_pkex_rx_exchange_resp(wpa_s->dpp_pkex, buf, len);
if (!msg) { if (!msg) {
wpa_printf(MSG_DEBUG, "DPP: Failed to process the response"); wpa_printf(MSG_DEBUG, "DPP: Failed to process the response");
return; return;