DPP: Support retrieving of configurator's private key
To retain configurator information across hostapd/wpa_supplicant restart, private key need to be maintained to generate a valid pair of authentication keys (connector, netaccess_key, csign) for new enrollees in the network. Add a DPP_CONFIGURATOR_GET_KEY control interface API through which the private key of an existing configurator can be fetched. Command format: DPP_CONFIGURATOR_GET_KEY <configurator_id> The output from this command can then be used with "DPP_CONFIGURATOR_ADD key=<hexdump>" to create the same key again. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
4bc801ab42
commit
8179ae3a2a
10 changed files with 83 additions and 0 deletions
|
@ -10576,6 +10576,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
|||
} else if (os_strncmp(buf, "DPP_CONFIGURATOR_SIGN ", 22) == 0) {
|
||||
if (wpas_dpp_configurator_sign(wpa_s, buf + 22) < 0)
|
||||
reply_len = -1;
|
||||
} else if (os_strncmp(buf, "DPP_CONFIGURATOR_GET_KEY ", 25) == 0) {
|
||||
reply_len = wpas_dpp_configurator_get_key(wpa_s, atoi(buf + 25),
|
||||
reply, reply_size);
|
||||
} else if (os_strncmp(buf, "DPP_PKEX_ADD ", 13) == 0) {
|
||||
int res;
|
||||
|
||||
|
|
|
@ -2275,6 +2275,19 @@ int wpas_dpp_configurator_sign(struct wpa_supplicant *wpa_s, const char *cmd)
|
|||
}
|
||||
|
||||
|
||||
int wpas_dpp_configurator_get_key(struct wpa_supplicant *wpa_s, unsigned int id,
|
||||
char *buf, size_t buflen)
|
||||
{
|
||||
struct dpp_configurator *conf;
|
||||
|
||||
conf = dpp_configurator_get_id(wpa_s, id);
|
||||
if (!conf)
|
||||
return -1;
|
||||
|
||||
return dpp_configurator_get_key(conf, buf, buflen);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
wpas_dpp_tx_introduction_status(struct wpa_supplicant *wpa_s,
|
||||
unsigned int freq, const u8 *dst,
|
||||
|
|
|
@ -28,6 +28,8 @@ void wpas_dpp_rx_action(struct wpa_supplicant *wpa_s, const u8 *src,
|
|||
int wpas_dpp_configurator_add(struct wpa_supplicant *wpa_s, const char *cmd);
|
||||
int wpas_dpp_configurator_remove(struct wpa_supplicant *wpa_s, const char *id);
|
||||
int wpas_dpp_configurator_sign(struct wpa_supplicant *wpa_s, const char *cmd);
|
||||
int wpas_dpp_configurator_get_key(struct wpa_supplicant *wpa_s, unsigned int id,
|
||||
char *buf, size_t buflen);
|
||||
int wpas_dpp_pkex_add(struct wpa_supplicant *wpa_s, const char *cmd);
|
||||
int wpas_dpp_pkex_remove(struct wpa_supplicant *wpa_s, const char *id);
|
||||
void wpas_dpp_stop(struct wpa_supplicant *wpa_s);
|
||||
|
|
|
@ -2948,6 +2948,13 @@ static int wpa_cli_cmd_dpp_configurator_remove(struct wpa_ctrl *ctrl, int argc,
|
|||
}
|
||||
|
||||
|
||||
static int wpa_cli_cmd_dpp_configurator_get_key(struct wpa_ctrl *ctrl, int argc,
|
||||
char *argv[])
|
||||
{
|
||||
return wpa_cli_cmd(ctrl, "DPP_CONFIGURATOR_GET_KEY", 1, argc, argv);
|
||||
}
|
||||
|
||||
|
||||
static int wpa_cli_cmd_dpp_pkex_add(struct wpa_ctrl *ctrl, int argc,
|
||||
char *argv[])
|
||||
{
|
||||
|
@ -3604,6 +3611,9 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = {
|
|||
{ "dpp_configurator_remove", wpa_cli_cmd_dpp_configurator_remove, NULL,
|
||||
cli_cmd_flag_none,
|
||||
"*|<id> = remove DPP configurator" },
|
||||
{ "dpp_configurator_get_key", wpa_cli_cmd_dpp_configurator_get_key,
|
||||
NULL, cli_cmd_flag_none,
|
||||
"<id> = Get DPP configurator's private key" },
|
||||
{ "dpp_pkex_add", wpa_cli_cmd_dpp_pkex_add, NULL,
|
||||
cli_cmd_flag_sensitive,
|
||||
"add PKEX code" },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue