From: Jouni Malinen Date: Sun, 23 Feb 2025 14:11:31 +0000 (+0200) Subject: Check random_get_bytes() output even in testing case X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb3a47247ee08091040e616d2fc25aeaa755730d;p=thirdparty%2Fhostap.git Check random_get_bytes() output even in testing case Make this a bit more consistent even for CONFIG_TESTING_OPTIONS=y builds to reduce warnings from static analyzers. Signed-off-by: Jouni Malinen --- diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index fdeac6278..80f9984cc 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -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) {