DPP: Allow PKEX own/peer MAC addresses to be overridden
This is for testing purposes to allow a test vector with specific values to be generated. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
af4103e5e9
commit
2bdc47a945
3 changed files with 41 additions and 0 deletions
|
@ -30,6 +30,8 @@
|
|||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
enum dpp_test_behavior dpp_test = DPP_TEST_DISABLED;
|
||||
u8 dpp_pkex_own_mac_override[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
||||
u8 dpp_pkex_peer_mac_override[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
static int dpp_test_gen_invalid_key(struct wpabuf *msg,
|
||||
const struct dpp_curve_params *curve);
|
||||
|
@ -6166,6 +6168,14 @@ struct dpp_pkex * dpp_pkex_init(void *msg_ctx, struct dpp_bootstrap_info *bi,
|
|||
{
|
||||
struct dpp_pkex *pkex;
|
||||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (!is_zero_ether_addr(dpp_pkex_own_mac_override)) {
|
||||
wpa_printf(MSG_INFO, "DPP: TESTING - own_mac override " MACSTR,
|
||||
MAC2STR(dpp_pkex_own_mac_override));
|
||||
own_mac = dpp_pkex_own_mac_override;
|
||||
}
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
pkex = os_zalloc(sizeof(*pkex));
|
||||
if (!pkex)
|
||||
return NULL;
|
||||
|
@ -6370,6 +6380,19 @@ struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (!is_zero_ether_addr(dpp_pkex_peer_mac_override)) {
|
||||
wpa_printf(MSG_INFO, "DPP: TESTING - peer_mac override " MACSTR,
|
||||
MAC2STR(dpp_pkex_peer_mac_override));
|
||||
peer_mac = dpp_pkex_peer_mac_override;
|
||||
}
|
||||
if (!is_zero_ether_addr(dpp_pkex_own_mac_override)) {
|
||||
wpa_printf(MSG_INFO, "DPP: TESTING - own_mac override " MACSTR,
|
||||
MAC2STR(dpp_pkex_own_mac_override));
|
||||
own_mac = dpp_pkex_own_mac_override;
|
||||
}
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
attr_id = dpp_get_attr(buf, len, DPP_ATTR_CODE_IDENTIFIER,
|
||||
&attr_id_len);
|
||||
if (!attr_id && identifier) {
|
||||
|
@ -6694,6 +6717,14 @@ struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex,
|
|||
if (pkex->failed || pkex->t >= PKEX_COUNTER_T_LIMIT || !pkex->initiator)
|
||||
return NULL;
|
||||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (!is_zero_ether_addr(dpp_pkex_peer_mac_override)) {
|
||||
wpa_printf(MSG_INFO, "DPP: TESTING - peer_mac override " MACSTR,
|
||||
MAC2STR(dpp_pkex_peer_mac_override));
|
||||
peer_mac = dpp_pkex_peer_mac_override;
|
||||
}
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
os_memcpy(pkex->peer_mac, peer_mac, ETH_ALEN);
|
||||
|
||||
attr_status = dpp_get_attr(buf, buflen, DPP_ATTR_STATUS,
|
||||
|
|
|
@ -324,6 +324,8 @@ enum dpp_test_behavior {
|
|||
};
|
||||
|
||||
extern enum dpp_test_behavior dpp_test;
|
||||
extern u8 dpp_pkex_own_mac_override[ETH_ALEN];
|
||||
extern u8 dpp_pkex_peer_mac_override[ETH_ALEN];
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
void dpp_bootstrap_info_free(struct dpp_bootstrap_info *info);
|
||||
|
|
|
@ -615,6 +615,12 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
|
|||
wpa_s->dpp_resp_max_tries = atoi(value);
|
||||
} else if (os_strcasecmp(cmd, "dpp_resp_retry_time") == 0) {
|
||||
wpa_s->dpp_resp_retry_time = atoi(value);
|
||||
} else if (os_strcasecmp(cmd, "dpp_pkex_own_mac_override") == 0) {
|
||||
if (hwaddr_aton(value, dpp_pkex_own_mac_override))
|
||||
ret = -1;
|
||||
} else if (os_strcasecmp(cmd, "dpp_pkex_peer_mac_override") == 0) {
|
||||
if (hwaddr_aton(value, dpp_pkex_peer_mac_override))
|
||||
ret = -1;
|
||||
#endif /* CONFIG_DPP */
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
} else if (os_strcasecmp(cmd, "ext_mgmt_frame_handling") == 0) {
|
||||
|
@ -7761,6 +7767,8 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
|
|||
wpa_s->dpp_resp_wait_time = 0;
|
||||
wpa_s->dpp_resp_max_tries = 0;
|
||||
wpa_s->dpp_resp_retry_time = 0;
|
||||
os_memset(dpp_pkex_own_mac_override, 0, ETH_ALEN);
|
||||
os_memset(dpp_pkex_peer_mac_override, 0, ETH_ALEN);
|
||||
#endif /* CONFIG_DPP */
|
||||
|
||||
#ifdef CONFIG_TDLS
|
||||
|
|
Loading…
Reference in a new issue