summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-07-05 16:58:48 +0200
committerRich Salz <rsalz@openssl.org>2017-07-17 01:20:45 +0200
commit3ee1eac27a2e3120fbdc60e12db091c082b8de21 (patch)
treec34ee07aa725e2019dbce1f7621702eb2bb5fd69 /crypto
parentDon't use "version" in "OpenSSL Version 1.1.0" etc (diff)
downloadopenssl-3ee1eac27a2e3120fbdc60e12db091c082b8de21.tar.xz
openssl-3ee1eac27a2e3120fbdc60e12db091c082b8de21.zip
Standardize apps use of -rand, etc.
Standardized the -rand flag and added a new one: -rand file... Always reads the specified files -writerand file Always writes to the file on exit For apps that use a config file, the RANDFILE config parameter reads the file at startup (to seed the RNG) and write to it on exit if the -writerand flag isn't used. Ensured that every app that took -rand also took -writerand, and made sure all of that agreed with all the documentation. Fix error reporting in write_file and -rand Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/3862)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/rand/randfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c
index 4005f7805e..904653f3bb 100644
--- a/crypto/rand/randfile.c
+++ b/crypto/rand/randfile.c
@@ -175,8 +175,11 @@ int RAND_write_file(const char *file)
if (out == NULL)
out = openssl_fopen(file, "wb");
- if (out == NULL)
+ if (out == NULL) {
+ RANDerr(RAND_F_RAND_LOAD_FILE, RAND_R_CANNOT_OPEN_FILE);
+ ERR_add_error_data(2, "Filename=", file);
return -1;
+ }
#if !defined(NO_CHMOD) && !defined(OPENSSL_NO_POSIX_IO)
/*