* [including the GNU Public Licence.]
*/
-#ifndef NO_DH
+#ifndef OPENSSL_NO_DH
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
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();
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;
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)
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))
}
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
ret=0;
end:
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh);
+ apps_shutdown();
EXIT(ret);
}
#endif