From 22828b6dba87dc6b36886cc8bd0f95545cf1d914 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 14 Oct 2021 16:28:02 +0300 Subject: [PATCH] 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: 6c29d95a9062 ("wlantest: Support variable length PMK") Signed-off-by: Jouni Malinen --- wlantest/bss.c | 1 + wlantest/rx_eapol.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/wlantest/bss.c b/wlantest/bss.c index 1834aecba..4fc0b17a7 100644 --- a/wlantest/bss.c +++ b/wlantest/bss.c @@ -102,6 +102,7 @@ int bss_add_pmk_from_passphrase(struct wlantest_bss *bss, " based on passphrase '%s'", MAC2STR(bss->bssid), passphrase); wpa_hexdump(MSG_DEBUG, "Possible PMK", pmk->pmk, PMK_LEN); + pmk->pmk_len = PMK_LEN; dl_list_add(&bss->pmk, &pmk->list); return 0; diff --git a/wlantest/rx_eapol.c b/wlantest/rx_eapol.c index e754f5ff9..967d52199 100644 --- a/wlantest/rx_eapol.c +++ b/wlantest/rx_eapol.c @@ -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, len) < 0) 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", bss->bssid, sta->addr, sta->anonce, sta->snonce, &ptk, sta->key_mgmt,