diff options
Diffstat (limited to 'crypto/openssl/apps/dh.c')
-rw-r--r-- | crypto/openssl/apps/dh.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/crypto/openssl/apps/dh.c b/crypto/openssl/apps/dh.c index 7465442..c10ea96 100644 --- a/crypto/openssl/apps/dh.c +++ b/crypto/openssl/apps/dh.c @@ -57,7 +57,7 @@ * [including the GNU Public Licence.] */ -#ifndef NO_DH +#ifndef OPENSSL_NO_DH #include <stdio.h> #include <stdlib.h> #include <time.h> @@ -87,11 +87,12 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { + ENGINE *e = NULL; DH *dh=NULL; int i,badops=0,text=0; BIO *in=NULL,*out=NULL; int informat,outformat,check=0,noout=0,C=0,ret=1; - char *infile,*outfile,*prog; + char *infile,*outfile,*prog,*engine; apps_startup(); @@ -99,6 +100,10 @@ int MAIN(int argc, char **argv) if ((bio_err=BIO_new(BIO_s_file())) != NULL) BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); + if (!load_config(bio_err, NULL)) + goto end; + + engine=NULL; infile=NULL; outfile=NULL; informat=FORMAT_PEM; @@ -129,6 +134,11 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; outfile= *(++argv); } + else if (strcmp(*argv,"-engine") == 0) + { + if (--argc < 1) goto bad; + engine= *(++argv); + } else if (strcmp(*argv,"-check") == 0) check=1; else if (strcmp(*argv,"-text") == 0) @@ -160,11 +170,14 @@ bad: BIO_printf(bio_err," -text print a text form of the DH parameters\n"); BIO_printf(bio_err," -C Output C code\n"); BIO_printf(bio_err," -noout no output\n"); + BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); goto end; } ERR_load_crypto_strings(); + e = setup_engine(bio_err, engine, 0); + in=BIO_new(BIO_s_file()); out=BIO_new(BIO_s_file()); if ((in == NULL) || (out == NULL)) @@ -186,7 +199,7 @@ bad: if (outfile == NULL) { BIO_set_fp(out,stdout,BIO_NOCLOSE); -#ifdef VMS +#ifdef OPENSSL_SYS_VMS { BIO *tmpbio = BIO_new(BIO_f_linebuffer()); out = BIO_push(tmpbio, out); @@ -319,6 +332,7 @@ end: if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); if (dh != NULL) DH_free(dh); - EXIT(ret); + apps_shutdown(); + OPENSSL_EXIT(ret); } #endif |