Speed test decrypt EVP operations.

This commit is contained in:
Ben Laurie 2001-07-08 12:14:41 +00:00
parent 0774f470d9
commit 3f37e73bae

View File

@ -426,6 +426,7 @@ int MAIN(int argc, char **argv)
int pr_header=0; int pr_header=0;
int usertime=1; int usertime=1;
const EVP_CIPHER *evp=NULL; const EVP_CIPHER *evp=NULL;
int decrypt=0;
#ifndef TIMES #ifndef TIMES
usertime=-1; usertime=-1;
@ -495,6 +496,12 @@ int MAIN(int argc, char **argv)
} }
doit[D_EVP]=1; doit[D_EVP]=1;
} }
else if(argc > 0 && !strcmp(*argv,"-decrypt"))
{
argc--;
argv++;
decrypt=1;
}
else else
if ((argc > 0) && (strcmp(*argv,"-engine") == 0)) if ((argc > 0) && (strcmp(*argv,"-engine") == 0))
{ {
@ -1192,11 +1199,22 @@ int MAIN(int argc, char **argv)
names[D_EVP]=OBJ_nid2ln(evp->nid); names[D_EVP]=OBJ_nid2ln(evp->nid);
print_message(names[D_EVP],save_count, print_message(names[D_EVP],save_count,
lengths[j]); 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); Time_F(START,usertime);
for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++) if(decrypt)
EVP_EncryptUpdate(&ctx,buf,&outl,buf,lengths[j]); for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
EVP_EncryptFinal(&ctx,buf,&outl); 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); d=Time_F(STOP,usertime);
BIO_printf(bio_err,"%ld %s's in %.2fs\n", BIO_printf(bio_err,"%ld %s's in %.2fs\n",
count,names[D_EVP],d); count,names[D_EVP],d);