projects
/
wpasupplicant
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d5e2b2d
)
WPS UFD: Build OOB functionality only if UFD is enabled
author
Jouni Malinen
<j@w1.fi>
Thu, 26 Feb 2009 20:10:21 +0000
(22:10 +0200)
committer
Jouni Malinen
<j@w1.fi>
Thu, 26 Feb 2009 20:10:21 +0000
(22:10 +0200)
12 files changed:
hostapd/Makefile
patch
|
blob
|
history
hostapd/ctrl_iface.c
patch
|
blob
|
history
hostapd/hostapd_cli.c
patch
|
blob
|
history
hostapd/wps_hostapd.c
patch
|
blob
|
history
src/wps/wps_attr_build.c
patch
|
blob
|
history
src/wps/wps_common.c
patch
|
blob
|
history
src/wps/wps_enrollee.c
patch
|
blob
|
history
src/wps/wps_registrar.c
patch
|
blob
|
history
wpa_supplicant/Makefile
patch
|
blob
|
history
wpa_supplicant/ctrl_iface.c
patch
|
blob
|
history
wpa_supplicant/wpa_cli.c
patch
|
blob
|
history
wpa_supplicant/wps_supplicant.c
patch
|
blob
|
history
diff --git
a/hostapd/Makefile
b/hostapd/Makefile
index
9c44edb
..
0dbece6
100644
(file)
--- a/
hostapd/Makefile
+++ b/
hostapd/Makefile
@@
-321,6
+321,11
@@
NEED_BASE64=y
ifdef CONFIG_WPS_UFD
CFLAGS += -DCONFIG_WPS_UFD
OBJS += ../src/wps/wps_ufd.o
ifdef CONFIG_WPS_UFD
CFLAGS += -DCONFIG_WPS_UFD
OBJS += ../src/wps/wps_ufd.o
+NEED_WPS_OOB=y
+endif
+
+ifdef NEED_WPS_OOB
+CFLAGS += -DCONFIG_WPS_OOB
endif
ifdef CONFIG_WPS_UPNP
endif
ifdef CONFIG_WPS_UPNP
diff --git
a/hostapd/ctrl_iface.c
b/hostapd/ctrl_iface.c
index
9e6505a
..
5d85558
100644
(file)
--- a/
hostapd/ctrl_iface.c
+++ b/
hostapd/ctrl_iface.c
@@
-254,6
+254,7
@@
static int hostapd_ctrl_iface_wps_pin(struct hostapd_data *hapd, char *txt)
}
}
+#ifdef CONFIG_WPS_OOB
static int hostapd_ctrl_iface_wps_oob(struct hostapd_data *hapd, char *txt)
{
char *path, *method;
static int hostapd_ctrl_iface_wps_oob(struct hostapd_data *hapd, char *txt)
{
char *path, *method;
@@
-270,6
+271,7
@@
static int hostapd_ctrl_iface_wps_oob(struct hostapd_data *hapd, char *txt)
return hostapd_wps_start_oob(hapd, txt, path, method);
}
return hostapd_wps_start_oob(hapd, txt, path, method);
}
+#endif /* CONFIG_WPS_OOB */
#endif /* CONFIG_WPS */
#endif /* CONFIG_WPS */
@@
-368,9
+370,11
@@
static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
} else if (os_strcmp(buf, "WPS_PBC") == 0) {
if (hostapd_wps_button_pushed(hapd))
reply_len = -1;
} else if (os_strcmp(buf, "WPS_PBC") == 0) {
if (hostapd_wps_button_pushed(hapd))
reply_len = -1;
+#ifdef CONFIG_WPS_OOB
} else if (os_strncmp(buf, "WPS_OOB ", 8) == 0) {
if (hostapd_ctrl_iface_wps_oob(hapd, buf + 8))
reply_len = -1;
} else if (os_strncmp(buf, "WPS_OOB ", 8) == 0) {
if (hostapd_ctrl_iface_wps_oob(hapd, buf + 8))
reply_len = -1;
+#endif /* CONFIG_WPS_OOB */
#endif /* CONFIG_WPS */
} else {
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
#endif /* CONFIG_WPS */
} else {
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
diff --git
a/hostapd/hostapd_cli.c
b/hostapd/hostapd_cli.c
index
d4d7a3f
..
c32d9d3
100644
(file)
--- a/
hostapd/hostapd_cli.c
+++ b/
hostapd/hostapd_cli.c
@@
-89,7
+89,9
@@
static const char *commands_help =
#ifdef CONFIG_WPS
" wps_pin <uuid> <pin> add WPS Enrollee PIN (Device Password)\n"
" wps_pbc indicate button pushed to initiate PBC\n"
#ifdef CONFIG_WPS
" wps_pin <uuid> <pin> add WPS Enrollee PIN (Device Password)\n"
" wps_pbc indicate button pushed to initiate PBC\n"
+#ifdef CONFIG_WPS_OOB
" wps_oob <type> <path> <method> use WPS with out-of-band (UFD)\n"
" wps_oob <type> <path> <method> use WPS with out-of-band (UFD)\n"
+#endif /* CONFIG_WPS_OOB */
#endif /* CONFIG_WPS */
" help show this usage help\n"
" interface [ifname] show interfaces/select interface\n"
#endif /* CONFIG_WPS */
" help show this usage help\n"
" interface [ifname] show interfaces/select interface\n"
@@
-278,6
+280,7
@@
static int hostapd_cli_cmd_wps_pbc(struct wpa_ctrl *ctrl, int argc,
}
}
+#ifdef CONFIG_WPS_OOB
static int hostapd_cli_cmd_wps_oob(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
static int hostapd_cli_cmd_wps_oob(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@
-301,6
+304,7
@@
static int hostapd_cli_cmd_wps_oob(struct wpa_ctrl *ctrl, int argc,
}
return wpa_ctrl_command(ctrl, cmd);
}
}
return wpa_ctrl_command(ctrl, cmd);
}
+#endif /* CONFIG_WPS_OOB */
#endif /* CONFIG_WPS */
#endif /* CONFIG_WPS */
@@
-458,7
+462,9
@@
static struct hostapd_cli_cmd hostapd_cli_commands[] = {
#ifdef CONFIG_WPS
{ "wps_pin", hostapd_cli_cmd_wps_pin },
{ "wps_pbc", hostapd_cli_cmd_wps_pbc },
#ifdef CONFIG_WPS
{ "wps_pin", hostapd_cli_cmd_wps_pin },
{ "wps_pbc", hostapd_cli_cmd_wps_pbc },
+#ifdef CONFIG_WPS_OOB
{ "wps_oob", hostapd_cli_cmd_wps_oob },
{ "wps_oob", hostapd_cli_cmd_wps_oob },
+#endif /* CONFIG_WPS_OOB */
#endif /* CONFIG_WPS */
{ "help", hostapd_cli_cmd_help },
{ "interface", hostapd_cli_cmd_interface },
#endif /* CONFIG_WPS */
{ "help", hostapd_cli_cmd_help },
{ "interface", hostapd_cli_cmd_interface },
diff --git
a/hostapd/wps_hostapd.c
b/hostapd/wps_hostapd.c
index
896c856
..
0905391
100644
(file)
--- a/
hostapd/wps_hostapd.c
+++ b/
hostapd/wps_hostapd.c
@@
-667,6
+667,8
@@
void hostapd_deinit_wps(struct hostapd_data *hapd)
wps_device_data_free(&hapd->wps->dev);
wpabuf_free(hapd->wps->dh_pubkey);
wpabuf_free(hapd->wps->dh_privkey);
wps_device_data_free(&hapd->wps->dev);
wpabuf_free(hapd->wps->dh_pubkey);
wpabuf_free(hapd->wps->dh_privkey);
+ wpabuf_free(hapd->wps->oob_conf.pubkey_hash);
+ wpabuf_free(hapd->wps->oob_conf.dev_password);
wps_free_pending_msgs(hapd->wps->upnp_msgs);
os_free(hapd->wps);
hapd->wps = NULL;
wps_free_pending_msgs(hapd->wps->upnp_msgs);
os_free(hapd->wps);
hapd->wps = NULL;
@@
-699,6
+701,7
@@
int hostapd_wps_button_pushed(struct hostapd_data *hapd)
}
}
+#ifdef CONFIG_WPS_OOB
int hostapd_wps_start_oob(struct hostapd_data *hapd, char *device_type,
char *path, char *method)
{
int hostapd_wps_start_oob(struct hostapd_data *hapd, char *device_type,
char *path, char *method)
{
@@
-747,6
+750,7
@@
error:
wps->dh_privkey = NULL;
return -1;
}
wps->dh_privkey = NULL;
return -1;
}
+#endif /* CONFIG_WPS_OOB */
void hostapd_wps_probe_req_rx(struct hostapd_data *hapd, const u8 *addr,
void hostapd_wps_probe_req_rx(struct hostapd_data *hapd, const u8 *addr,
diff --git
a/src/wps/wps_attr_build.c
b/src/wps/wps_attr_build.c
index
919755d
..
f35881a
100644
(file)
--- a/
src/wps/wps_attr_build.c
+++ b/
src/wps/wps_attr_build.c
@@
-266,6
+266,7
@@
int wps_build_encr_settings(struct wps_data *wps, struct wpabuf *msg,
}
}
+#ifdef CONFIG_WPS_OOB
int wps_build_oob_dev_password(struct wpabuf *msg, struct wps_context *wps)
{
size_t hash_len;
int wps_build_oob_dev_password(struct wpabuf *msg, struct wps_context *wps)
{
size_t hash_len;
@@
-306,3
+307,4
@@
int wps_build_oob_dev_password(struct wpabuf *msg, struct wps_context *wps)
return 0;
}
return 0;
}
+#endif /* CONFIG_WPS_OOB */
diff --git
a/src/wps/wps_common.c
b/src/wps/wps_common.c
index
b5bb485
..
f679ff6
100644
(file)
--- a/
src/wps/wps_common.c
+++ b/
src/wps/wps_common.c
@@
-337,6
+337,8
@@
void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part)
}
}
+#ifdef CONFIG_WPS_OOB
+
static struct wpabuf * wps_get_oob_cred(struct wps_context *wps)
{
struct wps_data data;
static struct wpabuf * wps_get_oob_cred(struct wps_context *wps)
{
struct wps_data data;
@@
-538,3
+540,5
@@
int wps_get_oob_method(char *method)
return OOB_METHOD_CRED;
return OOB_METHOD_UNKNOWN;
}
return OOB_METHOD_CRED;
return OOB_METHOD_UNKNOWN;
}
+
+#endif /* CONFIG_WPS_OOB */
diff --git
a/src/wps/wps_enrollee.c
b/src/wps/wps_enrollee.c
index
4c2dd22
..
6de9a04
100644
(file)
--- a/
src/wps/wps_enrollee.c
+++ b/
src/wps/wps_enrollee.c
@@
-517,6
+517,7
@@
static int wps_process_pubkey(struct wps_data *wps, const u8 *pk,
return -1;
}
return -1;
}
+#ifdef CONFIG_WPS_OOB
if (wps->dev_pw_id != DEV_PW_DEFAULT &&
wps->wps->oob_conf.pubkey_hash) {
const u8 *addr[1];
if (wps->dev_pw_id != DEV_PW_DEFAULT &&
wps->wps->oob_conf.pubkey_hash) {
const u8 *addr[1];
@@
-531,6
+532,7
@@
static int wps_process_pubkey(struct wps_data *wps, const u8 *pk,
return -1;
}
}
return -1;
}
}
+#endif /* CONFIG_WPS_OOB */
wpabuf_free(wps->dh_pubkey_r);
wps->dh_pubkey_r = wpabuf_alloc_copy(pk, pk_len);
wpabuf_free(wps->dh_pubkey_r);
wps->dh_pubkey_r = wpabuf_alloc_copy(pk, pk_len);
diff --git
a/src/wps/wps_registrar.c
b/src/wps/wps_registrar.c
index
fb5579b
..
dff635d
100644
(file)
--- a/
src/wps/wps_registrar.c
+++ b/
src/wps/wps_registrar.c
@@
-1627,6
+1627,7
@@
static int wps_process_pubkey(struct wps_data *wps, const u8 *pk,
return -1;
}
return -1;
}
+#ifdef CONFIG_WPS_OOB
if (wps->wps->oob_conf.pubkey_hash != NULL) {
const u8 *addr[1];
u8 hash[WPS_HASH_LEN];
if (wps->wps->oob_conf.pubkey_hash != NULL) {
const u8 *addr[1];
u8 hash[WPS_HASH_LEN];
@@
-1640,6
+1641,7
@@
static int wps_process_pubkey(struct wps_data *wps, const u8 *pk,
return -1;
}
}
return -1;
}
}
+#endif /* CONFIG_WPS_OOB */
wpabuf_free(wps->dh_pubkey_e);
wps->dh_pubkey_e = wpabuf_alloc_copy(pk, pk_len);
wpabuf_free(wps->dh_pubkey_e);
wps->dh_pubkey_e = wpabuf_alloc_copy(pk, pk_len);
@@
-1821,6
+1823,7
@@
static enum wps_process_res wps_process_m1(struct wps_data *wps,
return WPS_CONTINUE;
}
return WPS_CONTINUE;
}
+#ifdef CONFIG_WPS_OOB
if (wps->dev_pw_id >= 0x10 &&
wps->dev_pw_id != wps->wps->oob_dev_pw_id) {
wpa_printf(MSG_DEBUG, "WPS: OOB Device Password ID "
if (wps->dev_pw_id >= 0x10 &&
wps->dev_pw_id != wps->wps->oob_dev_pw_id) {
wpa_printf(MSG_DEBUG, "WPS: OOB Device Password ID "
@@
-1828,6
+1831,7
@@
static enum wps_process_res wps_process_m1(struct wps_data *wps,
wps->state = SEND_M2D;
return WPS_CONTINUE;
}
wps->state = SEND_M2D;
return WPS_CONTINUE;
}
+#endif /* CONFIG_WPS_OOB */
if (wps->dev_pw_id == DEV_PW_PUSHBUTTON) {
if (wps_registrar_pbc_overlap(wps->wps->registrar,
if (wps->dev_pw_id == DEV_PW_PUSHBUTTON) {
if (wps_registrar_pbc_overlap(wps->wps->registrar,
diff --git
a/wpa_supplicant/Makefile
b/wpa_supplicant/Makefile
index
8325222
..
4dab19b
100644
(file)
--- a/
wpa_supplicant/Makefile
+++ b/
wpa_supplicant/Makefile
@@
-530,6
+530,11
@@
NEED_BASE64=y
ifdef CONFIG_WPS_UFD
CFLAGS += -DCONFIG_WPS_UFD
OBJS += ../src/wps/wps_ufd.o
ifdef CONFIG_WPS_UFD
CFLAGS += -DCONFIG_WPS_UFD
OBJS += ../src/wps/wps_ufd.o
+NEED_WPS_OOB=y
+endif
+
+ifdef NEED_WPS_OOB
+CFLAGS += -DCONFIG_WPS_OOB
endif
ifdef CONFIG_WPS_UPNP
endif
ifdef CONFIG_WPS_UPNP
diff --git
a/wpa_supplicant/ctrl_iface.c
b/wpa_supplicant/ctrl_iface.c
index
ae01173
..
494672c
100644
(file)
--- a/
wpa_supplicant/ctrl_iface.c
+++ b/
wpa_supplicant/ctrl_iface.c
@@
-204,6
+204,7
@@
static int wpa_supplicant_ctrl_iface_wps_pin(struct wpa_supplicant *wpa_s,
}
}
+#ifdef CONFIG_WPS_OOB
static int wpa_supplicant_ctrl_iface_wps_oob(struct wpa_supplicant *wpa_s,
char *cmd)
{
static int wpa_supplicant_ctrl_iface_wps_oob(struct wpa_supplicant *wpa_s,
char *cmd)
{
@@
-221,6
+222,7
@@
static int wpa_supplicant_ctrl_iface_wps_oob(struct wpa_supplicant *wpa_s,
return wpas_wps_start_oob(wpa_s, cmd, path, method);
}
return wpas_wps_start_oob(wpa_s, cmd, path, method);
}
+#endif /* CONFIG_WPS_OOB */
static int wpa_supplicant_ctrl_iface_wps_reg(struct wpa_supplicant *wpa_s,
static int wpa_supplicant_ctrl_iface_wps_reg(struct wpa_supplicant *wpa_s,
@@
-1602,9
+1604,11
@@
char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
reply_len = wpa_supplicant_ctrl_iface_wps_pin(wpa_s, buf + 8,
reply,
reply_size);
reply_len = wpa_supplicant_ctrl_iface_wps_pin(wpa_s, buf + 8,
reply,
reply_size);
+#ifdef CONFIG_WPS_OOB
} else if (os_strncmp(buf, "WPS_OOB ", 8) == 0) {
if (wpa_supplicant_ctrl_iface_wps_oob(wpa_s, buf + 8))
reply_len = -1;
} else if (os_strncmp(buf, "WPS_OOB ", 8) == 0) {
if (wpa_supplicant_ctrl_iface_wps_oob(wpa_s, buf + 8))
reply_len = -1;
+#endif /* CONFIG_WPS_OOB */
} else if (os_strncmp(buf, "WPS_REG ", 8) == 0) {
if (wpa_supplicant_ctrl_iface_wps_reg(wpa_s, buf + 8))
reply_len = -1;
} else if (os_strncmp(buf, "WPS_REG ", 8) == 0) {
if (wpa_supplicant_ctrl_iface_wps_reg(wpa_s, buf + 8))
reply_len = -1;
diff --git
a/wpa_supplicant/wpa_cli.c
b/wpa_supplicant/wpa_cli.c
index
bae0d6f
..
d6055e9
100644
(file)
--- a/
wpa_supplicant/wpa_cli.c
+++ b/
wpa_supplicant/wpa_cli.c
@@
-446,6
+446,7
@@
static int wpa_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[])
}
}
+#ifdef CONFIG_WPS_OOB
static int wpa_cli_cmd_wps_oob(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
char cmd[256];
static int wpa_cli_cmd_wps_oob(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
char cmd[256];
@@
-468,6
+469,7
@@
static int wpa_cli_cmd_wps_oob(struct wpa_ctrl *ctrl, int argc, char *argv[])
}
return wpa_ctrl_command(ctrl, cmd);
}
}
return wpa_ctrl_command(ctrl, cmd);
}
+#endif /* CONFIG_WPS_OOB */
static int wpa_cli_cmd_wps_reg(struct wpa_ctrl *ctrl, int argc, char *argv[])
static int wpa_cli_cmd_wps_reg(struct wpa_ctrl *ctrl, int argc, char *argv[])
@@
-1282,9
+1284,11
@@
static struct wpa_cli_cmd wpa_cli_commands[] = {
cli_cmd_flag_sensitive,
"<BSSID> [PIN] = start WPS PIN method (returns PIN, if not "
"hardcoded)" },
cli_cmd_flag_sensitive,
"<BSSID> [PIN] = start WPS PIN method (returns PIN, if not "
"hardcoded)" },
+#ifdef CONFIG_WPS_OOB
{ "wps_oob", wpa_cli_cmd_wps_oob,
cli_cmd_flag_sensitive,
"<OOB_DEV_TYPE> <OOB_PATH> <OOB_METHOD> = start WPS OOB" },
{ "wps_oob", wpa_cli_cmd_wps_oob,
cli_cmd_flag_sensitive,
"<OOB_DEV_TYPE> <OOB_PATH> <OOB_METHOD> = start WPS OOB" },
+#endif /* CONFIG_WPS_OOB */
{ "wps_reg", wpa_cli_cmd_wps_reg,
cli_cmd_flag_sensitive,
"<BSSID> <AP PIN> = start WPS Registrar to configure an AP" },
{ "wps_reg", wpa_cli_cmd_wps_reg,
cli_cmd_flag_sensitive,
"<BSSID> <AP PIN> = start WPS Registrar to configure an AP" },
diff --git
a/wpa_supplicant/wps_supplicant.c
b/wpa_supplicant/wps_supplicant.c
index
3e1d650
..
67ae1ac
100644
(file)
--- a/
wpa_supplicant/wps_supplicant.c
+++ b/
wpa_supplicant/wps_supplicant.c
@@
-462,6
+462,7
@@
int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
}
}
+#ifdef CONFIG_WPS_OOB
int wpas_wps_start_oob(struct wpa_supplicant *wpa_s, char *device_type,
char *path, char *method)
{
int wpas_wps_start_oob(struct wpa_supplicant *wpa_s, char *device_type,
char *path, char *method)
{
@@
-506,6
+507,7
@@
int wpas_wps_start_oob(struct wpa_supplicant *wpa_s, char *device_type,
return 0;
}
return 0;
}
+#endif /* CONFIG_WPS_OOB */
int wpas_wps_start_reg(struct wpa_supplicant *wpa_s, const u8 *bssid,
int wpas_wps_start_reg(struct wpa_supplicant *wpa_s, const u8 *bssid,