WPS UFD: Make build conditional on CONFIG_WPS_UFD=y
authorJouni Malinen <j@w1.fi>
Thu, 26 Feb 2009 20:01:36 +0000 (22:01 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 26 Feb 2009 20:01:36 +0000 (22:01 +0200)
Not all embedded devices have USB interface and it is useful to be able
to remove unneeded functionality from the binary. In addition, the
current implementation has some UNIX specific calls in it which may make
it not compile cleanly on all target systems.

hostapd/Makefile
src/wps/wps.c
src/wps/wps_common.c
src/wps/wps_enrollee.c
wpa_supplicant/Makefile

index c5f12f7..9c44edb 100644 (file)
@@ -313,12 +313,16 @@ OBJS += ../src/wps/wps_attr_process.o
 OBJS += ../src/wps/wps_dev_attr.o
 OBJS += ../src/wps/wps_enrollee.o
 OBJS += ../src/wps/wps_registrar.o
-OBJS += ../src/wps/wps_ufd.o
 NEED_DH_GROUPS=y
 NEED_SHA256=y
 NEED_CRYPTO=y
 NEED_BASE64=y
 
+ifdef CONFIG_WPS_UFD
+CFLAGS += -DCONFIG_WPS_UFD
+OBJS += ../src/wps/wps_ufd.o
+endif
+
 ifdef CONFIG_WPS_UPNP
 CFLAGS += -DCONFIG_WPS_UPNP
 OBJS += ../src/wps/wps_upnp.o
index d26cb3b..79f3512 100644 (file)
@@ -299,9 +299,13 @@ struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
 
        if (pbc)
                methods = WPS_CONFIG_PUSHBUTTON;
-       else
+       else {
                methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY |
-                       WPS_CONFIG_KEYPAD | WPS_CONFIG_USBA;
+                       WPS_CONFIG_KEYPAD;
+#ifdef CONFIG_WPS_UFD
+               methods |= WPS_CONFIG_USBA;
+#endif /* CONFIG_WPS_UFD */
+       }
 
        if (wps_build_version(ie) ||
            wps_build_req_type(ie, req_type) ||
index 3e4ec55..a2c88ad 100644 (file)
@@ -518,8 +518,10 @@ int wps_process_oob(struct wps_context *wps, int registrar)
 
 struct oob_device_data * wps_get_oob_device(char *device_type)
 {
+#ifdef CONFIG_WPS_UFD
        if (os_strstr(device_type, "ufd") != NULL)
                return &oob_ufd_device_data;
+#endif /* CONFIG_WPS_UFD */
 
        return NULL;
 }
index 2c6d404..3cfc878 100644 (file)
@@ -131,8 +131,10 @@ static struct wpabuf * wps_build_m1(struct wps_data *wps)
        if (msg == NULL)
                return NULL;
 
-       methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD |
-                 WPS_CONFIG_USBA;
+       methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD;
+#ifdef CONFIG_WPS_UFD
+       methods |= WPS_CONFIG_USBA;
+#endif /* CONFIG_WPS_UFD */
        if (wps->pbc)
                methods |= WPS_CONFIG_PUSHBUTTON;
 
index d7f2182..8325222 100644 (file)
@@ -521,13 +521,17 @@ OBJS += ../src/wps/wps_attr_process.o
 OBJS += ../src/wps/wps_dev_attr.o
 OBJS += ../src/wps/wps_enrollee.o
 OBJS += ../src/wps/wps_registrar.o
-OBJS += ../src/wps/wps_ufd.o
 OBJS_h += ../src/eap_server/eap_wsc.o
 CONFIG_IEEE8021X_EAPOL=y
 NEED_DH_GROUPS=y
 NEED_SHA256=y
 NEED_BASE64=y
 
+ifdef CONFIG_WPS_UFD
+CFLAGS += -DCONFIG_WPS_UFD
+OBJS += ../src/wps/wps_ufd.o
+endif
+
 ifdef CONFIG_WPS_UPNP
 CFLAGS += -DCONFIG_WPS_UPNP
 OBJS += ../src/wps/wps_upnp.o