From 5270e7025e11b2fd1a5bdf8d81feded1167b1c87 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 26 Oct 2000 21:07:28 +0000 Subject: Merge the engine branch into the main trunk. All conflicts resolved. At the same time, add VMS support for Rijndael. --- apps/speed.c | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'apps/speed.c') diff --git a/apps/speed.c b/apps/speed.c index 627cab1d31..ba41916371 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -81,6 +81,7 @@ #include #include #include +#include #if defined(__FreeBSD__) # define USE_TOD @@ -310,6 +311,7 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { + ENGINE *e; unsigned char *buf=NULL,*buf2=NULL; int mret=1; #define ALGOR_NUM 15 @@ -470,6 +472,37 @@ int MAIN(int argc, char **argv) { if ((argc > 0) && (strcmp(*argv,"-elapsed") == 0)) usertime = 0; + else + if ((argc > 0) && (strcmp(*argv,"-engine") == 0)) + { + argc--; + argv++; + if(argc == 0) + { + BIO_printf(bio_err,"no engine given\n"); + goto end; + } + if((e = ENGINE_by_id(*argv)) == NULL) + { + BIO_printf(bio_err,"invalid engine \"%s\"\n", + *argv); + 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", *argv); + /* Free our "structural" reference. */ + ENGINE_free(e); + /* It will be increased again further down. We just + don't want speed to confuse an engine with an + algorithm, especially when none is given (which + means all of them should be run) */ + j--; + } + else #ifndef NO_MD2 if (strcmp(*argv,"md2") == 0) doit[D_MD2]=1; else @@ -517,7 +550,7 @@ int MAIN(int argc, char **argv) #ifdef RSAref if (strcmp(*argv,"rsaref") == 0) { - RSA_set_default_method(RSA_PKCS1_RSAref()); + RSA_set_default_openssl_method(RSA_PKCS1_RSAref()); j--; } else @@ -525,7 +558,7 @@ int MAIN(int argc, char **argv) #ifndef RSA_NULL if (strcmp(*argv,"openssl") == 0) { - RSA_set_default_method(RSA_PKCS1_SSLeay()); + RSA_set_default_openssl_method(RSA_PKCS1_SSLeay()); j--; } else @@ -670,11 +703,12 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err,"\n"); #endif -#ifdef TIMES BIO_printf(bio_err,"\n"); BIO_printf(bio_err,"Available options:\n"); +#ifdef TIMES BIO_printf(bio_err,"-elapsed measure time in real time instead of CPU user time.\n"); #endif + BIO_printf(bio_err,"-engine e use engine e, possibly a hardware device.\n"); goto end; } argc--; @@ -1379,6 +1413,7 @@ int MAIN(int argc, char **argv) #endif mret=0; end: + ERR_print_errors(bio_err); if (buf != NULL) OPENSSL_free(buf); if (buf2 != NULL) OPENSSL_free(buf2); #ifndef NO_RSA -- cgit v1.2.3