Skip to content

Commit

Permalink
RAND_load_file(): return error if reseeding failed
Browse files Browse the repository at this point in the history
The failure of RAND_load_file was only noticed because of the
heap corruption which was reported in openssl#7499 and fixed in commit
5b4cb38. To prevent this in the future, RAND_load_file()
now explicitly checks RAND_status() and reports an error if it
fails.

Related-to: openssl#7449

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from openssl#7456)
  • Loading branch information
mspncp committed Oct 26, 2018
1 parent 8529945 commit 13ce862
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crypto/rand/randfile.c
Expand Up @@ -148,6 +148,12 @@ int RAND_load_file(const char *file, long bytes)

OPENSSL_cleanse(buf, sizeof(buf));
fclose(in);
if (!RAND_status()) {
RANDerr(RAND_F_RAND_LOAD_FILE, RAND_R_RESEED_ERROR);
ERR_add_error_data(2, "Filename=", file);
return -1;
}

return ret;
}

Expand Down

0 comments on commit 13ce862

Please sign in to comment.