DPP: Allow PKEX x/X and y/Y keypairs to be overridden
This is for testing purposes to allow a test vector with specific values to be generated. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
d722c50d0a
commit
acc555f9e6
3 changed files with 44 additions and 0 deletions
|
@ -32,6 +32,8 @@
|
||||||
enum dpp_test_behavior dpp_test = DPP_TEST_DISABLED;
|
enum dpp_test_behavior dpp_test = DPP_TEST_DISABLED;
|
||||||
u8 dpp_pkex_own_mac_override[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
u8 dpp_pkex_own_mac_override[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
||||||
u8 dpp_pkex_peer_mac_override[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
u8 dpp_pkex_peer_mac_override[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
||||||
|
u8 dpp_pkex_ephemeral_key_override[600];
|
||||||
|
size_t dpp_pkex_ephemeral_key_override_len = 0;
|
||||||
|
|
||||||
static int dpp_test_gen_invalid_key(struct wpabuf *msg,
|
static int dpp_test_gen_invalid_key(struct wpabuf *msg,
|
||||||
const struct dpp_curve_params *curve);
|
const struct dpp_curve_params *curve);
|
||||||
|
@ -6104,7 +6106,21 @@ static struct wpabuf * dpp_pkex_build_exchange_req(struct dpp_pkex *pkex)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Generate a random ephemeral keypair x/X */
|
/* Generate a random ephemeral keypair x/X */
|
||||||
|
#ifdef CONFIG_TESTING_OPTIONS
|
||||||
|
if (dpp_pkex_ephemeral_key_override_len) {
|
||||||
|
const struct dpp_curve_params *tmp_curve;
|
||||||
|
|
||||||
|
wpa_printf(MSG_INFO,
|
||||||
|
"DPP: TESTING - override ephemeral key x/X");
|
||||||
|
pkex->x = dpp_set_keypair(&tmp_curve,
|
||||||
|
dpp_pkex_ephemeral_key_override,
|
||||||
|
dpp_pkex_ephemeral_key_override_len);
|
||||||
|
} else {
|
||||||
|
pkex->x = dpp_gen_keypair(curve);
|
||||||
|
}
|
||||||
|
#else /* CONFIG_TESTING_OPTIONS */
|
||||||
pkex->x = dpp_gen_keypair(curve);
|
pkex->x = dpp_gen_keypair(curve);
|
||||||
|
#endif /* CONFIG_TESTING_OPTIONS */
|
||||||
if (!pkex->x)
|
if (!pkex->x)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -6552,7 +6568,21 @@ struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx,
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Generate a random ephemeral keypair y/Y */
|
/* Generate a random ephemeral keypair y/Y */
|
||||||
|
#ifdef CONFIG_TESTING_OPTIONS
|
||||||
|
if (dpp_pkex_ephemeral_key_override_len) {
|
||||||
|
const struct dpp_curve_params *tmp_curve;
|
||||||
|
|
||||||
|
wpa_printf(MSG_INFO,
|
||||||
|
"DPP: TESTING - override ephemeral key y/Y");
|
||||||
|
pkex->y = dpp_set_keypair(&tmp_curve,
|
||||||
|
dpp_pkex_ephemeral_key_override,
|
||||||
|
dpp_pkex_ephemeral_key_override_len);
|
||||||
|
} else {
|
||||||
|
pkex->y = dpp_gen_keypair(curve);
|
||||||
|
}
|
||||||
|
#else /* CONFIG_TESTING_OPTIONS */
|
||||||
pkex->y = dpp_gen_keypair(curve);
|
pkex->y = dpp_gen_keypair(curve);
|
||||||
|
#endif /* CONFIG_TESTING_OPTIONS */
|
||||||
if (!pkex->y)
|
if (!pkex->y)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
|
@ -326,6 +326,8 @@ enum dpp_test_behavior {
|
||||||
extern enum dpp_test_behavior dpp_test;
|
extern enum dpp_test_behavior dpp_test;
|
||||||
extern u8 dpp_pkex_own_mac_override[ETH_ALEN];
|
extern u8 dpp_pkex_own_mac_override[ETH_ALEN];
|
||||||
extern u8 dpp_pkex_peer_mac_override[ETH_ALEN];
|
extern u8 dpp_pkex_peer_mac_override[ETH_ALEN];
|
||||||
|
extern u8 dpp_pkex_ephemeral_key_override[600];
|
||||||
|
extern size_t dpp_pkex_ephemeral_key_override_len;
|
||||||
#endif /* CONFIG_TESTING_OPTIONS */
|
#endif /* CONFIG_TESTING_OPTIONS */
|
||||||
|
|
||||||
void dpp_bootstrap_info_free(struct dpp_bootstrap_info *info);
|
void dpp_bootstrap_info_free(struct dpp_bootstrap_info *info);
|
||||||
|
|
|
@ -621,6 +621,17 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
|
||||||
} else if (os_strcasecmp(cmd, "dpp_pkex_peer_mac_override") == 0) {
|
} else if (os_strcasecmp(cmd, "dpp_pkex_peer_mac_override") == 0) {
|
||||||
if (hwaddr_aton(value, dpp_pkex_peer_mac_override))
|
if (hwaddr_aton(value, dpp_pkex_peer_mac_override))
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
} else if (os_strcasecmp(cmd, "dpp_pkex_ephemeral_key_override") == 0) {
|
||||||
|
size_t hex_len = os_strlen(value);
|
||||||
|
|
||||||
|
if (hex_len >
|
||||||
|
2 * sizeof(dpp_pkex_ephemeral_key_override))
|
||||||
|
ret = -1;
|
||||||
|
else if (hexstr2bin(value, dpp_pkex_ephemeral_key_override,
|
||||||
|
hex_len / 2))
|
||||||
|
ret = -1;
|
||||||
|
else
|
||||||
|
dpp_pkex_ephemeral_key_override_len = hex_len / 2;
|
||||||
#endif /* CONFIG_DPP */
|
#endif /* CONFIG_DPP */
|
||||||
#ifdef CONFIG_TESTING_OPTIONS
|
#ifdef CONFIG_TESTING_OPTIONS
|
||||||
} else if (os_strcasecmp(cmd, "ext_mgmt_frame_handling") == 0) {
|
} else if (os_strcasecmp(cmd, "ext_mgmt_frame_handling") == 0) {
|
||||||
|
@ -7769,6 +7780,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
|
||||||
wpa_s->dpp_resp_retry_time = 0;
|
wpa_s->dpp_resp_retry_time = 0;
|
||||||
os_memset(dpp_pkex_own_mac_override, 0, ETH_ALEN);
|
os_memset(dpp_pkex_own_mac_override, 0, ETH_ALEN);
|
||||||
os_memset(dpp_pkex_peer_mac_override, 0, ETH_ALEN);
|
os_memset(dpp_pkex_peer_mac_override, 0, ETH_ALEN);
|
||||||
|
dpp_pkex_ephemeral_key_override_len = 0;
|
||||||
#endif /* CONFIG_DPP */
|
#endif /* CONFIG_DPP */
|
||||||
|
|
||||||
#ifdef CONFIG_TDLS
|
#ifdef CONFIG_TDLS
|
||||||
|
|
Loading…
Reference in a new issue