DPP2: Add DPP KDE into EAPOL-Key msg 2/4 when using DPP AKM

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-05-01 19:53:07 +03:00 committed by Jouni Malinen
parent b11a12401a
commit 143e3d8bc5
4 changed files with 33 additions and 1 deletions

View file

@ -737,7 +737,8 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm,
kde_buf = os_malloc(kde_len + kde_buf = os_malloc(kde_len +
2 + RSN_SELECTOR_LEN + 3 + 2 + RSN_SELECTOR_LEN + 3 +
sm->assoc_rsnxe_len + sm->assoc_rsnxe_len +
2 + RSN_SELECTOR_LEN + 1); 2 + RSN_SELECTOR_LEN + 1 +
2 + RSN_SELECTOR_LEN + 2);
if (!kde_buf) if (!kde_buf)
goto failed; goto failed;
os_memcpy(kde_buf, kde, kde_len); 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 */ #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, if (wpa_supplicant_send_2_of_4(sm, sm->bssid, key, ver, sm->snonce,
kde, kde_len, ptk) < 0) kde, kde_len, ptk) < 0)
goto failed; 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; sm->ft_rsnxe_used = value;
break; break;
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_DPP2
case WPA_PARAM_DPP_PFS:
sm->dpp_pfs = value;
break;
#endif /* CONFIG_DPP2 */
default: default:
break; break;
} }

View file

@ -107,6 +107,7 @@ enum wpa_sm_conf_params {
WPA_PARAM_EXT_KEY_ID, WPA_PARAM_EXT_KEY_ID,
WPA_PARAM_USE_EXT_KEY_ID, WPA_PARAM_USE_EXT_KEY_ID,
WPA_PARAM_FT_RSNXE_USED, WPA_PARAM_FT_RSNXE_USED,
WPA_PARAM_DPP_PFS,
}; };
struct rsn_supp_config { struct rsn_supp_config {

View file

@ -183,6 +183,7 @@ struct wpa_sm {
#ifdef CONFIG_DPP2 #ifdef CONFIG_DPP2
struct wpabuf *dpp_z; struct wpabuf *dpp_z;
int dpp_pfs;
#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP2 */
}; };

View 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) { } else if (wpa_s->key_mgmt == WPA_KEY_MGMT_DPP) {
/* Use PMK from DPP network introduction (PMKSA entry) */ /* Use PMK from DPP network introduction (PMKSA entry) */
wpa_sm_set_pmk_from_pmksa(wpa_s->wpa); 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 */ #endif /* CONFIG_DPP */
} else if (wpa_key_mgmt_wpa_psk(ssid->key_mgmt)) { } else if (wpa_key_mgmt_wpa_psk(ssid->key_mgmt)) {
int psk_set = 0; int psk_set = 0;