From 89d0bf67834e3c5776818e985c9346fbe76517ba Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 3 Nov 2017 19:54:48 +0200 Subject: [PATCH] DPP: Protocol testing - invalid Bootstrap Key value in PKEX Commit-Reveal Signed-off-by: Jouni Malinen --- src/common/dpp.c | 16 ++++++++++++++++ src/common/dpp.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/common/dpp.c b/src/common/dpp.c index 40738fdae..69b40c97b 100644 --- a/src/common/dpp.c +++ b/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 */ diff --git a/src/common/dpp.h b/src/common/dpp.h index 1526f999f..38c951450 100644 --- a/src/common/dpp.h +++ b/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;