]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Omission of Auth Req attributes for protocol testing
authorJouni Malinen <jouni@qca.qualcomm.com>
Sun, 22 Oct 2017 14:20:24 +0000 (17:20 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 22 Oct 2017 15:27:53 +0000 (18:27 +0300)
This extends the dpp_test mechanism to allow each of the required
attributes in Authentication Request to be omitted.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/common/dpp.c
src/common/dpp.h

index 0d5c561ed45abf1286674a189081f852c702dd50..a24829567da09c6534b52577f55f1d289184809f 100644 (file)
@@ -1387,9 +1387,23 @@ static struct wpabuf * dpp_auth_build_req(struct dpp_authentication *auth,
                wpabuf_put_buf(msg, pi);
        }
 
+#ifdef CONFIG_TESTING_OPTIONS
+       if (dpp_test == DPP_TEST_NO_WRAPPED_DATA_AUTH_REQ) {
+               wpa_printf(MSG_INFO, "DPP: TESTING - no Wrapped Data");
+               goto skip_wrapped_data;
+       }
+#endif /* CONFIG_TESTING_OPTIONS */
+
        /* Wrapped data ({I-nonce, I-capabilities}k1) */
        pos = clear;
 
+#ifdef CONFIG_TESTING_OPTIONS
+       if (dpp_test == DPP_TEST_NO_I_NONCE_AUTH_REQ) {
+               wpa_printf(MSG_INFO, "DPP: TESTING - no I-nonce");
+               goto skip_i_nonce;
+       }
+#endif /* CONFIG_TESTING_OPTIONS */
+
        /* I-nonce */
        WPA_PUT_LE16(pos, DPP_ATTR_I_NONCE);
        pos += 2;
@@ -1398,6 +1412,14 @@ static struct wpabuf * dpp_auth_build_req(struct dpp_authentication *auth,
        os_memcpy(pos, auth->i_nonce, nonce_len);
        pos += nonce_len;
 
+#ifdef CONFIG_TESTING_OPTIONS
+skip_i_nonce:
+       if (dpp_test == DPP_TEST_NO_I_CAPAB_AUTH_REQ) {
+               wpa_printf(MSG_INFO, "DPP: TESTING - no I-capab");
+               goto skip_i_capab;
+       }
+#endif /* CONFIG_TESTING_OPTIONS */
+
        /* I-capabilities */
        WPA_PUT_LE16(pos, DPP_ATTR_I_CAPABILITIES);
        pos += 2;
@@ -1411,6 +1433,7 @@ static struct wpabuf * dpp_auth_build_req(struct dpp_authentication *auth,
                wpa_printf(MSG_INFO, "DPP: TESTING - zero I-capabilities");
                pos[-1] = 0;
        }
+skip_i_capab:
 #endif /* CONFIG_TESTING_OPTIONS */
 
        attr_end = wpabuf_put(msg, 0);
@@ -1446,6 +1469,7 @@ static struct wpabuf * dpp_auth_build_req(struct dpp_authentication *auth,
                wpabuf_put_le16(msg, DPP_ATTR_TESTING);
                wpabuf_put_le16(msg, 0);
        }
+skip_wrapped_data:
 #endif /* CONFIG_TESTING_OPTIONS */
 
        wpa_hexdump_buf(MSG_DEBUG,
@@ -1526,6 +1550,20 @@ struct dpp_authentication * dpp_auth_init(void *msg_ctx,
                i_pubkey_hash = zero;
        }
 
+#ifdef CONFIG_TESTING_OPTIONS
+       if (dpp_test == DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_REQ) {
+               wpa_printf(MSG_INFO, "DPP: TESTING - no R-Bootstrap Key Hash");
+               r_pubkey_hash = NULL;
+       } else if (dpp_test == DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_REQ) {
+               wpa_printf(MSG_INFO, "DPP: TESTING - no I-Bootstrap Key Hash");
+               i_pubkey_hash = NULL;
+       } else if (dpp_test == DPP_TEST_NO_I_PROTO_KEY_AUTH_REQ) {
+               wpa_printf(MSG_INFO, "DPP: TESTING - no I-Proto Key");
+               wpabuf_free(pi);
+               pi = NULL;
+       }
+#endif /* CONFIG_TESTING_OPTIONS */
+
        auth->req_msg = dpp_auth_build_req(auth, pi, nonce_len, r_pubkey_hash,
                                           i_pubkey_hash);
        if (!auth->req_msg)
index ecad2d6e06c1a6dea6e93e5eb97987619880e395..3c4ccc624fb09e4c0af30ee5ab492413a1bb8ed6 100644 (file)
@@ -216,6 +216,12 @@ enum dpp_test_behavior {
        DPP_TEST_AFTER_WRAPPED_DATA_CONF_RESP = 7,
        DPP_TEST_ZERO_I_CAPAB = 8,
        DPP_TEST_ZERO_R_CAPAB = 9,
+       DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 10,
+       DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 11,
+       DPP_TEST_NO_I_PROTO_KEY_AUTH_REQ = 12,
+       DPP_TEST_NO_I_NONCE_AUTH_REQ = 13,
+       DPP_TEST_NO_I_CAPAB_AUTH_REQ = 14,
+       DPP_TEST_NO_WRAPPED_DATA_AUTH_REQ = 15,
 };
 
 extern enum dpp_test_behavior dpp_test;