aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dh.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-10-26 21:07:28 +0000
committerRichard Levitte <levitte@openssl.org>2000-10-26 21:07:28 +0000
commit5270e7025e11b2fd1a5bdf8d81feded1167b1c87 (patch)
tree3bb44c37f4bb6469f738a10127050b023e0d7fb5 /apps/dh.c
parent1df586bec20de86c3086181c565aaee7629bb0a2 (diff)
downloadopenssl-5270e7025e11b2fd1a5bdf8d81feded1167b1c87.tar.gz
Merge the engine branch into the main trunk. All conflicts resolved.
At the same time, add VMS support for Rijndael.
Diffstat (limited to 'apps/dh.c')
-rw-r--r--apps/dh.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/apps/dh.c b/apps/dh.c
index 7465442e49..229ba2f63a 100644
--- a/apps/dh.c
+++ b/apps/dh.c
@@ -69,6 +69,7 @@
#include <openssl/dh.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
+#include <openssl/engine.h>
#undef PROG
#define PROG dh_main
@@ -87,11 +88,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 +101,7 @@ 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);
+ engine=NULL;
infile=NULL;
outfile=NULL;
informat=FORMAT_PEM;
@@ -129,6 +132,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 +168,30 @@ 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();
+ if (engine != NULL)
+ {
+ if((e = ENGINE_by_id(engine)) == NULL)
+ {
+ BIO_printf(bio_err,"invalid engine \"%s\"\n",
+ engine);
+ goto end;
+ }
+ if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
+ {
+ BIO_printf(bio_err,"can't use that engine\n");
+ goto end;
+ }
+ BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
+ /* Free our "structural" reference. */
+ ENGINE_free(e);
+ }
+
in=BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL))