diff options
Diffstat (limited to 'apps/speed.c')
-rw-r--r-- | apps/speed.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/apps/speed.c b/apps/speed.c index 85673ff5a1..af86cee491 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -183,6 +183,7 @@ #ifndef OPENSSL_NO_ECDH #include <openssl/ecdh.h> #endif +#include <openssl/modes.h> #ifndef HAVE_FORK # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_NETWARE) @@ -214,7 +215,7 @@ static void print_result(int alg,int run_no,int count,double time_used); static int do_multi(int multi); #endif -#define ALGOR_NUM 29 +#define ALGOR_NUM 30 #define SIZE_NUM 5 #define RSA_NUM 4 #define DSA_NUM 3 @@ -229,7 +230,7 @@ static const char *names[ALGOR_NUM]={ "aes-128 cbc","aes-192 cbc","aes-256 cbc", "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc", "evp","sha256","sha512","whirlpool", - "aes-128 ige","aes-192 ige","aes-256 ige"}; + "aes-128 ige","aes-192 ige","aes-256 ige","ghash" }; static double results[ALGOR_NUM][SIZE_NUM]; static int lengths[SIZE_NUM]={16,64,256,1024,8*1024}; #ifndef OPENSSL_NO_RSA @@ -479,6 +480,7 @@ int MAIN(int argc, char **argv) #define D_IGE_128_AES 26 #define D_IGE_192_AES 27 #define D_IGE_256_AES 28 +#define D_GHASH 29 double d=0.0; long c[ALGOR_NUM][SIZE_NUM]; #define R_DSA_512 0 @@ -904,6 +906,10 @@ int MAIN(int argc, char **argv) doit[D_CBC_192_AES]=1; doit[D_CBC_256_AES]=1; } + else if (strcmp(*argv,"ghash") == 0) + { + doit[D_GHASH]=1; + } else #endif #ifndef OPENSSL_NO_CAMELLIA @@ -1273,6 +1279,7 @@ int MAIN(int argc, char **argv) c[D_IGE_128_AES][0]=count; c[D_IGE_192_AES][0]=count; c[D_IGE_256_AES][0]=count; + c[D_GHASH][0]=count; for (i=1; i<SIZE_NUM; i++) { @@ -1566,7 +1573,11 @@ int MAIN(int argc, char **argv) print_message(names[D_SHA1],c[D_SHA1][j],lengths[j]); Time_F(START); for (count=0,run=1; COND(c[D_SHA1][j]); count++) +#if 0 EVP_Digest(buf,(unsigned long)lengths[j],&(sha[0]),NULL,EVP_sha1(),NULL); +#else + SHA1(buf,lengths[j],sha); +#endif d=Time_F(STOP); print_result(D_SHA1,j,count,d); } @@ -1763,7 +1774,22 @@ int MAIN(int argc, char **argv) print_result(D_IGE_256_AES,j,count,d); } } + if (doit[D_GHASH]) + { + GCM128_CONTEXT *ctx = CRYPTO_gcm128_new(&aes_ks1,(block128_f)AES_encrypt); + CRYPTO_gcm128_setiv (ctx,"0123456789ab",12); + for (j=0; j<SIZE_NUM; j++) + { + print_message(names[D_GHASH],c[D_GHASH][j],lengths[j]); + Time_F(START); + for (count=0,run=1; COND(c[D_GHASH][j]); count++) + CRYPTO_gcm128_aad(ctx,buf,lengths[j]); + d=Time_F(STOP); + print_result(D_GHASH,j,count,d); + } + CRYPTO_gcm128_release(ctx); + } #endif #ifndef OPENSSL_NO_CAMELLIA |