mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 10:18:21 -05:00
WPS: Add 'wpa_cli wps_pin get' for generating random PINs
This can be used, e.g., in a UI to generate a PIN without starting WPS (or P2P) operation.
This commit is contained in:
parent
64fa840a97
commit
98aa7ca5d8
@ -127,6 +127,11 @@ This starts the WPS negotiation in the same way as above with the
|
||||
generated PIN.
|
||||
|
||||
|
||||
If a random PIN is needed for a user interface, "wpa_cli wps_pin get"
|
||||
can be used to generate a new PIN without starting WPS negotiation.
|
||||
This random PIN can then be passed as an argument to another wps_pin
|
||||
call when the actual operation should be started.
|
||||
|
||||
If the client design wants to support optional WPS PBC mode, this can
|
||||
be enabled by either a physical button in the client device or a
|
||||
virtual button in the user interface. The PBC operation requires that
|
||||
|
@ -340,7 +340,10 @@ static int wpa_supplicant_ctrl_iface_wps_pin(struct wpa_supplicant *wpa_s,
|
||||
|
||||
if (os_strcmp(cmd, "any") == 0)
|
||||
_bssid = NULL;
|
||||
else if (hwaddr_aton(cmd, bssid)) {
|
||||
else if (os_strcmp(cmd, "get") == 0) {
|
||||
ret = wps_generate_pin();
|
||||
goto done;
|
||||
} else if (hwaddr_aton(cmd, bssid)) {
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PIN: invalid BSSID '%s'",
|
||||
cmd);
|
||||
return -1;
|
||||
@ -367,6 +370,7 @@ static int wpa_supplicant_ctrl_iface_wps_pin(struct wpa_supplicant *wpa_s,
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
done:
|
||||
/* Return the generated PIN */
|
||||
ret = os_snprintf(buf, buflen, "%08d", ret);
|
||||
if (ret < 0 || (size_t) ret >= buflen)
|
||||
|
Loading…
Reference in New Issue
Block a user