For now, the default build will only include WSC 1.0 support.
CONFIG_WPS2=y can be used to add support for WSC 2.0.
endif
ifdef CONFIG_WPS
+ifdef CONFIG_WPS2
+CFLAGS += -DCONFIG_WPS2
+endif
+
CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
OBJS += ../src/utils/uuid.o
OBJS += ../src/ap/wps_hostapd.o
CONFIG_DRIVER_MADWIFI=y
CFLAGS += -I/usr/src/madwifi-0.9.3
CONFIG_WPS=y
+CONFIG_WPS2=y
CONFIG_WPS_UPNP=y
# Wi-Fi Protected Setup (WPS)
#CONFIG_WPS=y
+# Enable WSC 2.0 support
+#CONFIG_WPS2=y
# Enable UPnP support for external WPS Registrars
#CONFIG_WPS_UPNP=y
if (pbc) {
methods = WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
/*
* TODO: At least in theory, should figure out whether this
* Probe Request was triggered with physical or virtual
* pushbutton.
*/
methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
+#endif /* CONFIG_WPS2 */
} else {
/*
* TODO: At least in theory, should figure out whether this
* display.
*/
methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY |
+#ifdef CONFIG_WPS2
WPS_CONFIG_VIRT_DISPLAY |
+#endif /* CONFIG_WPS2 */
WPS_CONFIG_KEYPAD;
#ifdef CONFIG_WPS_UFD
methods |= WPS_CONFIG_USBA;
wps_build_config_error(ie, WPS_CFG_NO_ERROR) ||
wps_build_dev_password_id(ie, pbc ? DEV_PW_PUSHBUTTON :
DEV_PW_DEFAULT) ||
+#ifdef CONFIG_WPS2
wps_build_version2(ie) ||
wps_build_manufacturer(dev, ie) ||
wps_build_model_name(dev, ie) ||
wps_build_model_number(dev, ie) ||
wps_build_dev_name(dev, ie) ||
(req_type == WPS_REQ_ENROLLEE &&
- wps_build_req_to_enroll(ie))) {
+ wps_build_req_to_enroll(ie))
+#else /* CONFIG_WPS2 */
+ 0
+#endif /* CONFIG_WPS2 */
+ ) {
wpabuf_free(ie);
return NULL;
}
int wps_build_version2(struct wpabuf *msg)
{
+#ifdef CONFIG_WPS2
wpa_printf(MSG_DEBUG, "WPS: * Version2 (0x%x)", WPS_VERSION);
wpabuf_put_be16(msg, ATTR_VERSION2);
wpabuf_put_be16(msg, 1);
wpabuf_put_be16(msg, 1);
wpabuf_put_u8(msg, 42);
#endif /* CONFIG_WPS_EXTENSIBILITY_TESTING */
+#endif /* CONFIG_WPS2 */
return 0;
}
int wps_build_req_to_enroll(struct wpabuf *msg)
{
+#ifdef CONFIG_WPS2
wpa_printf(MSG_DEBUG, "WPS: * Request to Enroll (1)");
wpabuf_put_be16(msg, ATTR_REQUEST_TO_ENROLL);
wpabuf_put_be16(msg, 1);
wpabuf_put_u8(msg, 1);
+#endif /* CONFIG_WPS2 */
return 0;
}
}
attr->version = pos;
break;
+#ifdef CONFIG_WPS2
case ATTR_VERSION2:
if (len != 1) {
wpa_printf(MSG_DEBUG, "WPS: Invalid Version2 length "
}
attr->version2 = pos;
break;
+#endif /* CONFIG_WPS2 */
case ATTR_MSG_TYPE:
if (len != 1) {
wpa_printf(MSG_DEBUG, "WPS: Invalid Message Type "
}
attr->ap_setup_locked = pos;
break;
+#ifdef CONFIG_WPS2
case ATTR_SETTINGS_DELAY_TIME:
if (len != 1) {
wpa_printf(MSG_DEBUG, "WPS: Invalid Settings Delay "
attr->req_dev_type[attr->num_req_dev_type] = pos;
attr->num_req_dev_type++;
break;
+#endif /* CONFIG_WPS2 */
default:
wpa_printf(MSG_DEBUG, "WPS: Unsupported attribute type 0x%x "
"len=%u", type, len);
if (str == NULL) {
/* Default to enabling methods based on build configuration */
methods |= WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD;
+#ifdef CONFIG_WPS2
methods |= WPS_CONFIG_VIRT_DISPLAY;
+#endif /* CONFIG_WPS2 */
#ifdef CONFIG_WPS_UFD
methods |= WPS_CONFIG_USBA;
#endif /* CONFIG_WPS_UFD */
methods |= WPS_CONFIG_PUSHBUTTON;
if (os_strstr(str, "keypad"))
methods |= WPS_CONFIG_KEYPAD;
+#ifdef CONFIG_WPS2
if (os_strstr(str, "virtual_display"))
methods |= WPS_CONFIG_VIRT_DISPLAY;
if (os_strstr(str, "physical_display"))
methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
if (os_strstr(str, "physical_push_button"))
methods |= WPS_CONFIG_PHY_PUSHBUTTON;
+#endif /* CONFIG_WPS2 */
}
return methods;
#ifndef WPS_DEFS_H
#define WPS_DEFS_H
+#ifdef CONFIG_WPS2
#ifdef CONFIG_WPS_EXTENSIBILITY_TESTING
#define WPS_VERSION 0x57
#else /* CONFIG_WPS_EXTENSIBILITY_TESTING */
#define WPS_VERSION 0x20
#endif /* CONFIG_WPS_EXTENSIBILITY_TESTING */
+#else /* CONFIG_WPS2 */
+#define WPS_VERSION 0x10
+#endif /* CONFIG_WPS2 */
/* Diffie-Hellman 1536-bit MODP Group; RFC 3526, Group 5 */
#define WPS_DH_GROUP 5
ATTR_802_1X_ENABLED = 0x1062,
ATTR_APPSESSIONKEY = 0x1063,
ATTR_WEPTRANSMITKEY = 0x1064,
+#ifdef CONFIG_WPS2
ATTR_SETTINGS_DELAY_TIME = 0x1065,
ATTR_NETWORK_KEY_SHAREABLE = 0x1066,
ATTR_VERSION2 = 0x1067,
ATTR_REQUEST_TO_ENROLL = 0x1068,
ATTR_AUTHORIZED_MACS = 0x1069,
ATTR_REQUESTED_DEV_TYPE = 0x106a,
+#endif /* CONFIG_WPS2 */
ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
};
#define WPS_CONFIG_NFC_INTERFACE 0x0040
#define WPS_CONFIG_PUSHBUTTON 0x0080
#define WPS_CONFIG_KEYPAD 0x0100
+#ifdef CONFIG_WPS2
#define WPS_CONFIG_VIRT_PUSHBUTTON 0x0280
#define WPS_CONFIG_PHY_PUSHBUTTON 0x0480
#define WPS_CONFIG_VIRT_DISPLAY 0x2008
#define WPS_CONFIG_PHY_DISPLAY 0x4008
+#endif /* CONFIG_WPS2 */
/* Connection Type Flags */
#define WPS_CONN_ESS 0x01
#endif /* CONFIG_WPS_STRICT */
}
+#ifdef CONFIG_WPS2
if (!(wps->cred.encr_type &
(WPS_ENCR_NONE | WPS_ENCR_TKIP | WPS_ENCR_AES))) {
if (wps->cred.encr_type & WPS_ENCR_WEP) {
"invalid encr_type 0x%x", wps->cred.encr_type);
return -1;
}
+#endif /* CONFIG_WPS2 */
if (wps->wps->cred_cb) {
wps->cred.cred_attr = cred - 4;
#endif /* CONFIG_WPS_STRICT */
}
+#ifdef CONFIG_WPS2
if (!(cred.encr_type & (WPS_ENCR_NONE | WPS_ENCR_TKIP | WPS_ENCR_AES)))
{
if (cred.encr_type & WPS_ENCR_WEP) {
"invalid encr_type 0x%x", cred.encr_type);
return -1;
}
+#endif /* CONFIG_WPS2 */
#ifdef CONFIG_WPS_STRICT
if (wps2) {
}
#endif /* CONFIG_WPS_STRICT */
+#ifdef CONFIG_WPS2
if ((cred.encr_type & (WPS_ENCR_TKIP | WPS_ENCR_AES)) == WPS_ENCR_TKIP)
{
wpa_printf(MSG_DEBUG, "WPS: Upgrade encr_type TKIP -> "
"WPAPSK+WPA2PSK");
cred.auth_type |= WPS_AUTH_WPA2PSK;
}
+#endif /* CONFIG_WPS2 */
if (wps->wps->cred_cb) {
cred.cred_attr = wpabuf_head(attrs);
static int wps_er_build_uuid_r(struct wpabuf *msg, const u8 *uuid_r)
{
+#ifdef CONFIG_WPS2
wpabuf_put_be16(msg, ATTR_UUID_R);
wpabuf_put_be16(msg, WPS_UUID_LEN);
wpabuf_put_data(msg, uuid_r, WPS_UUID_LEN);
+#endif /* CONFIG_WPS2 */
return 0;
}
u16 methods;
if (!reg->sel_reg_union)
return 0;
- methods = reg->wps->config_methods &
- ~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
- WPS_CONFIG_PHY_PUSHBUTTON);
+ methods = reg->wps->config_methods;
+ methods &= ~WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
+ methods &= ~(WPS_CONFIG_VIRT_PUSHBUTTON |
+ WPS_CONFIG_PHY_PUSHBUTTON);
+#endif /* CONFIG_WPS2 */
if (reg->pbc) {
methods |= WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
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;
+#endif /* CONFIG_WPS2 */
}
if (reg->sel_reg_config_methods_override >= 0)
methods = reg->sel_reg_config_methods_override;
* These are the methods that the AP supports as an Enrollee for adding
* external Registrars.
*/
- methods = reg->wps->config_methods &
- ~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
- WPS_CONFIG_PHY_PUSHBUTTON);
+ methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
+ methods &= ~(WPS_CONFIG_VIRT_PUSHBUTTON |
+ WPS_CONFIG_PHY_PUSHBUTTON);
+#endif /* CONFIG_WPS2 */
wpa_printf(MSG_DEBUG, "WPS: * Config Methods (%x)", methods);
wpabuf_put_be16(msg, ATTR_CONFIG_METHODS);
wpabuf_put_be16(msg, 2);
struct wpabuf *msg)
{
u16 methods;
- methods = reg->wps->config_methods &
- ~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
- WPS_CONFIG_PHY_PUSHBUTTON);
+ methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
+ methods &= ~(WPS_CONFIG_VIRT_PUSHBUTTON |
+ WPS_CONFIG_PHY_PUSHBUTTON);
+#endif /* CONFIG_WPS2 */
if (reg->pbc) {
methods |= WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
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;
+#endif /* CONFIG_WPS2 */
}
return wps_build_config_methods(msg, methods);
}
int wps_build_authorized_macs(struct wps_registrar *reg, struct wpabuf *msg)
{
+#ifdef CONFIG_WPS2
int count = 0;
while (count < WPS_MAX_AUTHORIZED_MACS) {
wpabuf_put_be16(msg, ATTR_AUTHORIZED_MACS);
wpabuf_put_be16(msg, count * ETH_ALEN);
wpabuf_put_data(msg, reg->authorized_macs_union, count * ETH_ALEN);
+#endif /* CONFIG_WPS2 */
return 0;
}
return;
if (reg->selected_registrar) {
- methods = reg->wps->config_methods &
- ~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
- WPS_CONFIG_PHY_PUSHBUTTON);
+ methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
+ methods &= ~(WPS_CONFIG_VIRT_PUSHBUTTON |
+ WPS_CONFIG_PHY_PUSHBUTTON);
+#endif /* CONFIG_WPS2 */
if (reg->pbc) {
methods |= WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
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;
+#endif /* CONFIG_WPS2 */
}
}
WPS_MAX_AUTHORIZED_MACS * ETH_ALEN);
if (reg->selected_registrar) {
reg->sel_reg_config_methods_override =
- reg->wps->config_methods &
- ~(WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
+ reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
+ reg->sel_reg_config_methods_override &=
+ ~(WPS_CONFIG_VIRT_PUSHBUTTON |
WPS_CONFIG_PHY_PUSHBUTTON);
+#endif /* CONFIG_WPS2 */
if (reg->pbc) {
reg->sel_reg_dev_password_id_override =
DEV_PW_PUSHBUTTON;
reg->sel_reg_config_methods_override |=
WPS_CONFIG_PUSHBUTTON;
+#ifdef CONFIG_WPS2
if (reg->wps->config_methods &
WPS_CONFIG_VIRT_PUSHBUTTON)
reg->sel_reg_config_methods_override |=
WPS_CONFIG_PHY_PUSHBUTTON)
reg->sel_reg_config_methods_override |=
WPS_CONFIG_PHY_PUSHBUTTON;
+#endif /* CONFIG_WPS2 */
}
wpa_printf(MSG_DEBUG, "WPS: Internal Registrar selected "
"(pbc=%d)", reg->pbc);
endif
ifdef CONFIG_WPS
+ifdef CONFIG_WPS2
+CFLAGS += -DCONFIG_WPS2
+endif
+
# EAP-WSC
CFLAGS += -DCONFIG_WPS -DEAP_WSC
OBJS += wps_supplicant.o
CONFIG_DRIVER_WEXT=y
CONFIG_WPS=y
+CONFIG_WPS2=y
WPS needs the Universally Unique IDentifier (UUID; see RFC 4122) for
return pos;
if (wps_is_selected_pbc_registrar(wps_ie))
txt = "[WPS-PBC]";
+#ifdef CONFIG_WPS2
else if (wps_is_addr_authorized(wps_ie, wpa_s->own_addr, 0))
txt = "[WPS-AUTH]";
+#endif /* CONFIG_WPS2 */
else if (wps_is_selected_pin_registrar(wps_ie))
txt = "[WPS-PIN]";
else
# Wi-Fi Protected Setup (WPS)
#CONFIG_WPS=y
+# Enable WSC 2.0 support
+#CONFIG_WPS2=y
# EAP-IKEv2
#CONFIG_EAP_IKEV2=y
# Available methods: usba ethernet label display ext_nfc_token int_nfc_token
# nfc_interface push_button keypad virtual_display physical_display
# virtual_push_button physical_push_button
+# For WSC 1.0:
+#config_methods=label display push_button keypad
+# For WSC 2.0:
#config_methods=label virtual_display virtual_push_button keypad
# Credential processing