WPS NFC: Remove NFC_RX_HANDOVER_SEL

The newer NFC_REPORT_HANDOVER command is more general version that
handles the cases where NFC_RX_HANDOVER_SEL could potentially have been
used. In addition, with the new WPS NFC design, it is important to
receive the handover request message that was used in the handover in
addition to the select message, so the NFC_RX_HANDOVER_SEL command on
its own would not be sufficient for this.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-04-06 16:42:27 +03:00
parent df58939cec
commit 679f2e7c5f
5 changed files with 3 additions and 76 deletions

View file

@ -381,17 +381,6 @@ UUID|BSSID argument is included, this is a request to build the handover
message for the specified AP when wpa_supplicant is operating as a WPS message for the specified AP when wpa_supplicant is operating as a WPS
ER. ER.
"nfc_rx_handover_req <hexdump of payload>" is used to indicate receipt
of NFC connection handover request. The payload may include multiple
carriers the the applicable ones are matched based on the media
type. The reply data is contents for the Handover Select Message
(hexdump).
"nfc_rx_handover_sel <hexdump of payload>" is used to indicate receipt
of NFC connection handover select. The payload may include multiple
carriers the the applicable ones are matched based on the media
type.
"nfc_report_handover <INIT/RESP> WPS <carrier from handover request> "nfc_report_handover <INIT/RESP> WPS <carrier from handover request>
<carrier from handover select>" can be used as an alternative way for <carrier from handover select>" can be used as an alternative way for
reporting completed NFC connection handover. The first parameter reporting completed NFC connection handover. The first parameter

View file

@ -1094,33 +1094,6 @@ static int wpas_ctrl_nfc_get_handover_sel(struct wpa_supplicant *wpa_s,
} }
static int wpas_ctrl_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
char *cmd)
{
size_t len;
struct wpabuf *buf;
int ret;
len = os_strlen(cmd);
if (len & 0x01)
return -1;
len /= 2;
buf = wpabuf_alloc(len);
if (buf == NULL)
return -1;
if (hexstr2bin(cmd, wpabuf_put(buf, len), len) < 0) {
wpabuf_free(buf);
return -1;
}
ret = wpas_wps_nfc_rx_handover_sel(wpa_s, buf);
wpabuf_free(buf);
return ret;
}
static int wpas_ctrl_nfc_report_handover(struct wpa_supplicant *wpa_s, static int wpas_ctrl_nfc_report_handover(struct wpa_supplicant *wpa_s,
char *cmd) char *cmd)
{ {
@ -6071,8 +6044,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
os_strlen(WPA_CTRL_RSP)) == 0 ? os_strlen(WPA_CTRL_RSP)) == 0 ?
WPA_CTRL_RSP : "SET_NETWORK"); WPA_CTRL_RSP : "SET_NETWORK");
} else if (os_strncmp(buf, "WPS_NFC_TAG_READ", 16) == 0 || } else if (os_strncmp(buf, "WPS_NFC_TAG_READ", 16) == 0 ||
os_strncmp(buf, "NFC_REPORT_HANDOVER", 19) == 0 || os_strncmp(buf, "NFC_REPORT_HANDOVER", 19) == 0) {
os_strncmp(buf, "NFC_RX_HANDOVER_SEL", 19) == 0) {
wpa_hexdump_ascii_key(MSG_DEBUG, "RX ctrl_iface", wpa_hexdump_ascii_key(MSG_DEBUG, "RX ctrl_iface",
(const u8 *) buf, os_strlen(buf)); (const u8 *) buf, os_strlen(buf));
} else { } else {
@ -6210,9 +6182,6 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} else if (os_strncmp(buf, "NFC_GET_HANDOVER_SEL ", 21) == 0) { } else if (os_strncmp(buf, "NFC_GET_HANDOVER_SEL ", 21) == 0) {
reply_len = wpas_ctrl_nfc_get_handover_sel( reply_len = wpas_ctrl_nfc_get_handover_sel(
wpa_s, buf + 21, reply, reply_size); wpa_s, buf + 21, reply, reply_size);
} else if (os_strncmp(buf, "NFC_RX_HANDOVER_SEL ", 20) == 0) {
if (wpas_ctrl_nfc_rx_handover_sel(wpa_s, buf + 20))
reply_len = -1;
} else if (os_strncmp(buf, "NFC_REPORT_HANDOVER ", 20) == 0) { } else if (os_strncmp(buf, "NFC_REPORT_HANDOVER ", 20) == 0) {
if (wpas_ctrl_nfc_report_handover(wpa_s, buf + 20)) if (wpas_ctrl_nfc_report_handover(wpa_s, buf + 20))
reply_len = -1; reply_len = -1;

View file

@ -842,32 +842,6 @@ static int wpa_cli_cmd_nfc_get_handover_sel(struct wpa_ctrl *ctrl, int argc,
} }
static int wpa_cli_cmd_nfc_rx_handover_sel(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
int ret;
char *buf;
size_t buflen;
if (argc != 1) {
printf("Invalid 'nfc_rx_handover_sel' command - one argument "
"is required.\n");
return -1;
}
buflen = 21 + os_strlen(argv[0]);
buf = os_malloc(buflen);
if (buf == NULL)
return -1;
os_snprintf(buf, buflen, "NFC_RX_HANDOVER_SEL %s", argv[0]);
ret = wpa_ctrl_command(ctrl, buf);
os_free(buf);
return ret;
}
static int wpa_cli_cmd_nfc_report_handover(struct wpa_ctrl *ctrl, int argc, static int wpa_cli_cmd_nfc_report_handover(struct wpa_ctrl *ctrl, int argc,
char *argv[]) char *argv[])
{ {
@ -2704,9 +2678,6 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "nfc_get_handover_sel", wpa_cli_cmd_nfc_get_handover_sel, NULL, { "nfc_get_handover_sel", wpa_cli_cmd_nfc_get_handover_sel, NULL,
cli_cmd_flag_none, cli_cmd_flag_none,
"<NDEF> <WPS> = create NFC handover select" }, "<NDEF> <WPS> = create NFC handover select" },
{ "nfc_rx_handover_sel", wpa_cli_cmd_nfc_rx_handover_sel, NULL,
cli_cmd_flag_none,
"<hexdump of payload> = report received NFC handover select" },
{ "nfc_report_handover", wpa_cli_cmd_nfc_report_handover, NULL, { "nfc_report_handover", wpa_cli_cmd_nfc_report_handover, NULL,
cli_cmd_flag_none, cli_cmd_flag_none,
"<role> <type> <hexdump of req> <hexdump of sel> = report completed " "<role> <type> <hexdump of req> <hexdump of sel> = report completed "

View file

@ -2362,7 +2362,7 @@ struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
} }
int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s, static int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
const struct wpabuf *data) const struct wpabuf *data)
{ {
struct wpabuf *wps; struct wpabuf *wps;

View file

@ -75,8 +75,6 @@ struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s,
int ndef); int ndef);
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s, struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
int ndef, int cr, const char *uuid); int ndef, int cr, const char *uuid);
int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
const struct wpabuf *data);
int wpas_wps_nfc_report_handover(struct wpa_supplicant *wpa_s, int wpas_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
const struct wpabuf *req, const struct wpabuf *req,
const struct wpabuf *sel); const struct wpabuf *sel);