Generate the "extra" data buffer outside wpa_ft_mic() to make this
function easier to share for MLO FT Reassociation Response frame. This
replaces the earlier design in commit
e6f64a8e1daf ("FT: FTE MIC
calculation for MLO Reassociation Request frame").
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
const u8 *rsnie, size_t rsnie_len,
const u8 *ric, size_t ric_len,
const u8 *rsnxe, size_t rsnxe_len,
- const u8 link_addr[MAX_NUM_MLO_LINKS][ETH_ALEN],
+ const struct wpabuf *extra,
u8 *mic)
{
- const u8 *addr[10 + MAX_NUM_MLO_LINKS];
- size_t len[10 + MAX_NUM_MLO_LINKS];
+ const u8 *addr[11];
+ size_t len[11];
size_t i, num_elem = 0;
u8 zero_mic[32];
size_t mic_len, fte_fixed_len;
num_elem++;
}
- if (link_addr) {
- for (i = 0; i < MAX_NUM_MLO_LINKS; i++) {
- if (is_zero_ether_addr(link_addr[i]))
- continue;
- addr[num_elem] = link_addr[i];
- len[num_elem] = ETH_ALEN;
- num_elem++;
- }
+ if (extra) {
+ addr[num_elem] = wpabuf_head(extra);
+ len[num_elem] = wpabuf_len(extra);
+ num_elem++;
}
for (i = 0; i < num_elem; i++)
#pragma pack(pop)
#endif /* _MSC_VER */
-#define MAX_NUM_MLO_LINKS 15
int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver,
const u8 *buf, size_t len, u8 *mic);
const u8 *rsnie, size_t rsnie_len,
const u8 *ric, size_t ric_len,
const u8 *rsnxe, size_t rsnxe_len,
- const u8 link_addr[MAX_NUM_MLO_LINKS][ETH_ALEN],
+ const struct wpabuf *extra,
u8 *mic);
int wpa_derive_pmk_r0(const u8 *xxkey, size_t xxkey_len,
const u8 *ssid, size_t ssid_len,
const u8 *ie2, size_t ie2len);
int wpa_insert_pmkid(u8 *ies, size_t *ies_len, const u8 *pmkid);
+#define MAX_NUM_MLO_LINKS 15
+
struct wpa_ft_ies {
const u8 *mdie;
size_t mdie_len;
const u8 *kck;
size_t kck_len;
const u8 *aa, *spa;
+ struct wpabuf *extra = NULL;
if (elems.basic_mle) {
aa = bss->mld_mac_addr;
kck = sta->ptk.kck;
kck_len = sta->ptk.kck_len;
}
+
+ if (elems.basic_mle) {
+ int i;
+
+ extra = wpabuf_alloc(MAX_NUM_MLO_LINKS * ETH_ALEN);
+ if (!extra)
+ return;
+ for (i = 0; i < MAX_NUM_MLO_LINKS; i++) {
+ if (!is_zero_ether_addr(sta->link_addr[i]))
+ wpabuf_put_data(extra,
+ sta->link_addr[i],
+ ETH_ALEN);
+ }
+ }
+
if (wpa_ft_mic(sta->key_mgmt, kck, kck_len,
spa, aa, 5,
parse.mdie - 2, parse.mdie_len + 2,
parse.ric, parse.ric_len,
parse.rsnxe ? parse.rsnxe - 2 : NULL,
parse.rsnxe ? parse.rsnxe_len + 2 : 0,
- elems.basic_mle ? sta->link_addr : NULL,
+ extra,
mic) < 0) {
+ wpabuf_free(extra);
add_note(wt, MSG_INFO, "FT: Failed to calculate MIC");
return;
}
+ wpabuf_free(extra);
if (os_memcmp_const(mic, fte_mic, mic_len) != 0) {
int link_id;