WPS 2.0: Add virtual/physical display and pushbutton config methods

This commit is contained in:
Jouni Malinen 2009-12-23 01:21:12 +02:00 committed by Jouni Malinen
parent 662bd57522
commit 6a857074f4
7 changed files with 81 additions and 16 deletions

View file

@ -913,8 +913,9 @@ own_ip_addr=127.0.0.1
# Config Methods # Config Methods
# List of the supported configuration methods # List of the supported configuration methods
# Available methods: usba ethernet label display ext_nfc_token int_nfc_token # Available methods: usba ethernet label display ext_nfc_token int_nfc_token
# nfc_interface push_button keypad # nfc_interface push_button keypad virtual_display physical_display
#config_methods=label display push_button keypad # virtual_push_button physical_push_button
#config_methods=label virtual_display virtual_push_button keypad
# Static access point PIN for initial configuration and adding Registrars # Static access point PIN for initial configuration and adding Registrars
# If not set, hostapd will not allow external WPS Registrars to control the # If not set, hostapd will not allow external WPS Registrars to control the

View file

@ -426,10 +426,22 @@ struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
len = wpabuf_put(ie, 1); len = wpabuf_put(ie, 1);
wpabuf_put_be32(ie, WPS_DEV_OUI_WFA); wpabuf_put_be32(ie, WPS_DEV_OUI_WFA);
if (pbc) if (pbc) {
methods = WPS_CONFIG_PUSHBUTTON; methods = WPS_CONFIG_PUSHBUTTON;
else { /*
* TODO: At least in theory, should figure out whether this
* Probe Request was triggered with physical or virtual
* pushbutton.
*/
methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
} else {
/*
* TODO: At least in theory, should figure out whether this
* Probe Request was triggered using physical or virtual
* display.
*/
methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY |
WPS_CONFIG_VIRT_DISPLAY |
WPS_CONFIG_KEYPAD; WPS_CONFIG_KEYPAD;
#ifdef CONFIG_WPS_UFD #ifdef CONFIG_WPS_UFD
methods |= WPS_CONFIG_USBA; methods |= WPS_CONFIG_USBA;

View file

@ -609,6 +609,7 @@ u16 wps_config_methods_str2bin(const char *str)
if (str == NULL) { if (str == NULL) {
/* Default to enabling methods based on build configuration */ /* Default to enabling methods based on build configuration */
methods |= WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD; methods |= WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD;
methods |= WPS_CONFIG_VIRT_DISPLAY;
#ifdef CONFIG_WPS_UFD #ifdef CONFIG_WPS_UFD
methods |= WPS_CONFIG_USBA; methods |= WPS_CONFIG_USBA;
#endif /* CONFIG_WPS_UFD */ #endif /* CONFIG_WPS_UFD */
@ -634,6 +635,14 @@ u16 wps_config_methods_str2bin(const char *str)
methods |= WPS_CONFIG_PUSHBUTTON; methods |= WPS_CONFIG_PUSHBUTTON;
if (os_strstr(str, "keypad")) if (os_strstr(str, "keypad"))
methods |= WPS_CONFIG_KEYPAD; methods |= WPS_CONFIG_KEYPAD;
if (os_strstr(str, "virtual_display"))
methods |= WPS_CONFIG_VIRT_DISPLAY;
if (os_strstr(str, "physical_display"))
methods |= WPS_CONFIG_PHY_DISPLAY;
if (os_strstr(str, "virtual_push_button"))
methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
if (os_strstr(str, "physical_push_button"))
methods |= WPS_CONFIG_PHY_PUSHBUTTON;
} }
return methods; return methods;

View file

@ -217,6 +217,10 @@ enum wps_config_error {
#define WPS_CONFIG_NFC_INTERFACE 0x0040 #define WPS_CONFIG_NFC_INTERFACE 0x0040
#define WPS_CONFIG_PUSHBUTTON 0x0080 #define WPS_CONFIG_PUSHBUTTON 0x0080
#define WPS_CONFIG_KEYPAD 0x0100 #define WPS_CONFIG_KEYPAD 0x0100
#define WPS_CONFIG_VIRT_PUSHBUTTON 0x0280
#define WPS_CONFIG_PHY_PUSHBUTTON 0x0480
#define WPS_CONFIG_VIRT_DISPLAY 0x2008
#define WPS_CONFIG_PHY_DISPLAY 0x4008
/* Connection Type Flags */ /* Connection Type Flags */
#define WPS_CONN_ESS 0x01 #define WPS_CONN_ESS 0x01

View file

@ -420,9 +420,16 @@ static int wps_build_sel_reg_config_methods(struct wps_registrar *reg,
u16 methods; u16 methods;
if (!reg->sel_reg_union) if (!reg->sel_reg_union)
return 0; return 0;
methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; methods = reg->wps->config_methods &
if (reg->pbc) ~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
WPS_CONFIG_PHY_PUSHBUTTON);
if (reg->pbc) {
methods |= WPS_CONFIG_PUSHBUTTON; methods |= WPS_CONFIG_PUSHBUTTON;
if (reg->wps->config_methods & WPS_CONFIG_VIRT_PUSHBUTTON)
methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
if (reg->wps->config_methods & WPS_CONFIG_PHY_PUSHBUTTON)
methods |= WPS_CONFIG_PHY_PUSHBUTTON;
}
if (reg->sel_reg_config_methods_override >= 0) if (reg->sel_reg_config_methods_override >= 0)
methods = reg->sel_reg_config_methods_override; methods = reg->sel_reg_config_methods_override;
wpa_printf(MSG_DEBUG, "WPS: * Selected Registrar Config Methods (%x)", wpa_printf(MSG_DEBUG, "WPS: * Selected Registrar Config Methods (%x)",
@ -442,7 +449,9 @@ static int wps_build_probe_config_methods(struct wps_registrar *reg,
* These are the methods that the AP supports as an Enrollee for adding * These are the methods that the AP supports as an Enrollee for adding
* external Registrars. * external Registrars.
*/ */
methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; methods = reg->wps->config_methods &
~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
WPS_CONFIG_PHY_PUSHBUTTON);
wpa_printf(MSG_DEBUG, "WPS: * Config Methods (%x)", methods); wpa_printf(MSG_DEBUG, "WPS: * Config Methods (%x)", methods);
wpabuf_put_be16(msg, ATTR_CONFIG_METHODS); wpabuf_put_be16(msg, ATTR_CONFIG_METHODS);
wpabuf_put_be16(msg, 2); wpabuf_put_be16(msg, 2);
@ -455,9 +464,16 @@ static int wps_build_config_methods_r(struct wps_registrar *reg,
struct wpabuf *msg) struct wpabuf *msg)
{ {
u16 methods; u16 methods;
methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; methods = reg->wps->config_methods &
if (reg->pbc) ~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
WPS_CONFIG_PHY_PUSHBUTTON);
if (reg->pbc) {
methods |= WPS_CONFIG_PUSHBUTTON; methods |= WPS_CONFIG_PUSHBUTTON;
if (reg->wps->config_methods & WPS_CONFIG_VIRT_PUSHBUTTON)
methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
if (reg->wps->config_methods & WPS_CONFIG_PHY_PUSHBUTTON)
methods |= WPS_CONFIG_PHY_PUSHBUTTON;
}
return wps_build_config_methods(msg, methods); return wps_build_config_methods(msg, methods);
} }
@ -920,9 +936,18 @@ static void wps_cb_set_sel_reg(struct wps_registrar *reg)
return; return;
if (reg->selected_registrar) { if (reg->selected_registrar) {
methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; methods = reg->wps->config_methods &
if (reg->pbc) ~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
WPS_CONFIG_PHY_PUSHBUTTON);
if (reg->pbc) {
methods |= WPS_CONFIG_PUSHBUTTON; methods |= WPS_CONFIG_PUSHBUTTON;
if (reg->wps->config_methods &
WPS_CONFIG_VIRT_PUSHBUTTON)
methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
if (reg->wps->config_methods &
WPS_CONFIG_PHY_PUSHBUTTON)
methods |= WPS_CONFIG_PHY_PUSHBUTTON;
}
} }
reg->set_sel_reg_cb(reg->cb_ctx, reg->selected_registrar, reg->set_sel_reg_cb(reg->cb_ctx, reg->selected_registrar,
@ -2918,12 +2943,22 @@ void wps_registrar_selected_registrar_changed(struct wps_registrar *reg)
WPS_MAX_AUTHORIZED_MACS * ETH_ALEN); WPS_MAX_AUTHORIZED_MACS * ETH_ALEN);
if (reg->selected_registrar) { if (reg->selected_registrar) {
reg->sel_reg_config_methods_override = reg->sel_reg_config_methods_override =
reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; reg->wps->config_methods &
~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
WPS_CONFIG_PHY_PUSHBUTTON);
if (reg->pbc) { if (reg->pbc) {
reg->sel_reg_dev_password_id_override = reg->sel_reg_dev_password_id_override =
DEV_PW_PUSHBUTTON; DEV_PW_PUSHBUTTON;
reg->sel_reg_config_methods_override |= reg->sel_reg_config_methods_override |=
WPS_CONFIG_PUSHBUTTON; WPS_CONFIG_PUSHBUTTON;
if (reg->wps->config_methods &
WPS_CONFIG_VIRT_PUSHBUTTON)
reg->sel_reg_config_methods_override |=
WPS_CONFIG_VIRT_PUSHBUTTON;
if (reg->wps->config_methods &
WPS_CONFIG_PHY_PUSHBUTTON)
reg->sel_reg_config_methods_override |=
WPS_CONFIG_PHY_PUSHBUTTON;
} }
wpa_printf(MSG_DEBUG, "WPS: Internal Registrar selected " wpa_printf(MSG_DEBUG, "WPS: Internal Registrar selected "
"(pbc=%d)", reg->pbc); "(pbc=%d)", reg->pbc);

View file

@ -302,9 +302,12 @@ struct wpa_config {
* config_methods - Config Methods * config_methods - Config Methods
* *
* This is a space-separated list of supported WPS configuration * This is a space-separated list of supported WPS configuration
* methods. For example, "label display push_button keypad". * methods. For example, "label virtual_display virtual_push_button
* keypad".
* Available methods: usba ethernet label display ext_nfc_token * Available methods: usba ethernet label display ext_nfc_token
* int_nfc_token nfc_interface push_button keypad. * int_nfc_token nfc_interface push_button keypad
* virtual_display physical_display
* virtual_push_button physical_push_button.
*/ */
char *config_methods; char *config_methods;

View file

@ -199,8 +199,9 @@ fast_reauth=1
# Config Methods # Config Methods
# List of the supported configuration methods # List of the supported configuration methods
# Available methods: usba ethernet label display ext_nfc_token int_nfc_token # Available methods: usba ethernet label display ext_nfc_token int_nfc_token
# nfc_interface push_button keypad # nfc_interface push_button keypad virtual_display physical_display
#config_methods=label display push_button keypad # virtual_push_button physical_push_button
#config_methods=label virtual_display virtual_push_button keypad
# Credential processing # Credential processing
# 0 = process received credentials internally (default) # 0 = process received credentials internally (default)