mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 10:18:21 -05:00
WPS: Add support for NFC handover select generation with wpa_supplicant
When wpa_supplicant is controlling an AP mode interface, it can generate the alternative carrier record for NFC connection handover select message similarly to the way this is done in hostapd. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
7bfe27778b
commit
5ab9a6a53e
@ -860,6 +860,18 @@ struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
|
||||
return hostapd_wps_nfc_config_token(hapd, ndef);
|
||||
}
|
||||
|
||||
|
||||
struct wpabuf * wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
|
||||
int ndef)
|
||||
{
|
||||
struct hostapd_data *hapd;
|
||||
|
||||
if (wpa_s->ap_iface == NULL)
|
||||
return NULL;
|
||||
hapd = wpa_s->ap_iface->bss[0];
|
||||
return hostapd_wps_nfc_hs_cr(hapd, ndef);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
|
||||
|
@ -54,5 +54,7 @@ void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
|
||||
int offset);
|
||||
struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
|
||||
int ndef);
|
||||
struct wpabuf * wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
|
||||
int ndef);
|
||||
|
||||
#endif /* AP_H */
|
||||
|
@ -909,12 +909,13 @@ static int wpas_ctrl_nfc_get_handover_req(struct wpa_supplicant *wpa_s,
|
||||
|
||||
|
||||
static int wpas_ctrl_nfc_get_handover_sel_wps(struct wpa_supplicant *wpa_s,
|
||||
char *reply, size_t max_len)
|
||||
char *reply, size_t max_len,
|
||||
int ndef, int cr)
|
||||
{
|
||||
struct wpabuf *buf;
|
||||
int res;
|
||||
|
||||
buf = wpas_wps_nfc_handover_sel(wpa_s);
|
||||
buf = wpas_wps_nfc_handover_sel(wpa_s, ndef, cr);
|
||||
if (buf == NULL)
|
||||
return -1;
|
||||
|
||||
@ -934,18 +935,24 @@ static int wpas_ctrl_nfc_get_handover_sel(struct wpa_supplicant *wpa_s,
|
||||
size_t max_len)
|
||||
{
|
||||
char *pos;
|
||||
int ndef;
|
||||
|
||||
pos = os_strchr(cmd, ' ');
|
||||
if (pos == NULL)
|
||||
return -1;
|
||||
*pos++ = '\0';
|
||||
|
||||
if (os_strcmp(cmd, "NDEF") != 0)
|
||||
if (os_strcmp(cmd, "WPS") == 0)
|
||||
ndef = 0;
|
||||
else if (os_strcmp(cmd, "NDEF") == 0)
|
||||
ndef = 1;
|
||||
else
|
||||
return -1;
|
||||
|
||||
if (os_strcmp(pos, "WPS") == 0) {
|
||||
return wpas_ctrl_nfc_get_handover_sel_wps(wpa_s, reply,
|
||||
max_len);
|
||||
if (os_strcmp(pos, "WPS") == 0 || os_strcmp(pos, "WPS-CR") == 0) {
|
||||
return wpas_ctrl_nfc_get_handover_sel_wps(
|
||||
wpa_s, reply, max_len, ndef,
|
||||
os_strcmp(pos, "WPS-CR") == 0);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -2003,9 +2003,12 @@ struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s, int cr)
|
||||
}
|
||||
|
||||
|
||||
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s)
|
||||
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
|
||||
int ndef, int cr)
|
||||
{
|
||||
return NULL;
|
||||
if (!cr)
|
||||
return NULL;
|
||||
return wpas_ap_wps_nfc_handover_sel(wpa_s, ndef);
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,8 @@ int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *bssid);
|
||||
int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
|
||||
const struct wpabuf *data);
|
||||
struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s, int cr);
|
||||
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s);
|
||||
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
|
||||
int ndef, int cr);
|
||||
int wpas_wps_nfc_rx_handover_req(struct wpa_supplicant *wpa_s,
|
||||
const struct wpabuf *data);
|
||||
int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
|
||||
|
Loading…
Reference in New Issue
Block a user