Skip to content

Commit

Permalink
P2P2: Allow P2P PMK to be fetched
Browse files Browse the repository at this point in the history
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
  • Loading branch information
Shivani Baranwal authored and Jouni Malinen committed Dec 20, 2024
1 parent 97938e5 commit 961b7fc
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -9684,6 +9684,26 @@ static enum sigma_cmd_result sta_get_pmk(struct sigma_dut *dut,
}


static enum sigma_cmd_result sta_get_p2p_pmk(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
const char *intf = get_param(cmd, "Interface");
char buf[200], resp[256];

if (wpa_command_resp(intf, "P2P_PMK_GET", buf, sizeof(buf)) < 0 ||
strncmp(buf, "UNKNOWN COMMAND", 15) == 0) {
send_resp(dut, conn, SIGMA_ERROR,
"ErrorCode,P2P_PMK_GET not supported");
return STATUS_SENT_ERROR;
}

snprintf(resp, sizeof(resp), "PMK,%s", buf);
send_resp(dut, conn, SIGMA_COMPLETE, resp);
return STATUS_SENT;
}


static enum sigma_cmd_result cmd_sta_get_parameter(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
Expand All @@ -9697,8 +9717,11 @@ static enum sigma_cmd_result cmd_sta_get_parameter(struct sigma_dut *dut,
if (strcasecmp(parameter, "PASNPTK") == 0)
return sta_get_pasn_ptk(dut, conn, cmd);

if (strcasecmp(parameter, "PMK") == 0)
if (strcasecmp(parameter, "PMK") == 0) {
if (dut->program == PROGRAM_P2P)
return sta_get_p2p_pmk(dut, conn, cmd);
return sta_get_pmk(dut, conn, cmd);
}

if (!program)
return INVALID_SEND_STATUS;
Expand Down

0 comments on commit 961b7fc

Please sign in to comment.