OWE: Allow DH Parameters element to be overridden for testing purposes
This allows CONFIG_TESTING_OPTIONS=y builds of wpa_supplicant to override the OWE DH Parameters element in (Re)Association Request frames with arbitrary data specified with the "VENDOR_ELEM_ADD 13 <IE>" command. This is only for testing purposes. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
2e37b5fbe7
commit
265bda3444
3 changed files with 41 additions and 0 deletions
|
@ -1433,6 +1433,40 @@ const u8 * get_ie(const u8 *ies, size_t len, u8 eid)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* get_ie_ext - Fetch a specified extended information element from IEs buffer
|
||||
* @ies: Information elements buffer
|
||||
* @len: Information elements buffer length
|
||||
* @ext: Information element extension identifier (WLAN_EID_EXT_*)
|
||||
* Returns: Pointer to the information element (id field) or %NULL if not found
|
||||
*
|
||||
* This function returns the first matching information element in the IEs
|
||||
* buffer or %NULL in case the element is not found.
|
||||
*/
|
||||
const u8 * get_ie_ext(const u8 *ies, size_t len, u8 ext)
|
||||
{
|
||||
const u8 *end;
|
||||
|
||||
if (!ies)
|
||||
return NULL;
|
||||
|
||||
end = ies + len;
|
||||
|
||||
while (end - ies > 1) {
|
||||
if (2 + ies[1] > end - ies)
|
||||
break;
|
||||
|
||||
if (ies[0] == WLAN_EID_EXTENSION && ies[1] >= 1 &&
|
||||
ies[2] == ext)
|
||||
return ies;
|
||||
|
||||
ies += 2 + ies[1];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
size_t mbo_add_ie(u8 *buf, size_t len, const u8 *attr, size_t attr_len)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -176,6 +176,7 @@ extern const struct oper_class_map global_op_class[];
|
|||
extern size_t global_op_class_size;
|
||||
|
||||
const u8 * get_ie(const u8 *ies, size_t len, u8 eid);
|
||||
const u8 * get_ie_ext(const u8 *ies, size_t len, u8 ext);
|
||||
|
||||
size_t mbo_add_ie(u8 *buf, size_t len, const u8 *attr, size_t attr_len);
|
||||
|
||||
|
|
|
@ -1192,6 +1192,12 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
|
|||
#endif /* CONFIG_FILS */
|
||||
|
||||
#ifdef CONFIG_OWE
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (get_ie_ext(wpa_s->sme.assoc_req_ie, wpa_s->sme.assoc_req_ie_len,
|
||||
WLAN_EID_EXT_OWE_DH_PARAM)) {
|
||||
wpa_printf(MSG_INFO, "TESTING: Override OWE DH element");
|
||||
} else
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
if (auth_type == WLAN_AUTH_OPEN &&
|
||||
wpa_s->key_mgmt == WPA_KEY_MGMT_OWE) {
|
||||
struct wpabuf *owe_ie;
|
||||
|
|
Loading…
Reference in a new issue