From 77ddd38b66f1b796299b072f7c2f72976069cc3a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 3 Dec 2021 12:09:18 +0200 Subject: [PATCH] DPP3: Add build option for version 3 functionality CONFIG_DPP3=y can now be used to configure hostapd and wpa_supplicant builds to include DPP version 3 functionality. This functionality is still under design and the implementation is experimental and not suitable to be enabled in production uses before the specification has been finalized. Signed-off-by: Jouni Malinen --- hostapd/Android.mk | 3 +++ hostapd/Makefile | 3 +++ hostapd/ctrl_iface.c | 4 +++- hostapd/defconfig | 8 ++++++++ src/common/dpp.c | 9 +++++++-- src/common/dpp.h | 4 +++- tests/hwsim/test_dpp.py | 8 ++++++-- wpa_supplicant/Android.mk | 3 +++ wpa_supplicant/Makefile | 3 +++ wpa_supplicant/ctrl_iface.c | 8 ++++++-- wpa_supplicant/defconfig | 7 ++++++- 11 files changed, 51 insertions(+), 9 deletions(-) diff --git a/hostapd/Android.mk b/hostapd/Android.mk index dd8aa2450..bf26e41c6 100644 --- a/hostapd/Android.mk +++ b/hostapd/Android.mk @@ -567,6 +567,9 @@ NEED_ASN1=y ifdef CONFIG_DPP2 L_CFLAGS += -DCONFIG_DPP2 endif +ifdef CONFIG_DPP3 +L_CFLAGS += -DCONFIG_DPP3 +endif endif ifdef CONFIG_PASN diff --git a/hostapd/Makefile b/hostapd/Makefile index ac085fd10..e37c13b27 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -593,6 +593,9 @@ NEED_ASN1=y ifdef CONFIG_DPP2 CFLAGS += -DCONFIG_DPP2 endif +ifdef CONFIG_DPP3 +CFLAGS += -DCONFIG_DPP3 +endif endif ifdef CONFIG_PASN diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 6c99a3105..9c7527d08 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -4492,7 +4492,9 @@ static void hostapd_ctrl_iface_flush(struct hapd_interfaces *interfaces) #ifdef CONFIG_TESTING_OPTIONS #ifdef CONFIG_DPP dpp_test = DPP_TEST_DISABLED; -#ifdef CONFIG_DPP2 +#ifdef CONFIG_DPP3 + dpp_version_override = 3; +#elif defined(CONFIG_DPP2) dpp_version_override = 2; #else /* CONFIG_DPP2 */ dpp_version_override = 1; diff --git a/hostapd/defconfig b/hostapd/defconfig index 666447e4a..6b50b6c59 100644 --- a/hostapd/defconfig +++ b/hostapd/defconfig @@ -402,3 +402,11 @@ CONFIG_IPV6=y # production use. # This requires CONFIG_IEEE80211W=y to be enabled, too. #CONFIG_PASN=y + +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +CONFIG_DPP=y +# DPP version 2 support +CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y diff --git a/src/common/dpp.c b/src/common/dpp.c index 1fd074f05..f54b86f97 100644 --- a/src/common/dpp.c +++ b/src/common/dpp.c @@ -28,7 +28,9 @@ static const char * dpp_netrole_str(enum dpp_netrole netrole); #ifdef CONFIG_TESTING_OPTIONS -#ifdef CONFIG_DPP2 +#ifdef CONFIG_DPP3 +int dpp_version_override = 3; +#elif defined(CONFIG_DPP2) int dpp_version_override = 2; #else int dpp_version_override = 1; @@ -306,6 +308,8 @@ int dpp_parse_uri_version(struct dpp_bootstrap_info *bi, const char *version) bi->version = 1; else if (*version == '2') bi->version = 2; + else if (*version == '3') + bi->version = 3; else wpa_printf(MSG_DEBUG, "DPP: Unknown URI version"); @@ -628,7 +632,8 @@ int dpp_gen_uri(struct dpp_bootstrap_info *bi) macstr, bi->info ? "I:" : "", bi->info ? bi->info : "", bi->info ? ";" : "", - DPP_VERSION == 2 ? "V:2;" : "", + DPP_VERSION == 3 ? "V:3;" : + (DPP_VERSION == 2 ? "V:2;" : ""), bi->pk); return 0; } diff --git a/src/common/dpp.h b/src/common/dpp.h index a47c685f6..8e959051a 100644 --- a/src/common/dpp.h +++ b/src/common/dpp.h @@ -25,7 +25,9 @@ struct dpp_reconfig_id; #define DPP_VERSION (dpp_version_override) extern int dpp_version_override; #else /* CONFIG_TESTING_OPTIONS */ -#ifdef CONFIG_DPP2 +#ifdef CONFIG_DPP3 +#define DPP_VERSION 3 +#elif defined(CONFIG_DPP2) #define DPP_VERSION 2 #else #define DPP_VERSION 1 diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index 4ed2652ef..87946c01d 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -126,8 +126,12 @@ def test_dpp_uri_version(dev, apdev): uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1) info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id1) logger.info("Parsed URI info:\n" + info) - if "version=2" not in info.splitlines(): - raise Exception("Unexpected version information (v2)") + capa = dev[0].request("GET_CAPABILITY dpp") + ver = 1 + if capa.startswith("DPP="): + ver = int(capa[4:]) + if "version=%d" % ver not in info.splitlines(): + raise Exception("Unexpected version information (with indication)") dev[0].set("dpp_version_override", "1") id0 = dev[0].dpp_bootstrap_gen() diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk index 0aacafd4a..7e597f396 100644 --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk @@ -279,6 +279,9 @@ NEED_ASN1=y ifdef CONFIG_DPP2 L_CFLAGS += -DCONFIG_DPP2 endif +ifdef CONFIG_DPP3 +L_CFLAGS += -DCONFIG_DPP3 +endif endif ifdef CONFIG_OWE diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index ce1c8b2e3..cb66defac 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -294,6 +294,9 @@ NEED_ASN1=y ifdef CONFIG_DPP2 CFLAGS += -DCONFIG_DPP2 endif +ifdef CONFIG_DPP3 +CFLAGS += -DCONFIG_DPP3 +endif endif ifdef CONFIG_OWE diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 9dc17f5ee..90f3e9fe9 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -4826,7 +4826,9 @@ static int wpa_supplicant_ctrl_iface_get_capability( #ifdef CONFIG_DPP if (os_strcmp(field, "dpp") == 0) { -#ifdef CONFIG_DPP2 +#ifdef CONFIG_DPP3 + res = os_snprintf(buf, buflen, "DPP=3"); +#elif defined(CONFIG_DPP2) res = os_snprintf(buf, buflen, "DPP=2"); #else /* CONFIG_DPP2 */ res = os_snprintf(buf, buflen, "DPP=1"); @@ -8477,7 +8479,9 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) dpp_pkex_ephemeral_key_override_len = 0; dpp_protocol_key_override_len = 0; dpp_nonce_override_len = 0; -#ifdef CONFIG_DPP2 +#ifdef CONFIG_DPP3 + dpp_version_override = 3; +#elif defined(CONFIG_DPP2) dpp_version_override = 2; #else /* CONFIG_DPP2 */ dpp_version_override = 1; diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig index 708a82385..a4719dbb5 100644 --- a/wpa_supplicant/defconfig +++ b/wpa_supplicant/defconfig @@ -603,8 +603,13 @@ CONFIG_BGSCAN_SIMPLE=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) CONFIG_DPP=y +# DPP version 2 support +CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y # Wired equivalent privacy (WEP) # WEP is an obsolete cryptographic data confidentiality algorithm that is not