]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Allow per-peer configurator parameters to be set
authorJouni Malinen <jouni@codeaurora.org>
Fri, 27 Mar 2020 15:14:06 +0000 (17:14 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 27 Mar 2020 15:44:06 +0000 (17:44 +0200)
This is a more convenient way of addressing cases where a
Configurator/Controller may store a large number of peer bootstrapping
information instances and may need to manage different configuration
parameters for each peer while operating as the Responder.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp.c
src/common/dpp.h

index 57afbd5785f63086168cc00a2e79bfc61e97bb33..7f0f0b6ea2e91887c357087e244e772c8c84b63e 100644 (file)
@@ -894,6 +894,7 @@ void dpp_bootstrap_info_free(struct dpp_bootstrap_info *info)
        os_free(info->chan);
        os_free(info->pk);
        EVP_PKEY_free(info->pubkey);
+       str_clear_free(info->configurator_params);
        os_free(info);
 }
 
@@ -2370,6 +2371,9 @@ struct dpp_authentication * dpp_auth_init(struct dpp_global *dpp, void *msg_ctx,
        auth = dpp_alloc_auth(dpp, msg_ctx);
        if (!auth)
                return NULL;
+       if (peer_bi->configurator_params &&
+           dpp_set_configurator(auth, peer_bi->configurator_params) < 0)
+               goto fail;
        auth->initiator = 1;
        auth->waiting_auth_resp = 1;
        auth->allowed_roles = dpp_allowed_roles;
@@ -3306,6 +3310,9 @@ dpp_auth_req_rx(struct dpp_global *dpp, void *msg_ctx, u8 dpp_allowed_roles,
        auth = dpp_alloc_auth(dpp, msg_ctx);
        if (!auth)
                goto fail;
+       if (peer_bi && peer_bi->configurator_params &&
+           dpp_set_configurator(auth, peer_bi->configurator_params) < 0)
+               goto fail;
        auth->peer_bi = peer_bi;
        auth->own_bi = own_bi;
        auth->curve = own_bi->curve;
@@ -4683,8 +4690,10 @@ int dpp_set_configurator(struct dpp_authentication *auth, const char *cmd)
        char *tmp = NULL;
        int ret = -1;
 
-       if (!cmd)
+       if (!cmd || auth->configurator_set)
                return 0;
+       auth->configurator_set = 1;
+
        if (cmd[0] != ' ') {
                size_t len;
 
index d6da0460bd0938ae0b6bb7f02b1bb36439639a6f..0ec0024cd86f61d10088ca7958d7405184f7e4c8 100644 (file)
@@ -126,6 +126,7 @@ struct dpp_bootstrap_info {
        const struct dpp_curve_params *curve;
        unsigned int pkex_t; /* number of failures before dpp_pkex
                              * instantiation */
+       char *configurator_params;
 };
 
 #define PKEX_COUNTER_T_LIMIT 5
@@ -275,6 +276,7 @@ struct dpp_authentication {
        int send_conn_status;
        int conn_status_requested;
        int akm_use_selector;
+       int configurator_set;
 #ifdef CONFIG_TESTING_OPTIONS
        char *config_obj_override;
        char *discovery_override;