wlantest: Fix PMK length and passphrase-based key derivation for FT

The change to support variable length PMK in wlantest missed couple of
places where the PMK length did not get used or set properly. In
particular, this ended up breaking FT key derivation for the case where
a passphrase was used to derive a potential per-BSS PMK. Fix this by
setting and using the PMK length properly.

Fixes: 6c29d95a90 ("wlantest: Support variable length PMK")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2021-10-14 16:28:02 +03:00 committed by Jouni Malinen
parent 9ef8491d97
commit 22828b6dba
2 changed files with 2 additions and 1 deletions

View file

@ -102,6 +102,7 @@ int bss_add_pmk_from_passphrase(struct wlantest_bss *bss,
" based on passphrase '%s'", " based on passphrase '%s'",
MAC2STR(bss->bssid), passphrase); MAC2STR(bss->bssid), passphrase);
wpa_hexdump(MSG_DEBUG, "Possible PMK", pmk->pmk, PMK_LEN); wpa_hexdump(MSG_DEBUG, "Possible PMK", pmk->pmk, PMK_LEN);
pmk->pmk_len = PMK_LEN;
dl_list_add(&bss->pmk, &pmk->list); dl_list_add(&bss->pmk, &pmk->list);
return 0; return 0;

View file

@ -124,7 +124,7 @@ static int try_pmk(struct wlantest *wt, struct wlantest_bss *bss,
check_mic(ptk.kck, ptk.kck_len, sta->key_mgmt, ver, data, check_mic(ptk.kck, ptk.kck_len, sta->key_mgmt, ver, data,
len) < 0) len) < 0)
return -1; return -1;
} else if (wpa_pmk_to_ptk(pmk->pmk, PMK_LEN, } else if (wpa_pmk_to_ptk(pmk->pmk, pmk->pmk_len,
"Pairwise key expansion", "Pairwise key expansion",
bss->bssid, sta->addr, sta->anonce, bss->bssid, sta->addr, sta->anonce,
sta->snonce, &ptk, sta->key_mgmt, sta->snonce, &ptk, sta->key_mgmt,