]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Missing/invalid Protocol Version in Reconfig Auth Req
authorJouni Malinen <quic_jouni@quicinc.com>
Mon, 7 Mar 2022 21:40:27 +0000 (23:40 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 7 Mar 2022 21:40:27 +0000 (23:40 +0200)
Extend dpp_test testing functionality to allow the Protocol Version
attribute to be removed or modified to invalid value in Reconfig
Authentication Request.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/common/dpp.h
src/common/dpp_reconfig.c

index 27377f6cf254854236c97a2892d3ce8dc3dd4528..7f6513ff3507ca47e663d7986f0dbefb1c7dc32b 100644 (file)
@@ -515,6 +515,8 @@ enum dpp_test_behavior {
        DPP_TEST_NO_PROTOCOL_VERSION_PEER_DISC_RESP = 93,
        DPP_TEST_INVALID_PROTOCOL_VERSION_PEER_DISC_REQ = 94,
        DPP_TEST_INVALID_PROTOCOL_VERSION_PEER_DISC_RESP = 95,
+       DPP_TEST_INVALID_PROTOCOL_VERSION_RECONFIG_AUTH_REQ = 96,
+       DPP_TEST_NO_PROTOCOL_VERSION_RECONFIG_AUTH_REQ = 97,
 };
 
 extern enum dpp_test_behavior dpp_test;
index 7137bc5fdd431268bb7208e9a70bcc0385a2e365..452c502475126739220d77d6930fd6eab25a2070 100644 (file)
@@ -131,6 +131,7 @@ static struct wpabuf * dpp_reconfig_build_req(struct dpp_authentication *auth)
 {
        struct wpabuf *msg;
        size_t attr_len;
+       u8 ver = DPP_VERSION;
 
        /* Build DPP Reconfig Authentication Request frame attributes */
        attr_len = 4 + 1 + 4 + 1 + 4 + os_strlen(auth->conf->connector) +
@@ -144,10 +145,25 @@ static struct wpabuf * dpp_reconfig_build_req(struct dpp_authentication *auth)
        wpabuf_put_le16(msg, 1);
        wpabuf_put_u8(msg, auth->transaction_id);
 
+#ifdef CONFIG_TESTING_OPTIONS
+       if (dpp_test == DPP_TEST_NO_PROTOCOL_VERSION_RECONFIG_AUTH_REQ) {
+               wpa_printf(MSG_INFO, "DPP: TESTING - no Protocol Version");
+               goto skip_proto_ver;
+       }
+       if (dpp_test == DPP_TEST_INVALID_PROTOCOL_VERSION_RECONFIG_AUTH_REQ) {
+               wpa_printf(MSG_INFO, "DPP: TESTING - invalid Protocol Version");
+               ver = 1;
+       }
+#endif /* CONFIG_TESTING_OPTIONS */
+
        /* Protocol Version */
        wpabuf_put_le16(msg, DPP_ATTR_PROTOCOL_VERSION);
        wpabuf_put_le16(msg, 1);
-       wpabuf_put_u8(msg, DPP_VERSION);
+       wpabuf_put_u8(msg, ver);
+
+#ifdef CONFIG_TESTING_OPTIONS
+skip_proto_ver:
+#endif /* CONFIG_TESTING_OPTIONS */
 
        /* DPP Connector */
        wpabuf_put_le16(msg, DPP_ATTR_CONNECTOR);