DPP2: CSR generation in TCP Client/Enrollee

This was previously covered for the DPP over Public Action frames, but
the DPP over TCP case was missed.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-06-18 12:10:23 +03:00 committed by Jouni Malinen
parent 697fa0c4bd
commit 1f86b2c248

View File

@ -68,6 +68,7 @@ static void dpp_controller_rx(int sd, void *eloop_ctx, void *sock_ctx);
static void dpp_conn_tx_ready(int sock, void *eloop_ctx, void *sock_ctx);
static void dpp_controller_auth_success(struct dpp_connection *conn,
int initiator);
static void dpp_tcp_build_csr(void *eloop_ctx, void *timeout_ctx);
static void dpp_connection_free(struct dpp_connection *conn)
@ -81,6 +82,7 @@ static void dpp_connection_free(struct dpp_connection *conn)
}
eloop_cancel_timeout(dpp_controller_conn_status_result_wait_timeout,
conn, NULL);
eloop_cancel_timeout(dpp_tcp_build_csr, conn, NULL);
wpabuf_free(conn->msg);
wpabuf_free(conn->msg_out);
dpp_auth_deinit(conn->auth);
@ -1047,6 +1049,27 @@ static int dpp_controller_rx_gas_req(struct dpp_connection *conn, const u8 *msg,
}
static void dpp_tcp_build_csr(void *eloop_ctx, void *timeout_ctx)
{
struct dpp_connection *conn = eloop_ctx;
struct dpp_authentication *auth = conn->auth;
if (!auth || !auth->csrattrs)
return;
wpa_printf(MSG_DEBUG, "DPP: Build CSR");
wpabuf_free(auth->csr);
/* TODO: Additional information needed for CSR based on csrAttrs */
auth->csr = dpp_build_csr(auth);
if (!auth->csr) {
dpp_connection_remove(conn);
return;
}
dpp_controller_start_gas_client(conn);
}
static int dpp_tcp_rx_gas_resp(struct dpp_connection *conn, struct wpabuf *resp)
{
struct dpp_authentication *auth = conn->auth;
@ -1062,6 +1085,11 @@ static int dpp_tcp_rx_gas_resp(struct dpp_connection *conn, struct wpabuf *resp)
else
res = -1;
wpabuf_free(resp);
if (res == -2) {
wpa_printf(MSG_DEBUG, "DPP: CSR needed");
eloop_register_timeout(0, 0, dpp_tcp_build_csr, conn, NULL);
return 0;
}
if (res < 0) {
wpa_printf(MSG_DEBUG, "DPP: Configuration attempt failed");
return -1;