]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Testing capability to send unexpected Authentication Response
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 13 Nov 2017 10:47:30 +0000 (12:47 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 13 Nov 2017 10:55:56 +0000 (12:55 +0200)
This is for protocol testing to check what happens if the Responser
receives an unexpected Authentication Response instead of Authentication
Confirm.

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

index e2a6ffd7ff299455ee0722adedb75999214d2912..38ce4a587a2be744debd20416c2171eaf0952023 100644 (file)
@@ -2388,6 +2388,8 @@ static int dpp_auth_build_resp_ok(struct dpp_authentication *auth)
        enum dpp_status_error status = DPP_STATUS_OK;
 
        wpa_printf(MSG_DEBUG, "DPP: Build Authentication Response");
+       if (!auth->own_bi)
+               return -1;
 
        nonce_len = auth->curve->nonce_len;
        if (random_get_bytes(auth->r_nonce, nonce_len)) {
@@ -2514,6 +2516,8 @@ static int dpp_auth_build_resp_status(struct dpp_authentication *auth,
        struct wpabuf *msg;
        const u8 *r_pubkey_hash, *i_pubkey_hash, *i_nonce;
 
+       if (!auth->own_bi)
+               return -1;
        wpa_printf(MSG_DEBUG, "DPP: Build Authentication Response");
 
        r_pubkey_hash = auth->own_bi->pubkey_hash;
@@ -3369,6 +3373,16 @@ dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
        bin_clear_free(unwrapped, unwrapped_len);
        bin_clear_free(unwrapped2, unwrapped2_len);
 
+#ifdef CONFIG_TESTING_OPTIONS
+       if (dpp_test == DPP_TEST_AUTH_RESP_IN_PLACE_OF_CONF) {
+               wpa_printf(MSG_INFO,
+                          "DPP: TESTING - Authentication Response in place of Confirm");
+               if (dpp_auth_build_resp_ok(auth) < 0)
+                       return NULL;
+               return wpabuf_dup(auth->resp_msg);
+       }
+#endif /* CONFIG_TESTING_OPTIONS */
+
        return dpp_auth_build_conf(auth, DPP_STATUS_OK);
 
 fail:
index 6c2805838b73c89d82eb26a70f464029e0589ffd..c288a50214f4ce8bce09bc1b4b70f3de371461ff 100644 (file)
@@ -292,6 +292,7 @@ enum dpp_test_behavior {
        DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_RESP = 62,
        DPP_TEST_NO_STATUS_PEER_DISC_RESP = 63,
        DPP_TEST_NO_CONNECTOR_PEER_DISC_RESP = 64,
+       DPP_TEST_AUTH_RESP_IN_PLACE_OF_CONF = 65,
 };
 
 extern enum dpp_test_behavior dpp_test;