aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorMasashi Honma <honma@ictec.co.jp>2009-03-06 14:16:22 (GMT)
committerJouni Malinen <j@w1.fi>2009-03-06 14:16:22 (GMT)
commite1ee6b600bf09dfe1bd5b659c6c1e3d9b59243d2 (patch)
tree43139febacd65b7513cdaeefdcef96a23fe40686 /hostapd
parent7cc1b6c900d79e6051116f4aed55b84d404c49f1 (diff)
downloadhostap-e1ee6b600bf09dfe1bd5b659c6c1e3d9b59243d2.zip
hostap-e1ee6b600bf09dfe1bd5b659c6c1e3d9b59243d2.tar.gz
hostap-e1ee6b600bf09dfe1bd5b659c6c1e3d9b59243d2.tar.bz2
WPS: Add support for NFC out-of-band mechanism
The new file wps_nfc.c and ndef.c implements NFC device independent operation, wps_nfc_pn531.c implements NFC device dependent operation. This patch is only for the following use case: - Enrollee = wpa_supplicant - Registrar = hostapd internal Registrar Following NFC methods can be used: - Enrollee PIN with NFC - Registrar PIN with NFC - unencrypted credential with NFC Encrypted credentials are not supported. Enrollee side operation: Registrar side operation: Example configuration. CONFIG_WPS=y CONFIG_WPS_NFC=y CONFIG_WPS_NFC_PN531=y I used NFC device "NXP PN531". The NFC device access method is confidential, so I used outer library. Please download below files from https://www.saice-wpsnfc.bz/index.php [WPS NFC Library] WpsNfcLibrary/WpsNfc.h WpsNfcLibrary/WpsNfcType.h WpsNfcLibrary/WpsNfcVersion.h WpsNfcLibrary/linux/libnfc_mapping_pn53x.dll WpsNfcLibrary/linux/wpsnfc.dll [NFC Reader/Writer Kernel Driver] NFCKernelDriver-1.0.3/linux/kobj/sonyrw.ko <WiFi test> The hostapd/wpa_supplicant with this patch passed below tests on "Wi-Fi WPS Test Plan Version 1.6". 4.2.5 Add device using NFC Method with password token (I used SONY STA instead of NXP STA.) 4.2.6 Add device using NFC Method with configuration token 5.1.9 Add to AP using NFC Method with password token through internal registrar (I used SONY AP instead of NXP AP.) 5.1.10 Add to AP using NFC Method with configuration token through internal registrar
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/Makefile15
-rw-r--r--hostapd/ctrl_iface.c8
-rw-r--r--hostapd/hostapd_cli.c23
-rw-r--r--hostapd/wps_hostapd.c3
-rw-r--r--hostapd/wps_hostapd.h2
5 files changed, 39 insertions, 12 deletions
diff --git a/hostapd/Makefile b/hostapd/Makefile
index 0dbece6..daa971d 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -324,6 +324,21 @@ OBJS += ../src/wps/wps_ufd.o
NEED_WPS_OOB=y
endif
+ifdef CONFIG_WPS_NFC
+CFLAGS += -DCONFIG_WPS_NFC
+OBJS += ../src/wps/ndef.o
+OBJS += ../src/wps/wps_nfc.o
+NEED_WPS_OOB=y
+ifdef CONFIG_WPS_NFC_PN531
+PN531_PATH = /usr/local/src/nfc
+CFLAGS += -DCONFIG_WPS_NFC_PN531
+CFLAGS += -I${PN531_PATH}/inc
+OBJS += ../src/wps/wps_nfc_pn531.o
+LIBS += ${PN531_PATH}/lib/wpsnfc.dll
+LIBS += ${PN531_PATH}/lib/libnfc_mapping_pn53x.dll
+endif
+endif
+
ifdef NEED_WPS_OOB
CFLAGS += -DCONFIG_WPS_OOB
endif
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 5d85558..d24c4af 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -257,7 +257,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;
+ char *path, *method, *name;
path = os_strchr(txt, ' ');
if (path == NULL)
@@ -269,7 +269,11 @@ static int hostapd_ctrl_iface_wps_oob(struct hostapd_data *hapd, char *txt)
return -1;
*method++ = '\0';
- return hostapd_wps_start_oob(hapd, txt, path, method);
+ name = os_strchr(method, ' ');
+ if (name != NULL)
+ *name++ = '\0';
+
+ return hostapd_wps_start_oob(hapd, txt, path, method, name);
}
#endif /* CONFIG_WPS_OOB */
#endif /* CONFIG_WPS */
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index c32d9d3..340e9c3 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -287,17 +287,24 @@ static int hostapd_cli_cmd_wps_oob(struct wpa_ctrl *ctrl, int argc,
char cmd[256];
int res;
- if (argc != 3) {
- printf("Invalid WPS_OOB command: need three arguments:\n"
- "- OOB_DEV_TYPE: use 'ufd'\n"
- "- OOB_PATH: path of OOB device like '/mnt'\n"
- "- OOB_METHOD: OOB method 'pin-e' or 'pin-r', "
- "'cred'\n");
+ if (argc != 3 && argc != 4) {
+ printf("Invalid WPS_OOB command: need three or four "
+ "arguments:\n"
+ "- DEV_TYPE: use 'ufd' or 'nfc'\n"
+ "- PATH: path of OOB device like '/mnt'\n"
+ "- METHOD: OOB method 'pin-e' or 'pin-r', "
+ "'cred'\n"
+ "- DEV_NAME: (only for NFC) device name like "
+ "'pn531'\n");
return -1;
}
- res = os_snprintf(cmd, sizeof(cmd), "WPS_OOB %s %s %s",
- argv[0], argv[1], argv[2]);
+ if (argc == 3)
+ res = os_snprintf(cmd, sizeof(cmd), "WPS_OOB %s %s %s",
+ argv[0], argv[1], argv[2]);
+ else
+ res = os_snprintf(cmd, sizeof(cmd), "WPS_OOB %s %s %s %s",
+ argv[0], argv[1], argv[2], argv[3]);
if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
printf("Too long WPS_OOB command.\n");
return -1;
diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c
index 9def50a..39f67ee 100644
--- a/hostapd/wps_hostapd.c
+++ b/hostapd/wps_hostapd.c
@@ -706,7 +706,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)
+ char *path, char *method, char *name)
{
struct wps_context *wps = hapd->wps;
struct oob_device_data *oob_dev;
@@ -715,6 +715,7 @@ int hostapd_wps_start_oob(struct hostapd_data *hapd, char *device_type,
if (oob_dev == NULL)
return -1;
oob_dev->device_path = path;
+ oob_dev->device_name = name;
wps->oob_conf.oob_method = wps_get_oob_method(method);
if (wps->oob_conf.oob_method == OOB_METHOD_DEV_PWD_R) {
diff --git a/hostapd/wps_hostapd.h b/hostapd/wps_hostapd.h
index 0d39797..9d94a4f 100644
--- a/hostapd/wps_hostapd.h
+++ b/hostapd/wps_hostapd.h
@@ -24,7 +24,7 @@ int hostapd_wps_add_pin(struct hostapd_data *hapd, const char *uuid,
const char *pin);
int hostapd_wps_button_pushed(struct hostapd_data *hapd);
int hostapd_wps_start_oob(struct hostapd_data *hapd, char *device_type,
- char *path, char *method);
+ char *path, char *method, char *name);
void hostapd_wps_probe_req_rx(struct hostapd_data *hapd, const u8 *addr,
const u8 *ie, size_t ie_len);