]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAPOL: Update PMK length in EAPOL callback to support longer keys
authorVinayak Yadawad <vinayak.yadawad@broadcom.com>
Thu, 30 Jun 2022 04:08:14 +0000 (09:38 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 31 Aug 2022 14:23:45 +0000 (17:23 +0300)
With introduction of newer AKMs, there is a need to update the PMK
length plumbed for the driver based 4-way handshake. To support this,
the current update the PMK length to 48, if the key management type uses
SHA-384. This is needed, e.g., for SUITE-B-192.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
wpa_supplicant/wpas_glue.c

index ccc72c4d65f4e04f9f969ba23c494e863c0e4fd6..0d8233626985525bd9d1d66e3b5a41ba036e4751 100644 (file)
@@ -286,7 +286,7 @@ static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol,
 {
        struct wpa_supplicant *wpa_s = ctx;
        int res, pmk_len;
-       u8 pmk[PMK_LEN];
+       u8 pmk[PMK_LEN_MAX];
 
        wpa_printf(MSG_DEBUG, "EAPOL authentication completed - result=%s",
                   result_str(result));
@@ -326,7 +326,11 @@ static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol,
        wpa_printf(MSG_DEBUG, "Configure PMK for driver-based RSN 4-way "
                   "handshake");
 
-       pmk_len = PMK_LEN;
+       if (wpa_key_mgmt_sha384(wpa_s->key_mgmt))
+               pmk_len = PMK_LEN_SUITE_B_192;
+       else
+               pmk_len = PMK_LEN;
+
        if (wpa_key_mgmt_ft(wpa_s->key_mgmt)) {
 #ifdef CONFIG_IEEE80211R
                u8 buf[2 * PMK_LEN];
@@ -341,7 +345,7 @@ static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol,
                res = -1;
 #endif /* CONFIG_IEEE80211R */
        } else {
-               res = eapol_sm_get_key(eapol, pmk, PMK_LEN);
+               res = eapol_sm_get_key(eapol, pmk, pmk_len);
                if (res) {
                        /*
                         * EAP-LEAP is an exception from other EAP methods: it