]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Add DPP KDE into EAPOL-Key msg 2/4 when using DPP AKM
authorJouni Malinen <jouni@codeaurora.org>
Fri, 1 May 2020 16:53:07 +0000 (19:53 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 3 May 2020 21:37:44 +0000 (00:37 +0300)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/rsn_supp/wpa.c
src/rsn_supp/wpa.h
src/rsn_supp/wpa_i.h
wpa_supplicant/wpa_supplicant.c

index 605d40863c22c888a612d2ac5bebb06e08eaa421..22dd542f3702be43225fae76d164051c0474bbc0 100644 (file)
@@ -737,7 +737,8 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm,
        kde_buf = os_malloc(kde_len +
                            2 + RSN_SELECTOR_LEN + 3 +
                            sm->assoc_rsnxe_len +
-                           2 + RSN_SELECTOR_LEN + 1);
+                           2 + RSN_SELECTOR_LEN + 1 +
+                           2 + RSN_SELECTOR_LEN + 2);
        if (!kde_buf)
                goto failed;
        os_memcpy(kde_buf, kde, kde_len);
@@ -782,6 +783,27 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm,
        }
 #endif /* CONFIG_P2P */
 
+#ifdef CONFIG_DPP2
+       if (sm->key_mgmt == WPA_KEY_MGMT_DPP) {
+               u8 *pos;
+
+               wpa_printf(MSG_DEBUG, "DPP: Add DPP KDE into EAPOL-Key 2/4");
+               pos = kde + kde_len;
+               *pos++ = WLAN_EID_VENDOR_SPECIFIC;
+               *pos++ = RSN_SELECTOR_LEN + 2;
+               RSN_SELECTOR_PUT(pos, WFA_KEY_DATA_DPP);
+               pos += RSN_SELECTOR_LEN;
+               *pos++ = 2; /* Protocol Version */
+               *pos = 0; /* Flags */
+               if (sm->dpp_pfs == 0)
+                       *pos |= DPP_KDE_PFS_ALLOWED;
+               else if (sm->dpp_pfs == 1)
+                       *pos |= DPP_KDE_PFS_ALLOWED | DPP_KDE_PFS_REQUIRED;
+               pos++;
+               kde_len = pos - kde;
+       }
+#endif /* CONFIG_DPP2 */
+
        if (wpa_supplicant_send_2_of_4(sm, sm->bssid, key, ver, sm->snonce,
                                       kde, kde_len, ptk) < 0)
                goto failed;
@@ -3255,6 +3277,11 @@ int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param,
                sm->ft_rsnxe_used = value;
                break;
 #endif /* CONFIG_TESTING_OPTIONS */
+#ifdef CONFIG_DPP2
+       case WPA_PARAM_DPP_PFS:
+               sm->dpp_pfs = value;
+               break;
+#endif /* CONFIG_DPP2 */
        default:
                break;
        }
index 0986c6c615e7bc19278cb528fe17f440408bc23a..dfc156b5514d73e01bd1eecf6c718c248e7a4442 100644 (file)
@@ -107,6 +107,7 @@ enum wpa_sm_conf_params {
        WPA_PARAM_EXT_KEY_ID,
        WPA_PARAM_USE_EXT_KEY_ID,
        WPA_PARAM_FT_RSNXE_USED,
+       WPA_PARAM_DPP_PFS,
 };
 
 struct rsn_supp_config {
index 497d128852e98784ce3ae6f18013c878a06ea254..f7d9f62550b2f19f02ace652b768565a31b2fe04 100644 (file)
@@ -183,6 +183,7 @@ struct wpa_sm {
 
 #ifdef CONFIG_DPP2
        struct wpabuf *dpp_z;
+       int dpp_pfs;
 #endif /* CONFIG_DPP2 */
 };
 
index bac3d9796c50bc6bcccaa67604049e1a9c56f11f..53f8c94667ce07ebc15e62bb91321570c8b26944 100644 (file)
@@ -1685,6 +1685,9 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
        } else if (wpa_s->key_mgmt == WPA_KEY_MGMT_DPP) {
                /* Use PMK from DPP network introduction (PMKSA entry) */
                wpa_sm_set_pmk_from_pmksa(wpa_s->wpa);
+#ifdef CONFIG_DPP2
+               wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_DPP_PFS, ssid->dpp_pfs);
+#endif /* CONFIG_DPP2 */
 #endif /* CONFIG_DPP */
        } else if (wpa_key_mgmt_wpa_psk(ssid->key_mgmt)) {
                int psk_set = 0;