DPP2: Support RA/CA functionality in Controller initiated case

Extend dpp_control_get_auth() to find the ongoing session for enterprise
credential provisioning in cases where the Controller/Configurator
initiated the exchange. Only the other direction was supported
previously.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-08-10 10:41:20 +03:00 committed by Jouni Malinen
parent b58cd7aa1c
commit 5caf4e094a

View File

@ -1678,6 +1678,29 @@ void dpp_controller_stop(struct dpp_global *dpp)
}
static bool dpp_tcp_peer_id_match(struct dpp_authentication *auth,
unsigned int id)
{
return auth &&
((auth->peer_bi && auth->peer_bi->id == id) ||
(auth->tmp_peer_bi && auth->tmp_peer_bi->id == id));
}
static struct dpp_authentication * dpp_tcp_get_auth(struct dpp_global *dpp,
unsigned int id)
{
struct dpp_connection *conn;
dl_list_for_each(conn, &dpp->tcp_init, struct dpp_connection, list) {
if (dpp_tcp_peer_id_match(conn->auth, id))
return conn->auth;
}
return NULL;
}
struct dpp_authentication * dpp_controller_get_auth(struct dpp_global *dpp,
unsigned int id)
{
@ -1685,18 +1708,14 @@ struct dpp_authentication * dpp_controller_get_auth(struct dpp_global *dpp,
struct dpp_connection *conn;
if (!ctrl)
return NULL;
return dpp_tcp_get_auth(dpp, id);
dl_list_for_each(conn, &ctrl->conn, struct dpp_connection, list) {
struct dpp_authentication *auth = conn->auth;
if (auth &&
((auth->peer_bi && auth->peer_bi->id == id) ||
(auth->tmp_peer_bi && auth->tmp_peer_bi->id == id)))
return auth;
if (dpp_tcp_peer_id_match(conn->auth, id))
return conn->auth;
}
return NULL;
return dpp_tcp_get_auth(dpp, id);
}