WPS UFD: Make build conditional on CONFIG_WPS_UFD=y

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.
This commit is contained in:
Jouni Malinen 2009-02-26 22:01:36 +02:00
parent a79e73a1b1
commit 390cd3105d
5 changed files with 22 additions and 6 deletions

View file

@ -313,12 +313,16 @@ OBJS += ../src/wps/wps_attr_process.o
OBJS += ../src/wps/wps_dev_attr.o OBJS += ../src/wps/wps_dev_attr.o
OBJS += ../src/wps/wps_enrollee.o OBJS += ../src/wps/wps_enrollee.o
OBJS += ../src/wps/wps_registrar.o OBJS += ../src/wps/wps_registrar.o
OBJS += ../src/wps/wps_ufd.o
NEED_DH_GROUPS=y NEED_DH_GROUPS=y
NEED_SHA256=y NEED_SHA256=y
NEED_CRYPTO=y NEED_CRYPTO=y
NEED_BASE64=y NEED_BASE64=y
ifdef CONFIG_WPS_UFD
CFLAGS += -DCONFIG_WPS_UFD
OBJS += ../src/wps/wps_ufd.o
endif
ifdef CONFIG_WPS_UPNP ifdef CONFIG_WPS_UPNP
CFLAGS += -DCONFIG_WPS_UPNP CFLAGS += -DCONFIG_WPS_UPNP
OBJS += ../src/wps/wps_upnp.o OBJS += ../src/wps/wps_upnp.o

View file

@ -299,9 +299,13 @@ struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
if (pbc) if (pbc)
methods = WPS_CONFIG_PUSHBUTTON; methods = WPS_CONFIG_PUSHBUTTON;
else else {
methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | 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) || if (wps_build_version(ie) ||
wps_build_req_type(ie, req_type) || wps_build_req_type(ie, req_type) ||

View 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) struct oob_device_data * wps_get_oob_device(char *device_type)
{ {
#ifdef CONFIG_WPS_UFD
if (os_strstr(device_type, "ufd") != NULL) if (os_strstr(device_type, "ufd") != NULL)
return &oob_ufd_device_data; return &oob_ufd_device_data;
#endif /* CONFIG_WPS_UFD */
return NULL; return NULL;
} }

View file

@ -131,8 +131,10 @@ static struct wpabuf * wps_build_m1(struct wps_data *wps)
if (msg == NULL) if (msg == NULL)
return NULL; return NULL;
methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD | methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD;
WPS_CONFIG_USBA; #ifdef CONFIG_WPS_UFD
methods |= WPS_CONFIG_USBA;
#endif /* CONFIG_WPS_UFD */
if (wps->pbc) if (wps->pbc)
methods |= WPS_CONFIG_PUSHBUTTON; methods |= WPS_CONFIG_PUSHBUTTON;

View file

@ -521,13 +521,17 @@ OBJS += ../src/wps/wps_attr_process.o
OBJS += ../src/wps/wps_dev_attr.o OBJS += ../src/wps/wps_dev_attr.o
OBJS += ../src/wps/wps_enrollee.o OBJS += ../src/wps/wps_enrollee.o
OBJS += ../src/wps/wps_registrar.o OBJS += ../src/wps/wps_registrar.o
OBJS += ../src/wps/wps_ufd.o
OBJS_h += ../src/eap_server/eap_wsc.o OBJS_h += ../src/eap_server/eap_wsc.o
CONFIG_IEEE8021X_EAPOL=y CONFIG_IEEE8021X_EAPOL=y
NEED_DH_GROUPS=y NEED_DH_GROUPS=y
NEED_SHA256=y NEED_SHA256=y
NEED_BASE64=y NEED_BASE64=y
ifdef CONFIG_WPS_UFD
CFLAGS += -DCONFIG_WPS_UFD
OBJS += ../src/wps/wps_ufd.o
endif
ifdef CONFIG_WPS_UPNP ifdef CONFIG_WPS_UPNP
CFLAGS += -DCONFIG_WPS_UPNP CFLAGS += -DCONFIG_WPS_UPNP
OBJS += ../src/wps/wps_upnp.o OBJS += ../src/wps/wps_upnp.o