projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
typo
[openssl.git]
/
apps
/
gendsa.c
diff --git
a/apps/gendsa.c
b/apps/gendsa.c
index 75bd802e6634abe74fa860d298ad2b293b0dee50..f1e1f54b8a463f3f8d845b262d5041129151b586 100644
(file)
--- a/
apps/gendsa.c
+++ b/
apps/gendsa.c
@@
-84,10
+84,10
@@
OPTIONS gendsa_options[] = {
{"passout", OPT_PASSOUT, 's'},
{"rand", OPT_RAND, 's',
"Load the file(s) into the random number generator"},
{"passout", OPT_PASSOUT, 's'},
{"rand", OPT_RAND, 's',
"Load the file(s) into the random number generator"},
+ {"", OPT_CIPHER, '-', "Encrypt the output with any supported cipher"},
# ifndef OPENSSL_NO_ENGINE
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
# endif
# ifndef OPENSSL_NO_ENGINE
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
# endif
- {"", OPT_CIPHER, '-', "Encrypt the output with any supported cipher"},
{NULL}
};
{NULL}
};
@@
-99,7
+99,7
@@
int gendsa_main(int argc, char **argv)
char *inrand = NULL, *dsaparams = NULL;
char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;
OPTION_CHOICE o;
char *inrand = NULL, *dsaparams = NULL;
char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;
OPTION_CHOICE o;
- int ret = 1;
+ int ret = 1
, private = 0
;
prog = opt_init(argc, argv, gendsa_options);
while ((o = opt_next()) != OPT_EOF) {
prog = opt_init(argc, argv, gendsa_options);
while ((o = opt_next()) != OPT_EOF) {
@@
-133,6
+133,7
@@
int gendsa_main(int argc, char **argv)
}
argc = opt_num_rest();
argv = opt_rest();
}
argc = opt_num_rest();
argv = opt_rest();
+ private = 1;
if (argc != 1)
goto opthelp;
if (argc != 1)
goto opthelp;
@@
-143,7
+144,10
@@
int gendsa_main(int argc, char **argv)
goto end;
}
goto end;
}
- in = bio_open_default(dsaparams, "r");
+ if (!app_load_modules(NULL))
+ goto end;
+
+ in = bio_open_default(dsaparams, 'r', FORMAT_PEM);
if (in == NULL)
goto end2;
if (in == NULL)
goto end2;
@@
-154,7
+158,7
@@
int gendsa_main(int argc, char **argv)
BIO_free(in);
in = NULL;
BIO_free(in);
in = NULL;
- out = bio_open_
default(outfile, "w"
);
+ out = bio_open_
owner(outfile, FORMAT_PEM, private
);
if (out == NULL)
goto end2;
if (out == NULL)
goto end2;
@@
-172,6
+176,7
@@
int gendsa_main(int argc, char **argv)
app_RAND_write_file(NULL);
app_RAND_write_file(NULL);
+ assert(private);
if (!PEM_write_bio_DSAPrivateKey(out, dsa, enc, NULL, 0, NULL, passout))
goto end;
ret = 0;
if (!PEM_write_bio_DSAPrivateKey(out, dsa, enc, NULL, 0, NULL, passout))
goto end;
ret = 0;