Browse Source

SAE: Check random_get_bytes() return value

Signed-hostap: Jouni Malinen <j@w1.fi>
Jouni Malinen 12 years ago
parent
commit
a50414c322
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/ap/ieee802_11.c

+ 3 - 2
src/ap/ieee802_11.c

@@ -416,8 +416,9 @@ static struct wpabuf * auth_build_token_req(struct hostapd_data *hapd,
 	os_get_time(&t);
 	os_get_time(&t);
 	if (hapd->last_sae_token_key_update == 0 ||
 	if (hapd->last_sae_token_key_update == 0 ||
 	    t.sec > hapd->last_sae_token_key_update + 60) {
 	    t.sec > hapd->last_sae_token_key_update + 60) {
-		random_get_bytes(hapd->sae_token_key,
-				 sizeof(hapd->sae_token_key));
+		if (random_get_bytes(hapd->sae_token_key,
+				     sizeof(hapd->sae_token_key)) < 0)
+			return NULL;
 		wpa_hexdump(MSG_DEBUG, "SAE: Updated token key",
 		wpa_hexdump(MSG_DEBUG, "SAE: Updated token key",
 			    hapd->sae_token_key, sizeof(hapd->sae_token_key));
 			    hapd->sae_token_key, sizeof(hapd->sae_token_key));
 		hapd->last_sae_token_key_update = t.sec;
 		hapd->last_sae_token_key_update = t.sec;