X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fdh.c;h=7e45bd33563658d74b50ff880e5b431da2d83df1;hb=4f2fc3c2ddf6289daf9fc1d57e48a0f6ec4e772a;hp=603ea5b496d8f4e315db317cff4308b4eeafd8c7;hpb=c04f8cf44a3b204b82f5f1f5d1ad9dbc738459f1;p=oweals%2Fopenssl.git diff --git a/apps/dh.c b/apps/dh.c index 603ea5b496..7e45bd3356 100644 --- a/apps/dh.c +++ b/apps/dh.c @@ -57,6 +57,7 @@ * [including the GNU Public Licence.] */ +#include /* for OPENSSL_NO_DH */ #ifndef OPENSSL_NO_DH #include #include @@ -69,7 +70,6 @@ #include #include #include -#include #undef PROG #define PROG dh_main @@ -88,12 +88,14 @@ 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,*engine; + char *infile,*outfile,*prog; +#ifndef OPENSSL_NO_ENGINE + char *engine; +#endif apps_startup(); @@ -101,7 +103,12 @@ 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; + +#ifndef OPENSSL_NO_ENGINE engine=NULL; +#endif infile=NULL; outfile=NULL; informat=FORMAT_PEM; @@ -132,11 +139,13 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; outfile= *(++argv); } +#ifndef OPENSSL_NO_ENGINE else if (strcmp(*argv,"-engine") == 0) { if (--argc < 1) goto bad; engine= *(++argv); } +#endif else if (strcmp(*argv,"-check") == 0) check=1; else if (strcmp(*argv,"-text") == 0) @@ -168,13 +177,17 @@ 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"); +#ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); +#endif goto end; } ERR_load_crypto_strings(); - e = setup_engine(bio_err, engine, 0); +#ifndef OPENSSL_NO_ENGINE + setup_engine(bio_err, engine, 0); +#endif in=BIO_new(BIO_s_file()); out=BIO_new(BIO_s_file()); @@ -331,6 +344,6 @@ end: if (out != NULL) BIO_free_all(out); if (dh != NULL) DH_free(dh); apps_shutdown(); - EXIT(ret); + OPENSSL_EXIT(ret); } #endif