aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorNick Lowe <nick.lowe@lugatech.com>2016-02-09 14:47:47 (GMT)
committerJouni Malinen <j@w1.fi>2016-02-19 16:44:40 (GMT)
commit98a516eae8260e6fd5c48ddecf8d006285da7389 (patch)
treec4e476cd4f11428a490cbd55d709cf88aff7a702 /wpa_supplicant/wps_supplicant.c
parentf441e5af777c01f8649374fe91ff135e080aa959 (diff)
downloadhostap-98a516eae8260e6fd5c48ddecf8d006285da7389.zip
hostap-98a516eae8260e6fd5c48ddecf8d006285da7389.tar.gz
hostap-98a516eae8260e6fd5c48ddecf8d006285da7389.tar.bz2
WPS: Use only os_get_random() for PIN generation
Remove the fallback dependency on os_random() when generating a WPS pin. This is exceptionally unlikely to ever be called as the call to os_get_random() is unlikely to fail. The intention is to facilitate future removal of os_random() as it uses a low quality PRNG. Signed-off-by: Nick Lowe <nick.lowe@lugatech.com>
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index a39897d..07452ad 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1236,7 +1236,10 @@ static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s,
os_snprintf(val, sizeof(val), "\"dev_pw_id=%u%s\"",
dev_pw_id, hash);
} else {
- rpin = wps_generate_pin();
+ if (wps_generate_pin(&rpin) < 0) {
+ wpa_printf(MSG_DEBUG, "WPS: Could not generate PIN");
+ return -1;
+ }
os_snprintf(val, sizeof(val), "\"pin=%08d dev_pw_id=%u%s\"",
rpin, dev_pw_id, hash);
}