projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correct a couple of command errors.
[openssl.git]
/
apps
/
gendsa.c
diff --git
a/apps/gendsa.c
b/apps/gendsa.c
index 44d2b42a0579213b0f6d8301e6c22142fea91e53..d69a93da45127f13b2f6b46f26ceb0eeca45b42c 100644
(file)
--- a/
apps/gendsa.c
+++ b/
apps/gendsa.c
@@
-73,12
+73,15
@@
#undef PROG
#define PROG gendsa_main
#undef PROG
#define PROG gendsa_main
+int MAIN(int, char **);
+
int MAIN(int argc, char **argv)
{
DSA *dsa=NULL;
int ret=1;
char *outfile=NULL;
char *inrand=NULL,*dsaparams=NULL;
int MAIN(int argc, char **argv)
{
DSA *dsa=NULL;
int ret=1;
char *outfile=NULL;
char *inrand=NULL,*dsaparams=NULL;
+ char *passargout = NULL, *passout = NULL;
BIO *out=NULL,*in=NULL;
EVP_CIPHER *enc=NULL;
BIO *out=NULL,*in=NULL;
EVP_CIPHER *enc=NULL;
@@
-98,6
+101,11
@@
int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
outfile= *(++argv);
}
if (--argc < 1) goto bad;
outfile= *(++argv);
}
+ else if (strcmp(*argv,"-passout") == 0)
+ {
+ if (--argc < 1) goto bad;
+ passargout= *(++argv);
+ }
else if (strcmp(*argv,"-rand") == 0)
{
if (--argc < 1) goto bad;
else if (strcmp(*argv,"-rand") == 0)
{
if (--argc < 1) goto bad;
@@
-145,6
+153,12
@@
bad:
goto end;
}
goto end;
}
+ if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
+ BIO_printf(bio_err, "Error getting password\n");
+ goto end;
+ }
+
+
in=BIO_new(BIO_s_file());
if (!(BIO_read_filename(in,dsaparams)))
{
in=BIO_new(BIO_s_file());
if (!(BIO_read_filename(in,dsaparams)))
{
@@
-158,6
+172,7
@@
bad:
goto end;
}
BIO_free(in);
goto end;
}
BIO_free(in);
+ in = NULL;
out=BIO_new(BIO_s_file());
if (out == NULL) goto end;
out=BIO_new(BIO_s_file());
if (out == NULL) goto end;
@@
-187,14
+202,16
@@
bad:
app_RAND_write_file(NULL, bio_err);
app_RAND_write_file(NULL, bio_err);
- if (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL,
NULL
))
+ if (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL,
passout
))
goto end;
ret=0;
end:
if (ret != 0)
ERR_print_errors(bio_err);
goto end;
ret=0;
end:
if (ret != 0)
ERR_print_errors(bio_err);
+ if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free(out);
if (dsa != NULL) DSA_free(dsa);
if (out != NULL) BIO_free(out);
if (dsa != NULL) DSA_free(dsa);
+ if(passout) Free(passout);
EXIT(ret);
}
#endif
EXIT(ret);
}
#endif