From b11a12401a36f733f7fca3a89ca290cd18cf6762 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 1 May 2020 19:51:34 +0300 Subject: [PATCH] DPP2: Add DPP KDE into EAPOL-Key msg 3/4 when using DPP AKM Signed-off-by: Jouni Malinen --- src/ap/wpa_auth.c | 21 +++++++++++++++++++++ src/common/wpa_common.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index 30e725864..fad0623b0 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -3397,6 +3397,11 @@ SM_STATE(WPA_PTK, PTKINITNEGOTIATING) if (conf->transition_disable) kde_len += 2 + RSN_SELECTOR_LEN + 1; +#ifdef CONFIG_DPP2 + if (sm->wpa_key_mgmt == WPA_KEY_MGMT_DPP) + kde_len += 2 + RSN_SELECTOR_LEN + 2; +#endif /* CONFIG_DPP2 */ + kde = os_malloc(kde_len); if (!kde) goto done; @@ -3492,6 +3497,22 @@ SM_STATE(WPA_PTK, PTKINITNEGOTIATING) pos = wpa_add_kde(pos, WFA_KEY_DATA_TRANSITION_DISABLE, &conf->transition_disable, 1, NULL, 0); +#ifdef CONFIG_DPP2 + if (sm->wpa_key_mgmt == WPA_KEY_MGMT_DPP) { + u8 payload[2]; + + payload[0] = 2; /* Protocol Version */ + payload[1] = 0; /* Flags */ + if (conf->dpp_pfs == 0) + payload[1] |= DPP_KDE_PFS_ALLOWED; + else if (conf->dpp_pfs == 1) + payload[1] |= DPP_KDE_PFS_ALLOWED | + DPP_KDE_PFS_REQUIRED; + pos = wpa_add_kde(pos, WFA_KEY_DATA_DPP, + payload, sizeof(payload), NULL, 0); + } +#endif /* CONFIG_DPP2 */ + wpa_send_eapol(sm->wpa_auth, sm, (secure ? WPA_KEY_INFO_SECURE : 0) | (wpa_mic_len(sm->wpa_key_mgmt, sm->pmk_len) ? diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h index c0ef689c6..9ad9edc73 100644 --- a/src/common/wpa_common.h +++ b/src/common/wpa_common.h @@ -124,6 +124,7 @@ WPA_CIPHER_BIP_CMAC_256) #define WFA_KEY_DATA_IP_ADDR_REQ RSN_SELECTOR(0x50, 0x6f, 0x9a, 4) #define WFA_KEY_DATA_IP_ADDR_ALLOC RSN_SELECTOR(0x50, 0x6f, 0x9a, 5) #define WFA_KEY_DATA_TRANSITION_DISABLE RSN_SELECTOR(0x50, 0x6f, 0x9a, 0x20) +#define WFA_KEY_DATA_DPP RSN_SELECTOR(0x50, 0x6f, 0x9a, 0x21) #define WPA_OUI_TYPE RSN_SELECTOR(0x00, 0x50, 0xf2, 1) @@ -362,6 +363,10 @@ struct rsn_rdie { #define TRANSITION_DISABLE_WPA3_ENTERPRISE BIT(2) #define TRANSITION_DISABLE_ENHANCED_OPEN BIT(3) +/* DPP KDE Flags */ +#define DPP_KDE_PFS_ALLOWED BIT(0) +#define DPP_KDE_PFS_REQUIRED BIT(1) + #ifdef _MSC_VER #pragma pack(pop) #endif /* _MSC_VER */