Browse Source

DPP: Protocol testing - invalid Bootstrap Key value in PKEX Commit-Reveal

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

+ 16 - 0
src/common/dpp.c

@@ -6064,6 +6064,14 @@ dpp_pkex_build_commit_reveal_req(struct dpp_pkex *pkex,
 		wpa_printf(MSG_INFO, "DPP: TESTING - no Bootstrap Key");
 		goto skip_bootstrap_key;
 	}
+	if (dpp_test == DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_REQ) {
+		wpa_printf(MSG_INFO, "DPP: TESTING - invalid Bootstrap Key");
+		wpabuf_put_le16(clear, DPP_ATTR_BOOTSTRAP_KEY);
+		wpabuf_put_le16(clear, 2 * curve->prime_len);
+		if (dpp_test_gen_invalid_key(clear, curve) < 0)
+			goto fail;
+		goto skip_bootstrap_key;
+	}
 #endif /* CONFIG_TESTING_OPTIONS */
 
 	/* A in Bootstrap Key attribute */
@@ -6357,6 +6365,14 @@ dpp_pkex_build_commit_reveal_resp(struct dpp_pkex *pkex,
 		wpa_printf(MSG_INFO, "DPP: TESTING - no Bootstrap Key");
 		goto skip_bootstrap_key;
 	}
+	if (dpp_test == DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_RESP) {
+		wpa_printf(MSG_INFO, "DPP: TESTING - invalid Bootstrap Key");
+		wpabuf_put_le16(clear, DPP_ATTR_BOOTSTRAP_KEY);
+		wpabuf_put_le16(clear, 2 * curve->prime_len);
+		if (dpp_test_gen_invalid_key(clear, curve) < 0)
+			goto fail;
+		goto skip_bootstrap_key;
+	}
 #endif /* CONFIG_TESTING_OPTIONS */
 
 	/* B in Bootstrap Key attribute */

+ 2 - 0
src/common/dpp.h

@@ -265,6 +265,8 @@ enum dpp_test_behavior {
 	DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 44,
 	DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 45,
 	DPP_TEST_INVALID_STATUS_PKEX_EXCHANGE_RESP = 46,
+	DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_REQ = 47,
+	DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_RESP = 48,
 };
 
 extern enum dpp_test_behavior dpp_test;