diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2000-02-16 23:16:01 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2000-02-16 23:16:01 +0000 |
commit | a3fe382e2d2d794c598921cd39117581a2a8941b (patch) | |
tree | 2845b270bbe0705f5844c16d23fb398af3ef3f3f /apps/gendsa.c | |
parent | bd03b99b9bb860e062f08ec6d919c0841d951833 (diff) |
Pass phrase reorganisation.
Diffstat (limited to 'apps/gendsa.c')
-rw-r--r-- | apps/gendsa.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/apps/gendsa.c b/apps/gendsa.c index 805f114516..d69a93da45 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -81,7 +81,7 @@ int MAIN(int argc, char **argv) int ret=1; char *outfile=NULL; char *inrand=NULL,*dsaparams=NULL; - char *passout = NULL; + char *passargout = NULL, *passout = NULL; BIO *out=NULL,*in=NULL; EVP_CIPHER *enc=NULL; @@ -101,21 +101,10 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; outfile= *(++argv); } - else if (strcmp(*argv,"-envpassout") == 0) - { - if (--argc < 1) goto bad; - if(!(passout= getenv(*(++argv)))) - { - BIO_printf(bio_err, - "Can't read environment variable %s\n", - *argv); - goto bad; - } - } else if (strcmp(*argv,"-passout") == 0) { if (--argc < 1) goto bad; - passout= *(++argv); + passargout= *(++argv); } else if (strcmp(*argv,"-rand") == 0) { @@ -164,6 +153,12 @@ bad: 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))) { @@ -207,7 +202,7 @@ bad: app_RAND_write_file(NULL, bio_err); - if (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,PEM_cb, passout)) + if (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL, passout)) goto end; ret=0; end: @@ -216,6 +211,7 @@ end: if (in != NULL) BIO_free(in); if (out != NULL) BIO_free(out); if (dsa != NULL) DSA_free(dsa); + if(passout) Free(passout); EXIT(ret); } #endif |