]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Check random_get_bytes() output even in testing case
authorJouni Malinen <j@w1.fi>
Sun, 23 Feb 2025 14:11:31 +0000 (16:11 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 23 Feb 2025 14:11:31 +0000 (16:11 +0200)
Make this a bit more consistent even for CONFIG_TESTING_OPTIONS=y builds
to reduce warnings from static analyzers.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/wpa_auth.c

index fdeac6278ac561888c5c5a1fa20be384ca9f89d5..80f9984cce4a1bf43ca99739b323a2efd7210223 100644 (file)
@@ -2084,8 +2084,9 @@ void __wpa_send_eapol(struct wpa_authenticator *wpa_auth,
                os_memcpy(key->key_rsc, key_rsc, WPA_KEY_RSC_LEN);
 
 #ifdef CONFIG_TESTING_OPTIONS
-       if (conf->eapol_key_reserved_random)
-               random_get_bytes(key->key_id, sizeof(key->key_id));
+       if (conf->eapol_key_reserved_random &&
+           random_get_bytes(key->key_id, sizeof(key->key_id)) < 0)
+               os_memset(key->key_id, 0x11, sizeof(key->key_id));
 #endif /* CONFIG_TESTING_OPTIONS */
 
        if (kde && !encr) {