From 07fecd3915cdac99eab751606cee85a6729e578a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 8 Sep 2011 16:40:03 +0300 Subject: [PATCH] P2P: Remove Label config method The P2P specification (3.1.4.3) disallows use of the Label configuration method between two P2P devices. This was previously enforced at upper level, but the obsolete code can be removed from wpa_supplicant. This adds a bit more strict enforcement of the policy, but should not result in practical differences since no known P2P implementation uses Label config method. --- src/p2p/p2p.c | 2 -- src/p2p/p2p.h | 2 +- src/p2p/p2p_build.c | 2 -- src/p2p/p2p_go_neg.c | 34 ++------------------- wpa_supplicant/ctrl_iface.c | 4 +-- wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 5 +-- wpa_supplicant/p2p_supplicant.c | 1 - 7 files changed, 5 insertions(+), 45 deletions(-) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 9cfee506c..cd71a244c 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -2936,8 +2936,6 @@ static const char * p2p_wps_method_text(enum p2p_wps_method method) switch (method) { case WPS_NOT_READY: return "not-ready"; - case WPS_PIN_LABEL: - return "Label"; case WPS_PIN_DISPLAY: return "Display"; case WPS_PIN_KEYPAD: diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index f56cc9767..d01f57454 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -56,7 +56,7 @@ struct p2p_channels { }; enum p2p_wps_method { - WPS_NOT_READY, WPS_PIN_LABEL, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC + WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC }; /** diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c index c34db9152..5aba1e11d 100644 --- a/src/p2p/p2p_build.c +++ b/src/p2p/p2p_build.c @@ -171,8 +171,6 @@ void p2p_buf_add_device_info(struct wpabuf *buf, struct p2p_data *p2p, if (peer && peer->wps_method != WPS_NOT_READY) { if (peer->wps_method == WPS_PBC) methods |= WPS_CONFIG_PUSHBUTTON; - else if (peer->wps_method == WPS_PIN_LABEL) - methods |= WPS_CONFIG_LABEL; else if (peer->wps_method == WPS_PIN_DISPLAY || peer->wps_method == WPS_PIN_KEYPAD) methods |= WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD; diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c index 1c96486a4..be04fadf8 100644 --- a/src/p2p/p2p_go_neg.c +++ b/src/p2p/p2p_go_neg.c @@ -107,8 +107,6 @@ static int p2p_peer_channels(struct p2p_data *p2p, struct p2p_device *dev, static u16 p2p_wps_method_pw_id(enum p2p_wps_method wps_method) { switch (wps_method) { - case WPS_PIN_LABEL: - return DEV_PW_DEFAULT; case WPS_PIN_DISPLAY: return DEV_PW_REGISTRAR_SPECIFIED; case WPS_PIN_KEYPAD: @@ -124,8 +122,6 @@ static u16 p2p_wps_method_pw_id(enum p2p_wps_method wps_method) static const char * p2p_wps_method_str(enum p2p_wps_method wps_method) { switch (wps_method) { - case WPS_PIN_LABEL: - return "Label"; case WPS_PIN_DISPLAY: return "Display"; case WPS_PIN_KEYPAD: @@ -516,18 +512,6 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa, } switch (msg.dev_password_id) { - case DEV_PW_DEFAULT: - wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, - "P2P: PIN from peer Label"); - if (dev->wps_method != WPS_PIN_KEYPAD) { - wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, - "P2P: We have wps_method=%s -> " - "incompatible", - p2p_wps_method_str(dev->wps_method)); - status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD; - goto fail; - } - break; case DEV_PW_REGISTRAR_SPECIFIED: wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: PIN from peer Display"); @@ -543,8 +527,7 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa, case DEV_PW_USER_SPECIFIED: wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer entered PIN on Keypad"); - if (dev->wps_method != WPS_PIN_LABEL && - dev->wps_method != WPS_PIN_DISPLAY) { + if (dev->wps_method != WPS_PIN_DISPLAY) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: We have wps_method=%s -> " "incompatible", @@ -899,18 +882,6 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa, dev->oper_freq = 0; switch (msg.dev_password_id) { - case DEV_PW_DEFAULT: - wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, - "P2P: PIN from peer Label"); - if (dev->wps_method != WPS_PIN_KEYPAD) { - wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, - "P2P: We have wps_method=%s -> " - "incompatible", - p2p_wps_method_str(dev->wps_method)); - status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD; - goto fail; - } - break; case DEV_PW_REGISTRAR_SPECIFIED: wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: PIN from peer Display"); @@ -926,8 +897,7 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa, case DEV_PW_USER_SPECIFIED: wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer entered PIN on Keypad"); - if (dev->wps_method != WPS_PIN_LABEL && - dev->wps_method != WPS_PIN_DISPLAY) { + if (dev->wps_method != WPS_PIN_DISPLAY) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: We have wps_method=%s -> " "incompatible", diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 8b3b4fdb5..a55a52826 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2187,9 +2187,7 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd, wps_method = WPS_PIN_KEYPAD; if (pos) { *pos++ = '\0'; - if (os_strncmp(pos, "label", 5) == 0) - wps_method = WPS_PIN_LABEL; - else if (os_strncmp(pos, "display", 7) == 0) + if (os_strncmp(pos, "display", 7) == 0) wps_method = WPS_PIN_DISPLAY; } } diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index 6583ed95a..06e653e87 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -470,8 +470,6 @@ DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message, wps_method = WPS_PBC; else if (!os_strcmp(entry.str_value, "pin")) wps_method = WPS_PIN_DISPLAY; - else if (!os_strcmp(entry.str_value, "label")) - wps_method = WPS_PIN_LABEL; else if (!os_strcmp(entry.str_value, "display")) wps_method = WPS_PIN_DISPLAY; else if (!os_strcmp(entry.str_value, "keypad")) @@ -495,8 +493,7 @@ DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message, /* * Validate the wps_method specified and the pin value. */ - if ((!pin || !pin[0]) && - ((wps_method == WPS_PIN_LABEL) || (wps_method == WPS_PIN_KEYPAD))) + if ((!pin || !pin[0]) && (wps_method == WPS_PIN_KEYPAD)) goto inv_args; new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method, diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 400b6cc25..fba8e1e2f 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -2713,7 +2713,6 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s, wpa_s->pending_pd_before_join = 1; switch (wpa_s->pending_join_wps_method) { - case WPS_PIN_LABEL: case WPS_PIN_DISPLAY: method = WPS_CONFIG_KEYPAD; break;