From 67b3bcc95403fb7e90cd73216f0214e33f8c1246 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 14 Mar 2019 17:08:44 +0200 Subject: [PATCH] DPP2: Testing option for Config Object rejction Add a new testing option to force Enrollee to reject the receive Config Object. Signed-off-by: Jouni Malinen --- src/ap/dpp_hostapd.c | 6 ++++++ src/common/dpp.h | 1 + wpa_supplicant/dpp_supplicant.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c index a84654d2d..7184f7204 100644 --- a/src/ap/dpp_hostapd.c +++ b/src/ap/dpp_hostapd.c @@ -1119,6 +1119,12 @@ static void hostapd_dpp_gas_resp_cb(void *ctx, const u8 *addr, u8 dialog_token, hostapd_dpp_handle_config_obj(hapd, auth); status = DPP_STATUS_OK; +#ifdef CONFIG_TESTING_OPTIONS + if (dpp_test == DPP_TEST_REJECT_CONFIG) { + wpa_printf(MSG_INFO, "DPP: TESTING - Reject Config Object"); + status = DPP_STATUS_CONFIG_REJECTED; + } +#endif /* CONFIG_TESTING_OPTIONS */ fail: if (status != DPP_STATUS_OK) wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); diff --git a/src/common/dpp.h b/src/common/dpp.h index 4af913bc1..fe4b7f3a2 100644 --- a/src/common/dpp.h +++ b/src/common/dpp.h @@ -345,6 +345,7 @@ enum dpp_test_behavior { DPP_TEST_STOP_AT_AUTH_RESP = 88, DPP_TEST_STOP_AT_AUTH_CONF = 89, DPP_TEST_STOP_AT_CONF_REQ = 90, + DPP_TEST_REJECT_CONFIG = 91, }; extern enum dpp_test_behavior dpp_test; diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c index 8de53ad8b..411bfff83 100644 --- a/wpa_supplicant/dpp_supplicant.c +++ b/wpa_supplicant/dpp_supplicant.c @@ -1428,6 +1428,12 @@ static void wpas_dpp_gas_resp_cb(void *ctx, const u8 *addr, u8 dialog_token, goto fail; status = DPP_STATUS_OK; +#ifdef CONFIG_TESTING_OPTIONS + if (dpp_test == DPP_TEST_REJECT_CONFIG) { + wpa_printf(MSG_INFO, "DPP: TESTING - Reject Config Object"); + status = DPP_STATUS_CONFIG_REJECTED; + } +#endif /* CONFIG_TESTING_OPTIONS */ fail: if (status != DPP_STATUS_OK) wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED);