DPP: Make pkhash available in bootstrapping info

This can be helpful for testing DPP2 Controller functionality (get
pkhash from Controller to Relay).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-03-24 22:17:49 +02:00 committed by Jouni Malinen
parent 2ed2b52ff5
commit 9ffec2e854

View file

@ -8534,20 +8534,25 @@ int dpp_bootstrap_info(struct dpp_global *dpp, int id,
char *reply, int reply_size) char *reply, int reply_size)
{ {
struct dpp_bootstrap_info *bi; struct dpp_bootstrap_info *bi;
char pkhash[2 * SHA256_MAC_LEN + 1];
bi = dpp_bootstrap_get_id(dpp, id); bi = dpp_bootstrap_get_id(dpp, id);
if (!bi) if (!bi)
return -1; return -1;
wpa_snprintf_hex(pkhash, sizeof(pkhash), bi->pubkey_hash,
SHA256_MAC_LEN);
return os_snprintf(reply, reply_size, "type=%s\n" return os_snprintf(reply, reply_size, "type=%s\n"
"mac_addr=" MACSTR "\n" "mac_addr=" MACSTR "\n"
"info=%s\n" "info=%s\n"
"num_freq=%u\n" "num_freq=%u\n"
"curve=%s\n", "curve=%s\n"
"pkhash=%s\n",
dpp_bootstrap_type_txt(bi->type), dpp_bootstrap_type_txt(bi->type),
MAC2STR(bi->mac_addr), MAC2STR(bi->mac_addr),
bi->info ? bi->info : "", bi->info ? bi->info : "",
bi->num_freq, bi->num_freq,
bi->curve->name); bi->curve->name,
pkhash);
} }