aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_cli.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2010-09-23 10:30:52 -0700
committerJouni Malinen <j@w1.fi>2010-09-23 10:30:52 -0700
commit3981cb3cb81641813b1f51292032f2225ccdd70b (patch)
treebf6e7f50a8fcddc8b7e16ccc1fe4923464f51b68 /wpa_supplicant/wpa_cli.c
parentfa37511fa7e9d6a8f4fdaa8ec2df4af71bac7941 (diff)
downloadexternal_wpa_supplicant_8_ti-3981cb3cb81641813b1f51292032f2225ccdd70b.zip
external_wpa_supplicant_8_ti-3981cb3cb81641813b1f51292032f2225ccdd70b.tar.gz
external_wpa_supplicant_8_ti-3981cb3cb81641813b1f51292032f2225ccdd70b.tar.bz2
WPS: Add wps_check_pin command for processing PIN from user input
UIs can use this command to process a PIN entered by a user and to validate the checksum digit (if present).
Diffstat (limited to 'wpa_supplicant/wpa_cli.c')
-rw-r--r--wpa_supplicant/wpa_cli.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 855f720..00fb0dc 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -615,6 +615,32 @@ static int wpa_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[])
}
+static int wpa_cli_cmd_wps_check_pin(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ char cmd[256];
+ int res;
+
+ if (argc != 1 && argc != 2) {
+ printf("Invalid WPS_CHECK_PIN command: needs one argument:\n"
+ "- PIN to be verified\n");
+ return -1;
+ }
+
+ if (argc == 2)
+ res = os_snprintf(cmd, sizeof(cmd), "WPS_CHECK_PIN %s %s",
+ argv[0], argv[1]);
+ else
+ res = os_snprintf(cmd, sizeof(cmd), "WPS_CHECK_PIN %s",
+ argv[0]);
+ if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
+ printf("Too long WPS_CHECK_PIN command.\n");
+ return -1;
+ }
+ return wpa_ctrl_command(ctrl, cmd);
+}
+
+
static int wpa_cli_cmd_wps_cancel(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@ -2271,6 +2297,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
cli_cmd_flag_sensitive,
"<BSSID> [PIN] = start WPS PIN method (returns PIN, if not "
"hardcoded)" },
+ { "wps_check_pin", wpa_cli_cmd_wps_check_pin,
+ cli_cmd_flag_sensitive,
+ "<PIN> = verify PIN checksum" },
{ "wps_cancel", wpa_cli_cmd_wps_cancel, cli_cmd_flag_none,
"Cancels the pending WPS operation" },
#ifdef CONFIG_WPS_OOB