diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-04-03 12:53:51 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-04-14 16:48:27 +0200 |
commit | 3ad6030948ac999de165f6185116459d74644e8d (patch) | |
tree | cd1f05f67890bc55b9cab065b963dfa5c7ded721 /apps/lib/app_rand.c | |
parent | 456541f0b7c7a4ca8c1c99740fff1bedcc4c9244 (diff) |
APPS: make apps strict on app_RAND_load() and app_RAND_write() failure
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14840)
Diffstat (limited to 'apps/lib/app_rand.c')
-rw-r--r-- | apps/lib/app_rand.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/lib/app_rand.c b/apps/lib/app_rand.c index c521979570..e38d3a72fc 100644 --- a/apps/lib/app_rand.c +++ b/apps/lib/app_rand.c @@ -63,9 +63,6 @@ int app_RAND_load(void) char *p; int i, ret = 1; - if (randfiles == NULL) - return 1; - for (i = 0; i < sk_OPENSSL_STRING_num(randfiles); i++) { p = sk_OPENSSL_STRING_value(randfiles, i); if (!loadfiles(p)) @@ -75,16 +72,20 @@ int app_RAND_load(void) return ret; } -void app_RAND_write(void) +int app_RAND_write(void) { + int ret = 1; + if (save_rand_file == NULL) - return; + return 1; if (RAND_write_file(save_rand_file) == -1) { BIO_printf(bio_err, "Cannot write random bytes:\n"); ERR_print_errors(bio_err); + ret = 0; } OPENSSL_free(save_rand_file); save_rand_file = NULL; + return ret; } |