goto end;
app_RAND_load_conf(conf, BASE_SECTION);
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
f = NCONF_get_string(conf, section, STRING_MASK);
if (f == NULL)
if (ret <= 0)
goto err;
ret = 0;
+ if (!app_RAND_load())
+ goto err;
if (opt_batch)
set_base_ui_method(UI_null());
break;
}
}
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (digestname != NULL) {
if (!opt_md(digestname, &sign_md))
goto end;
BIO_printf(bio_err, "%s: Can only sign or verify one file.\n", prog);
goto end;
}
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (digestname != NULL) {
if (!opt_md(digestname, &md))
goto opthelp;
} else if (argc != 0) {
goto opthelp;
}
- app_RAND_load();
-
+ if (!app_RAND_load())
+ goto end;
if (g && !num)
num = DEFBITS;
} else if (argc != 0) {
goto opthelp;
}
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
/* generate a key */
numbits = num;
if (argc != 0)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
private = genkey ? 1 : 0;
in = bio_open_default(infile, 'r', informat);
argc = opt_num_rest();
if (argc != 0)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
/* Get the cipher name, either from progname (if set) or flag. */
if (ciphername != NULL) {
goto opthelp;
dsaparams = argv[0];
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (ciphername != NULL) {
if (!opt_cipher(ciphername, &enc))
goto end;
goto opthelp;
}
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
private = 1;
if (ciphername != NULL) {
if (!opt_cipher(ciphername, &enc))
# define _UC(c) ((unsigned char)(c))
void app_RAND_load_conf(CONF *c, const char *section);
-void app_RAND_write(void);
+int app_RAND_write(void);
int app_RAND_load(void);
extern char *default_config_file; /* may be "" */
# define OPT_R_OPTIONS \
OPT_SECTION("Random state"), \
- {"rand", OPT_R_RAND, 's', "Load the file(s) into the random number generator"}, \
+ {"rand", OPT_R_RAND, 's', "Load the given file(s) into the random number generator"}, \
{"writerand", OPT_R_WRITERAND, '>', "Write random data to the specified file"}
# define OPT_R_CASES \
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))
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;
}
OPENSSL_free(default_config_file);
lh_FUNCTION_free(prog);
OPENSSL_free(arg.argv);
- app_RAND_write();
+ if (!app_RAND_write())
+ ret = EXIT_FAILURE;
BIO_free(bio_in);
BIO_free_all(bio_out);
passwds = argv;
}
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (mode == passwd_unset) {
/* use default */
mode = passwd_md5;
if (argc != 0)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (ciphername != NULL) {
if (!opt_cipher(ciphername, &enc))
goto opthelp;
goto opthelp;
private = 1;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (ciphername != NULL) {
if (!opt_cipher(ciphername, &cipher))
goto opthelp;
if (argc != 0)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
if (rawin && pkey_op != EVP_PKEY_OP_SIGN && pkey_op != EVP_PKEY_OP_VERIFY) {
BIO_printf(bio_err,
goto opthelp;
}
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
out = bio_open_default(outfile, 'w', format);
if (out == NULL)
goto end;
if (argc != 0)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (digestname != NULL) {
if (!opt_md(digestname, &md_alg))
goto opthelp;
if (argc != 0)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (need_priv && (key_type != KEY_PRIVKEY)) {
BIO_printf(bio_err, "A private key is needed for this operation\n");
goto end;
} else if (argc != 0) {
goto opthelp;
}
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
if (count4or6 >= 2) {
BIO_printf(bio_err, "%s: Can't use both -4 and -6\n", prog);
if (argc != 0)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
#ifndef OPENSSL_NO_NEXTPROTONEG
if (min_version == TLS1_3_VERSION && next_proto_neg_in != NULL) {
BIO_printf(bio_err, "Cannot supply -nextprotoneg with TLSv1.3\n");
argc = opt_num_rest();
argv = opt_rest();
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (digestname != NULL) {
if (!opt_md(digestname, &sign_md))
goto opthelp;
argc = opt_num_rest();
argv = opt_rest();
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
for (; *argv; argv++) {
const char *algo = *argv;
argc = opt_num_rest();
argv = opt_rest();
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (srpvfile != NULL && configfile != NULL) {
BIO_printf(bio_err,
"-srpvfile and -configfile cannot be specified together.\n");
if (argc != 0 || mode == OPT_ERR)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (digestname != NULL) {
if (!opt_md(digestname, &md))
goto opthelp;
if (argc != 0)
goto opthelp;
- app_RAND_load();
+ if (!app_RAND_load())
+ goto end;
+
if (digestname != NULL) {
if (!opt_md(digestname, &digest))
goto opthelp;