diff options
author | Richard Levitte <levitte@openssl.org> | 2000-10-26 21:07:28 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-10-26 21:07:28 +0000 |
commit | 5270e7025e11b2fd1a5bdf8d81feded1167b1c87 (patch) | |
tree | 3bb44c37f4bb6469f738a10127050b023e0d7fb5 /apps/gendsa.c | |
parent | 1df586bec20de86c3086181c565aaee7629bb0a2 (diff) | |
download | openssl-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/gendsa.c')
-rw-r--r-- | apps/gendsa.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/gendsa.c b/apps/gendsa.c index 6022d8f142..1c0ec371d2 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -68,6 +68,7 @@ #include <openssl/dsa.h> #include <openssl/x509.h> #include <openssl/pem.h> +#include <openssl/engine.h> #define DEFBITS 512 #undef PROG @@ -77,6 +78,7 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { + ENGINE *e = NULL; DSA *dsa=NULL; int ret=1; char *outfile=NULL; @@ -84,6 +86,7 @@ int MAIN(int argc, char **argv) char *passargout = NULL, *passout = NULL; BIO *out=NULL,*in=NULL; EVP_CIPHER *enc=NULL; + char *engine=NULL; apps_startup(); @@ -106,6 +109,11 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; passargout= *(++argv); } + else if (strcmp(*argv,"-engine") == 0) + { + if (--argc < 1) goto bad; + engine= *(++argv); + } else if (strcmp(*argv,"-rand") == 0) { if (--argc < 1) goto bad; @@ -145,6 +153,7 @@ bad: #ifndef NO_IDEA BIO_printf(bio_err," -idea - encrypt the generated key with IDEA in cbc mode\n"); #endif + BIO_printf(bio_err," -engine e - use engine e, possibly a hardware device.\n"); BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); BIO_printf(bio_err," - load the file (or the files in the directory) into\n"); BIO_printf(bio_err," the random number generator\n"); @@ -153,6 +162,24 @@ bad: goto end; } + 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); + } + if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { BIO_printf(bio_err, "Error getting password\n"); goto end; |