DPP: Add configuration structure to dpp_global_init()

This can be used to provide configurable parameter to the global DPP
context. This initial commit introduces the msg_ctx context pointer for
wpa_msg().

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-04-21 21:18:24 +03:00 committed by Jouni Malinen
parent 516ccede8f
commit 2ed2b52ff5
4 changed files with 20 additions and 4 deletions

View file

@ -653,6 +653,9 @@ int main(int argc, char *argv[])
int start_ifaces_in_sync = 0;
char **if_names = NULL;
size_t if_names_size = 0;
#ifdef CONFIG_DPP
struct dpp_global_config dpp_conf;
#endif /* CONFIG_DPP */
if (os_program_init())
return -1;
@ -672,7 +675,9 @@ int main(int argc, char *argv[])
dl_list_init(&interfaces.eth_p_oui);
#endif /* CONFIG_ETH_P_OUI */
#ifdef CONFIG_DPP
interfaces.dpp = dpp_global_init();
os_memset(&dpp_conf, 0, sizeof(dpp_conf));
/* TODO: dpp_conf.msg_ctx? */
interfaces.dpp = dpp_global_init(&dpp_conf);
if (!interfaces.dpp)
return -1;
#endif /* CONFIG_DPP */

View file

@ -71,6 +71,7 @@ static void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr,
struct dpp_global {
void *msg_ctx;
struct dl_list bootstrap; /* struct dpp_bootstrap_info */
struct dl_list configurator; /* struct dpp_configurator */
};
@ -8689,13 +8690,14 @@ int dpp_configurator_get_key_id(struct dpp_global *dpp, unsigned int id,
}
struct dpp_global * dpp_global_init(void)
struct dpp_global * dpp_global_init(struct dpp_global_config *config)
{
struct dpp_global *dpp;
dpp = os_zalloc(sizeof(*dpp));
if (!dpp)
return NULL;
dpp->msg_ctx = config->msg_ctx;
dl_list_init(&dpp->bootstrap);
dl_list_init(&dpp->configurator);

View file

@ -497,7 +497,12 @@ int dpp_configurator_add(struct dpp_global *dpp, const char *cmd);
int dpp_configurator_remove(struct dpp_global *dpp, const char *id);
int dpp_configurator_get_key_id(struct dpp_global *dpp, unsigned int id,
char *buf, size_t buflen);
struct dpp_global * dpp_global_init(void);
struct dpp_global_config {
void *msg_ctx;
};
struct dpp_global * dpp_global_init(struct dpp_global_config *config);
void dpp_global_clear(struct dpp_global *dpp);
void dpp_global_deinit(struct dpp_global *dpp);

View file

@ -2196,6 +2196,7 @@ void wpas_dpp_stop(struct wpa_supplicant *wpa_s)
int wpas_dpp_init(struct wpa_supplicant *wpa_s)
{
struct dpp_global_config config;
u8 adv_proto_id[7];
adv_proto_id[0] = WLAN_EID_VENDOR_SPECIFIC;
@ -2208,7 +2209,10 @@ int wpas_dpp_init(struct wpa_supplicant *wpa_s)
sizeof(adv_proto_id), wpas_dpp_gas_req_handler,
wpas_dpp_gas_status_handler, wpa_s) < 0)
return -1;
wpa_s->dpp = dpp_global_init();
os_memset(&config, 0, sizeof(config));
config.msg_ctx = wpa_s;
wpa_s->dpp = dpp_global_init(&config);
return wpa_s->dpp ? 0 : -1;
}