Switch from using os_random() to using os_get_random(...) in wpas_auth_failed(...) The intention is to facilitate the future removal of os_random(). os_random() uses a low quality PRNG which we should avoid using outright unless there is a compelling performance justification to do so. Signed-off-by: Nick Lowe <nick.lowe@xxxxxxxxxxxx> --- wpa_supplicant/wpa_supplicant.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c3c1f14..ca0566a 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -5669,7 +5669,7 @@ int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s) void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason) { struct wpa_ssid *ssid = wpa_s->current_ssid; - int dur; + int dur, r; struct os_reltime now; if (ssid == NULL) { @@ -5710,8 +5710,9 @@ void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason) dur = 10; if (ssid->auth_failures > 1 && - wpa_key_mgmt_wpa_ieee8021x(ssid->key_mgmt)) - dur += os_random() % (ssid->auth_failures * 10); + wpa_key_mgmt_wpa_ieee8021x(ssid->key_mgmt) && + os_get_random((u8 *) &r, sizeof(r)) >= 0) + dur += r % (ssid->auth_failures * 10); os_get_reltime(&now); if (now.sec + dur <= ssid->disabled_until.sec) -- 2.5.0
From e9293e7622f54cfaff942362757d537e18a4701f Mon Sep 17 00:00:00 2001 From: Nick Lowe <nick.lowe@xxxxxxxxxxxx> Date: Sun, 14 Feb 2016 14:02:19 +0000 Subject: [PATCH 09/10] Switch from using os_random() to using os_get_random(...) in wpas_auth_failed(...) The intention is to facilitate the future removal of os_random(). os_random() uses a low quality PRNG which we should avoid using outright unless there is a compelling performance justification to do so. Signed-off-by: Nick Lowe <nick.lowe@xxxxxxxxxxxx> --- wpa_supplicant/wpa_supplicant.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c3c1f14..ca0566a 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -5669,7 +5669,7 @@ int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s) void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason) { struct wpa_ssid *ssid = wpa_s->current_ssid; - int dur; + int dur, r; struct os_reltime now; if (ssid == NULL) { @@ -5710,8 +5710,9 @@ void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason) dur = 10; if (ssid->auth_failures > 1 && - wpa_key_mgmt_wpa_ieee8021x(ssid->key_mgmt)) - dur += os_random() % (ssid->auth_failures * 10); + wpa_key_mgmt_wpa_ieee8021x(ssid->key_mgmt) && + os_get_random((u8 *) &r, sizeof(r)) >= 0) + dur += r % (ssid->auth_failures * 10); os_get_reltime(&now); if (now.sec + dur <= ssid->disabled_until.sec) -- 2.5.0
_______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap