[PATCH 1/1] hostapd: Correct PMK copy length in case of SHA384

Vinayak Yadawad vinayak.yadawad at broadcom.com
Wed Dec 4 01:13:59 PST 2024


Currently in eapol callback PMK update is wrongly done with default
PMK length even in case of SHA384. SHA384 would need higher PMK
length of 48, accordingly correct the PMK length used while PMK
copy.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad at broadcom.com>
---
 wpa_supplicant/wpas_glue.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index e776d5f92..a7baf014a 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -345,7 +345,11 @@ static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol,
 			   "driver-based 4-way hs and FT");
 		res = eapol_sm_get_key(eapol, buf, 2 * PMK_LEN);
 		if (res == 0) {
-			os_memcpy(pmk, buf + PMK_LEN, PMK_LEN);
+			if (wpa_key_mgmt_sha384(wpa_s->key_mgmt)) {
+				os_memcpy(pmk, buf, pmk_len);
+			} else {
+				os_memcpy(pmk, buf + PMK_LEN, PMK_LEN);
+			}
 			os_memset(buf, 0, sizeof(buf));
 		}
 #else /* CONFIG_IEEE80211R */
-- 
2.43.4




More information about the Hostap mailing list