From: Ben Laurie Date: Sun, 8 Jul 2001 12:14:41 +0000 (+0000) Subject: Speed test decrypt EVP operations. X-Git-Tag: OpenSSL_0_9_6c~182^2~44 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3f37e73baea893cd938983b3234658d8141df0e3;p=oweals%2Fopenssl.git Speed test decrypt EVP operations. --- diff --git a/apps/speed.c b/apps/speed.c index a7842cecd0..a9f3b8219a 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -426,6 +426,7 @@ int MAIN(int argc, char **argv) int pr_header=0; int usertime=1; const EVP_CIPHER *evp=NULL; + int decrypt=0; #ifndef TIMES usertime=-1; @@ -495,6 +496,12 @@ int MAIN(int argc, char **argv) } doit[D_EVP]=1; } + else if(argc > 0 && !strcmp(*argv,"-decrypt")) + { + argc--; + argv++; + decrypt=1; + } else if ((argc > 0) && (strcmp(*argv,"-engine") == 0)) { @@ -1192,11 +1199,22 @@ int MAIN(int argc, char **argv) names[D_EVP]=OBJ_nid2ln(evp->nid); print_message(names[D_EVP],save_count, lengths[j]); - EVP_EncryptInit(&ctx,evp,key16,iv); + if(decrypt) + EVP_DecryptInit(&ctx,evp,key16,iv); + else + EVP_EncryptInit(&ctx,evp,key16,iv); + Time_F(START,usertime); - for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++) - EVP_EncryptUpdate(&ctx,buf,&outl,buf,lengths[j]); - EVP_EncryptFinal(&ctx,buf,&outl); + if(decrypt) + for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++) + EVP_DecryptUpdate(&ctx,buf,&outl,buf,lengths[j]); + else + for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++) + EVP_EncryptUpdate(&ctx,buf,&outl,buf,lengths[j]); + if(decrypt) + EVP_DecryptFinal(&ctx,buf,&outl); + else + EVP_EncryptFinal(&ctx,buf,&outl); d=Time_F(STOP,usertime); BIO_printf(bio_err,"%ld %s's in %.2fs\n", count,names[D_EVP],d);