diff options
author | Jouni Malinen <j@w1.fi> | 2012-06-27 20:54:56 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2012-06-27 21:22:13 +0300 |
commit | bb45b6d79ae71274e7f8936a73cc9926c914bc10 (patch) | |
tree | e599d1e24af7aa926c4dc4ebe538270a077daf19 /src/wps | |
parent | 3f2c8ba6d39d5c5184a8fdd121998dd0d7629f1f (diff) | |
download | external_wpa_supplicant_8_ti-bb45b6d79ae71274e7f8936a73cc9926c914bc10.zip external_wpa_supplicant_8_ti-bb45b6d79ae71274e7f8936a73cc9926c914bc10.tar.gz external_wpa_supplicant_8_ti-bb45b6d79ae71274e7f8936a73cc9926c914bc10.tar.bz2 |
WPS: Add new mechanism for communicating NFC tag read events
hostapd ctrl_iface can now be used to deliver payload from read
operation of an NFC tag. This allows operations without having to have
low-level NFC code within hostapd. For now, the new wps_nfc_tag_read
command can be used with NFC password tokens for the case where the AP
has an NFC device that is used to read an NFC tag from the station
Enrollee.
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/wps')
-rw-r--r-- | src/wps/wps.h | 5 | ||||
-rw-r--r-- | src/wps/wps_registrar.c | 41 |
2 files changed, 44 insertions, 2 deletions
diff --git a/src/wps/wps.h b/src/wps/wps.h index 48ba76f..66fccd7 100644 --- a/src/wps/wps.h +++ b/src/wps/wps.h @@ -1,6 +1,6 @@ /* * Wi-Fi Protected Setup - * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi> + * Copyright (c) 2007-2012, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. @@ -797,6 +797,9 @@ int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr, char *buf, size_t buflen); int wps_registrar_config_ap(struct wps_registrar *reg, struct wps_credential *cred); +int wps_registrar_add_nfc_password_token(struct wps_registrar *reg, + const u8 *oob_dev_pw, + size_t oob_dev_pw_len); int wps_build_credential_wrap(struct wpabuf *msg, const struct wps_credential *cred); diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index 2c4b520..1bef660 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -1,6 +1,6 @@ /* * Wi-Fi Protected Setup - Registrar - * Copyright (c) 2008-2009, Jouni Malinen <j@w1.fi> + * Copyright (c) 2008-2012, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. @@ -3366,3 +3366,42 @@ int wps_registrar_config_ap(struct wps_registrar *reg, return -1; } + + +#ifdef CONFIG_WPS_NFC +int wps_registrar_add_nfc_password_token(struct wps_registrar *reg, + const u8 *oob_dev_pw, + size_t oob_dev_pw_len) +{ + const u8 *pos, *hash, *dev_pw; + u16 id; + size_t dev_pw_len; + + if (oob_dev_pw_len < WPS_OOB_PUBKEY_HASH_LEN + 2 + + WPS_OOB_DEVICE_PASSWORD_MIN_LEN || + oob_dev_pw_len > WPS_OOB_PUBKEY_HASH_LEN + 2 + + WPS_OOB_DEVICE_PASSWORD_LEN) + return -1; + + hash = oob_dev_pw; + pos = oob_dev_pw + WPS_OOB_PUBKEY_HASH_LEN; + id = WPA_GET_BE16(pos); + dev_pw = pos + 2; + dev_pw_len = oob_dev_pw + oob_dev_pw_len - dev_pw; + + wpa_printf(MSG_DEBUG, "WPS: Add NFC Password Token for Password ID %u", + id); + + wpa_hexdump(MSG_DEBUG, "WPS: Public Key Hash", + hash, WPS_OOB_PUBKEY_HASH_LEN); + wpa_hexdump_key(MSG_DEBUG, "WPS: Device Password", dev_pw, dev_pw_len); + + reg->wps->oob_dev_pw_id = id; + wpabuf_free(reg->wps->oob_conf.pubkey_hash); + reg->wps->oob_conf.pubkey_hash = wpabuf_alloc_copy( + hash, WPS_OOB_PUBKEY_HASH_LEN); + if (reg->wps->oob_conf.pubkey_hash == NULL) + return -1; + return wps_registrar_add_pin(reg, NULL, NULL, dev_pw, dev_pw_len, 300); +} +#endif /* CONFIG_WPS_NFC */ |