Browse Source

DPP: Protocol testing capability to send invalid I-Nonce in Auth Req

Extend dpp_test to cover one more invalid behavior.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 7 years ago
parent
commit
a444673957
2 changed files with 11 additions and 0 deletions
  1. 10 0
      src/common/dpp.c
  2. 1 0
      src/common/dpp.h

+ 10 - 0
src/common/dpp.c

@@ -1547,6 +1547,16 @@ static struct wpabuf * dpp_auth_build_req(struct dpp_authentication *auth,
 		wpa_printf(MSG_INFO, "DPP: TESTING - no I-nonce");
 		goto skip_i_nonce;
 	}
+	if (dpp_test == DPP_TEST_INVALID_I_NONCE_AUTH_REQ) {
+		wpa_printf(MSG_INFO, "DPP: TESTING - invalid I-nonce");
+		WPA_PUT_LE16(pos, DPP_ATTR_I_NONCE);
+		pos += 2;
+		WPA_PUT_LE16(pos, nonce_len - 1);
+		pos += 2;
+		os_memcpy(pos, auth->i_nonce, nonce_len - 1);
+		pos += nonce_len - 1;
+		goto skip_i_nonce;
+	}
 #endif /* CONFIG_TESTING_OPTIONS */
 
 	/* I-nonce */

+ 1 - 0
src/common/dpp.h

@@ -310,6 +310,7 @@ enum dpp_test_behavior {
 	DPP_TEST_INVALID_STATUS_PEER_DISC_RESP = 78,
 	DPP_TEST_INVALID_CONNECTOR_PEER_DISC_RESP = 79,
 	DPP_TEST_INVALID_CONNECTOR_PEER_DISC_REQ = 80,
+	DPP_TEST_INVALID_I_NONCE_AUTH_REQ = 81,
 };
 
 extern enum dpp_test_behavior dpp_test;