int MAIN(int argc, char **argv)
	{
	unsigned char *buf=NULL,*buf2=NULL;
	int ret=1;
#define ALGOR_NUM	14
#define SIZE_NUM	5
#define RSA_NUM		4
#define DSA_NUM		3
	long count,rsa_count;
	int i,j,k,rsa_num,rsa_num2;
#ifndef NO_MD2
	unsigned char md2[MD2_DIGEST_LENGTH];
#endif
#ifndef NO_MDC2
	unsigned char mdc2[MDC2_DIGEST_LENGTH];
#endif
#ifndef NO_MD5
	unsigned char md5[MD5_DIGEST_LENGTH];
	unsigned char hmac[MD5_DIGEST_LENGTH];
#endif
#ifndef NO_SHA
	unsigned char sha[SHA_DIGEST_LENGTH];
#endif
#ifndef NO_RIPEMD
	unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
#endif
#ifndef NO_RC4
	RC4_KEY rc4_ks;
#endif
#ifndef NO_RC5
	RC5_32_KEY rc5_ks;
#endif
#ifndef NO_RC2
	RC2_KEY rc2_ks;
#endif
#ifndef NO_IDEA
	IDEA_KEY_SCHEDULE idea_ks;
#endif
#ifndef NO_BF
	BF_KEY bf_ks;
#endif
#ifndef NO_CAST
	CAST_KEY cast_ks;
#endif
	static unsigned char key16[16]=
		{0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
		 0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
	unsigned char iv[8];
#ifndef NO_DES
	des_cblock *buf_as_des_cblock = NULL;
	static des_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
	static des_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
	static des_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
	des_key_schedule sch,sch2,sch3;
#endif
#define	D_MD2		0
#define	D_MDC2		1
#define	D_MD5		2
#define	D_HMAC		3
#define	D_SHA1		4
#define D_RMD160	5
#define	D_RC4		6
#define	D_CBC_DES	7
#define	D_EDE3_DES	8
#define	D_CBC_IDEA	9
#define	D_CBC_RC2	10
#define	D_CBC_RC5	11
#define	D_CBC_BF	12
#define	D_CBC_CAST	13
	double d,results[ALGOR_NUM][SIZE_NUM];
	static int lengths[SIZE_NUM]={8,64,256,1024,8*1024};
	long c[ALGOR_NUM][SIZE_NUM];
	static char *names[ALGOR_NUM]={
		"md2","mdc2","md5","hmac(md5)","sha1","rmd160","rc4",
		"des cbc","des ede3","idea cbc",
		"rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc"};
#define	R_DSA_512	0
#define	R_DSA_1024	1
#define	R_DSA_2048	2
#define	R_RSA_512	0
#define	R_RSA_1024	1
#define	R_RSA_2048	2
#define	R_RSA_4096	3
#ifndef NO_RSA
	RSA *rsa_key[RSA_NUM];
	long rsa_c[RSA_NUM][2];
	double rsa_results[RSA_NUM][2];
	static unsigned int rsa_bits[RSA_NUM]={512,1024,2048,4096};
	static unsigned char *rsa_data[RSA_NUM]=
		{test512,test1024,test2048,test4096};
	static int rsa_data_length[RSA_NUM]={
		sizeof(test512),sizeof(test1024),
		sizeof(test2048),sizeof(test4096)};
#endif
#ifndef NO_DSA
	DSA *dsa_key[DSA_NUM];
	long dsa_c[DSA_NUM][2];
	double dsa_results[DSA_NUM][2];
	static unsigned int dsa_bits[DSA_NUM]={512,1024,2048};
#endif
	int rsa_doit[RSA_NUM];
	int dsa_doit[DSA_NUM];
	int doit[ALGOR_NUM];
	int pr_header=0;
	apps_startup();
	memset(results, 0, sizeof(results));
#ifndef NO_DSA
	memset(dsa_key,0,sizeof(dsa_key));
#endif
	if (bio_err == NULL)
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
#ifndef NO_RSA
	memset(rsa_key,0,sizeof(rsa_key));
	for (i=0; i<RSA_NUM; i++)
		rsa_key[i]=NULL;
#endif
	if ((buf=(unsigned char *)Malloc((int)BUFSIZE)) == NULL)
		{
		BIO_printf(bio_err,"out of memory\n");
		goto end;
		}
#ifndef NO_DES
	buf_as_des_cblock = (des_cblock *)buf;
#endif
	if ((buf2=(unsigned char *)Malloc((int)BUFSIZE)) == NULL)
		{
		BIO_printf(bio_err,"out of memory\n");
		goto end;
		}
	memset(c,0,sizeof(c));
	memset(iv,0,sizeof(iv));
	for (i=0; i<ALGOR_NUM; i++)
		doit[i]=0;
	for (i=0; i<RSA_NUM; i++)
		rsa_doit[i]=0;
	for (i=0; i<DSA_NUM; i++)
		dsa_doit[i]=0;
	j=0;
	argc--;
	argv++;
	while (argc)
		{
#ifndef NO_MD2
		if	(strcmp(*argv,"md2") == 0) doit[D_MD2]=1;
		else
#endif
#ifndef NO_MDC2
			if (strcmp(*argv,"mdc2") == 0) doit[D_MDC2]=1;
		else
#endif
#ifndef NO_MD5
			if (strcmp(*argv,"md5") == 0) doit[D_MD5]=1;
		else
#endif
#ifndef NO_MD5
			if (strcmp(*argv,"hmac") == 0) doit[D_HMAC]=1;
		else
#endif
#ifndef NO_SHA
			if (strcmp(*argv,"sha1") == 0) doit[D_SHA1]=1;
		else
			if (strcmp(*argv,"sha") == 0) doit[D_SHA1]=1;
		else
#endif
#ifndef NO_RIPEMD
			if (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1;
		else
			if (strcmp(*argv,"rmd160") == 0) doit[D_RMD160]=1;
		else
			if (strcmp(*argv,"ripemd160") == 0) doit[D_RMD160]=1;
		else
#endif
#ifndef NO_RC4
			if (strcmp(*argv,"rc4") == 0) doit[D_RC4]=1;
		else
#endif
#ifndef NO_DES
			if (strcmp(*argv,"des-cbc") == 0) doit[D_CBC_DES]=1;
		else	if (strcmp(*argv,"des-ede3") == 0) doit[D_EDE3_DES]=1;
		else
#endif
#ifndef NO_RSA
#ifdef RSAref
			if (strcmp(*argv,"rsaref") == 0)
			{
			RSA_set_default_method(RSA_PKCS1_RSAref());
			j--;
			}
		else
#endif
#ifndef RSA_NULL
			if (strcmp(*argv,"openssl") == 0)
			{
			RSA_set_default_method(RSA_PKCS1_SSLeay());
			j--;
			}
		else
#endif
#endif
		     if (strcmp(*argv,"dsa512") == 0) dsa_doit[R_DSA_512]=2;
		else if (strcmp(*argv,"dsa1024") == 0) dsa_doit[R_DSA_1024]=2;
		else if (strcmp(*argv,"dsa2048") == 0) dsa_doit[R_DSA_2048]=2;
		else if (strcmp(*argv,"rsa512") == 0) rsa_doit[R_RSA_512]=2;
		else if (strcmp(*argv,"rsa1024") == 0) rsa_doit[R_RSA_1024]=2;
		else if (strcmp(*argv,"rsa2048") == 0) rsa_doit[R_RSA_2048]=2;
		else if (strcmp(*argv,"rsa4096") == 0) rsa_doit[R_RSA_4096]=2;
		else
#ifndef NO_RC2
		     if (strcmp(*argv,"rc2-cbc") == 0) doit[D_CBC_RC2]=1;
		else if (strcmp(*argv,"rc2") == 0) doit[D_CBC_RC2]=1;
		else
#endif
#ifndef NO_RC5
		     if (strcmp(*argv,"rc5-cbc") == 0) doit[D_CBC_RC5]=1;
		else if (strcmp(*argv,"rc5") == 0) doit[D_CBC_RC5]=1;
		else
#endif
#ifndef NO_IDEA
		     if (strcmp(*argv,"idea-cbc") == 0) doit[D_CBC_IDEA]=1;
		else if (strcmp(*argv,"idea") == 0) doit[D_CBC_IDEA]=1;
		else
#endif
#ifndef NO_BF
		     if (strcmp(*argv,"bf-cbc") == 0) doit[D_CBC_BF]=1;
		else if (strcmp(*argv,"blowfish") == 0) doit[D_CBC_BF]=1;
		else if (strcmp(*argv,"bf") == 0) doit[D_CBC_BF]=1;
		else
#endif
#ifndef NO_CAST
		     if (strcmp(*argv,"cast-cbc") == 0) doit[D_CBC_CAST]=1;
		else if (strcmp(*argv,"cast") == 0) doit[D_CBC_CAST]=1;
		else if (strcmp(*argv,"cast5") == 0) doit[D_CBC_CAST]=1;
		else
#endif
#ifndef NO_DES
			if (strcmp(*argv,"des") == 0)
			{
			doit[D_CBC_DES]=1;
			doit[D_EDE3_DES]=1;
			}
		else
#endif
#ifndef NO_RSA
			if (strcmp(*argv,"rsa") == 0)
			{
			rsa_doit[R_RSA_512]=1;
			rsa_doit[R_RSA_1024]=1;
			rsa_doit[R_RSA_2048]=1;
			rsa_doit[R_RSA_4096]=1;
			}
		else
#endif
#ifndef NO_DSA
			if (strcmp(*argv,"dsa") == 0)
			{
			dsa_doit[R_DSA_512]=1;
			dsa_doit[R_DSA_1024]=1;
			}
		else
#endif
			{
			BIO_printf(bio_err,"bad value, pick one of\n");
			BIO_printf(bio_err,"md2      mdc2	md5      hmac      sha1    rmd160\n");
#ifndef NO_IDEA
			BIO_printf(bio_err,"idea-cbc ");
#endif
#ifndef NO_RC2
			BIO_printf(bio_err,"rc2-cbc  ");
#endif
#ifndef NO_RC5
			BIO_printf(bio_err,"rc5-cbc  ");
#endif
#ifndef NO_BF
			BIO_printf(bio_err,"bf-cbc");
#endif
#if !defined(NO_IDEA) && !defined(NO_RC2) && !defined(NO_BF) && !defined(NO_RC5)
			BIO_printf(bio_err,"\n");
#endif
			BIO_printf(bio_err,"des-cbc  des-ede3 ");
#ifndef NO_RC4
			BIO_printf(bio_err,"rc4");
#endif
#ifndef NO_RSA
			BIO_printf(bio_err,"\nrsa512   rsa1024  rsa2048  rsa4096\n");
#endif
#ifndef NO_DSA
			BIO_printf(bio_err,"\ndsa512   dsa1024  dsa2048\n");
#endif
			BIO_printf(bio_err,"idea     rc2      des      rsa    blowfish\n");
			goto end;
			}
		argc--;
		argv++;
		j++;
		}
	if (j == 0)
		{
		for (i=0; i<ALGOR_NUM; i++)
			doit[i]=1;
		for (i=0; i<RSA_NUM; i++)
			rsa_doit[i]=1;
		for (i=0; i<DSA_NUM; i++)
			dsa_doit[i]=1;
		}
	for (i=0; i<ALGOR_NUM; i++)
		if (doit[i]) pr_header++;
#ifndef TIMES
	BIO_printf(bio_err,"To get the most accurate results, try to run this\n");
	BIO_printf(bio_err,"program when this computer is idle.\n");
#endif
#ifndef NO_RSA
	for (i=0; i<RSA_NUM; i++)
		{
		unsigned char *p;
		p=rsa_data[i];
		rsa_key[i]=d2i_RSAPrivateKey(NULL,&p,rsa_data_length[i]);
		if (rsa_key[i] == NULL)
			{
			BIO_printf(bio_err,"internal error loading RSA key number %d\n",i);
			goto end;
			}
#if 0
		else
			{
			BIO_printf(bio_err,"Loaded RSA key, %d bit modulus and e= 0x",BN_num_bits(rsa_key[i]->n));
			BN_print(bio_err,rsa_key[i]->e);
			BIO_printf(bio_err,"\n");
			}
#endif
		}
#endif
#ifndef NO_DSA
	dsa_key[0]=get_dsa512();
	dsa_key[1]=get_dsa1024();
	dsa_key[2]=get_dsa2048();
#endif
#ifndef NO_DES
	des_set_key(&key,sch);
	des_set_key(&key2,sch2);
	des_set_key(&key3,sch3);
#endif
#ifndef NO_IDEA
	idea_set_encrypt_key(key16,&idea_ks);
#endif
#ifndef NO_RC4
	RC4_set_key(&rc4_ks,16,key16);
#endif
#ifndef NO_RC2
	RC2_set_key(&rc2_ks,16,key16,128);
#endif
#ifndef NO_RC5
	RC5_32_set_key(&rc5_ks,16,key16,12);
#endif
#ifndef NO_BF
	BF_set_key(&bf_ks,16,key16);
#endif
#ifndef NO_CAST
	CAST_set_key(&cast_ks,16,key16);
#endif
#ifndef NO_RSA
	memset(rsa_c,0,sizeof(rsa_c));
#endif
#ifndef SIGALRM
	BIO_printf(bio_err,"First we calculate the approximate speed ...\n");
	count=10;
	do	{
		long i;
		count*=2;
		Time_F(START);
		for (i=count; i; i--)
			des_ecb_encrypt(buf_as_des_cblock,buf_as_des_cblock,
				&(sch[0]),DES_ENCRYPT);
		d=Time_F(STOP);
		} while (d <3);
	c[D_MD2][0]=count/10;
	c[D_MDC2][0]=count/10;
	c[D_MD5][0]=count;
	c[D_HMAC][0]=count;
	c[D_SHA1][0]=count;
	c[D_RMD160][0]=count;
	c[D_RC4][0]=count*5;
	c[D_CBC_DES][0]=count;
	c[D_EDE3_DES][0]=count/3;
	c[D_CBC_IDEA][0]=count;
	c[D_CBC_RC2][0]=count;
	c[D_CBC_RC5][0]=count;
	c[D_CBC_BF][0]=count;
	c[D_CBC_CAST][0]=count;
	for (i=1; i<SIZE_NUM; i++)
		{
		c[D_MD2][i]=c[D_MD2][0]*4*lengths[0]/lengths[i];
		c[D_MDC2][i]=c[D_MDC2][0]*4*lengths[0]/lengths[i];
		c[D_MD5][i]=c[D_MD5][0]*4*lengths[0]/lengths[i];
		c[D_HMAC][i]=c[D_HMAC][0]*4*lengths[0]/lengths[i];
		c[D_SHA1][i]=c[D_SHA1][0]*4*lengths[0]/lengths[i];
		c[D_RMD160][i]=c[D_RMD160][0]*4*lengths[0]/lengths[i];
		}
	for (i=1; i<SIZE_NUM; i++)
		{
		long l0,l1;
		l0=(long)lengths[i-1];
		l1=(long)lengths[i];
		c[D_RC4][i]=c[D_RC4][i-1]*l0/l1;
		c[D_CBC_DES][i]=c[D_CBC_DES][i-1]*l0/l1;
		c[D_EDE3_DES][i]=c[D_EDE3_DES][i-1]*l0/l1;
		c[D_CBC_IDEA][i]=c[D_CBC_IDEA][i-1]*l0/l1;
		c[D_CBC_RC2][i]=c[D_CBC_RC2][i-1]*l0/l1;
		c[D_CBC_RC5][i]=c[D_CBC_RC5][i-1]*l0/l1;
		c[D_CBC_BF][i]=c[D_CBC_BF][i-1]*l0/l1;
		c[D_CBC_CAST][i]=c[D_CBC_CAST][i-1]*l0/l1;
		}
#ifndef NO_RSA
	rsa_c[R_RSA_512][0]=count/2000;
	rsa_c[R_RSA_512][1]=count/400;
	for (i=1; i<RSA_NUM; i++)
		{
		rsa_c[i][0]=rsa_c[i-1][0]/8;
		rsa_c[i][1]=rsa_c[i-1][1]/4;
		if ((rsa_doit[i] <= 1) && (rsa_c[i][0] == 0))
			rsa_doit[i]=0;
		else
			{
			if (rsa_c[i][0] == 0)
				{
				rsa_c[i][0]=1;
				rsa_c[i][1]=20;
				}
			}
		}
#endif
	dsa_c[R_DSA_512][0]=count/1000;
	dsa_c[R_DSA_512][1]=count/1000/2;
	for (i=1; i<DSA_NUM; i++)
		{
		dsa_c[i][0]=dsa_c[i-1][0]/4;
		dsa_c[i][1]=dsa_c[i-1][1]/4;
		if ((dsa_doit[i] <= 1) && (dsa_c[i][0] == 0))
			dsa_doit[i]=0;
		else
			{
			if (dsa_c[i] == 0)
				{
				dsa_c[i][0]=1;
				dsa_c[i][1]=1;
				}
			}
		}
#define COND(d)	(count < (d))
#define COUNT(d) (d)
#else
#define COND(c)	(run)
#define COUNT(d) (count)
	signal(SIGALRM,sig_done);
#endif
#ifndef NO_MD2
	if (doit[D_MD2])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_MD2],c[D_MD2][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_MD2][j]); count++)
				MD2(buf,(unsigned long)lengths[j],&(md2[0]));
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_MD2],d);
			results[D_MD2][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_MDC2
	if (doit[D_MDC2])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_MDC2],c[D_MDC2][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_MDC2][j]); count++)
				MDC2(buf,(unsigned long)lengths[j],&(mdc2[0]));
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_MDC2],d);
			results[D_MDC2][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_MD5
	if (doit[D_MD5])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_MD5],c[D_MD5][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_MD5][j]); count++)
				MD5(&(buf[0]),(unsigned long)lengths[j],&(md5[0]));
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_MD5],d);
			results[D_MD5][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#if !defined(NO_MD5) && !defined(NO_HMAC)
	if (doit[D_HMAC])
		{
		HMAC_CTX hctx;
		HMAC_Init(&hctx,(unsigned char *)"This is a key...",
			16,EVP_md5());
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_HMAC],c[D_HMAC][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_HMAC][j]); count++)
				{
				HMAC_Init(&hctx,NULL,0,NULL);
                                HMAC_Update(&hctx,buf,lengths[j]);
                                HMAC_Final(&hctx,&(hmac[0]),NULL);
				}
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_HMAC],d);
			results[D_HMAC][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_SHA
	if (doit[D_SHA1])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			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++)
				SHA1(buf,(unsigned long)lengths[j],&(sha[0]));
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_SHA1],d);
			results[D_SHA1][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_RIPEMD
	if (doit[D_RMD160])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_RMD160],c[D_RMD160][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_RMD160][j]); count++)
				RIPEMD160(buf,(unsigned long)lengths[j],&(rmd160[0]));
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_RMD160],d);
			results[D_RMD160][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_RC4
	if (doit[D_RC4])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_RC4],c[D_RC4][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_RC4][j]); count++)
				RC4(&rc4_ks,(unsigned int)lengths[j],
					buf,buf);
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_RC4],d);
			results[D_RC4][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_DES
	if (doit[D_CBC_DES])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_CBC_DES],c[D_CBC_DES][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_CBC_DES][j]); count++)
				des_ncbc_encrypt(buf,buf,lengths[j],sch,
						 &iv,DES_ENCRYPT);
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_CBC_DES],d);
			results[D_CBC_DES][j]=((double)count)/d*lengths[j];
			}
		}
	if (doit[D_EDE3_DES])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_EDE3_DES],c[D_EDE3_DES][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_EDE3_DES][j]); count++)
				des_ede3_cbc_encrypt(buf,buf,lengths[j],
						     sch,sch2,sch3,
						     &iv,DES_ENCRYPT);
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_EDE3_DES],d);
			results[D_EDE3_DES][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_IDEA
	if (doit[D_CBC_IDEA])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_CBC_IDEA],c[D_CBC_IDEA][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_CBC_IDEA][j]); count++)
				idea_cbc_encrypt(buf,buf,
					(unsigned long)lengths[j],&idea_ks,
					iv,IDEA_ENCRYPT);
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_CBC_IDEA],d);
			results[D_CBC_IDEA][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_RC2
	if (doit[D_CBC_RC2])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_CBC_RC2],c[D_CBC_RC2][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_CBC_RC2][j]); count++)
				RC2_cbc_encrypt(buf,buf,
					(unsigned long)lengths[j],&rc2_ks,
					iv,RC2_ENCRYPT);
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_CBC_RC2],d);
			results[D_CBC_RC2][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_RC5
	if (doit[D_CBC_RC5])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_CBC_RC5],c[D_CBC_RC5][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_CBC_RC5][j]); count++)
				RC5_32_cbc_encrypt(buf,buf,
					(unsigned long)lengths[j],&rc5_ks,
					iv,RC5_ENCRYPT);
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_CBC_RC5],d);
			results[D_CBC_RC5][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_BF
	if (doit[D_CBC_BF])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_CBC_BF],c[D_CBC_BF][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_CBC_BF][j]); count++)
				BF_cbc_encrypt(buf,buf,
					(unsigned long)lengths[j],&bf_ks,
					iv,BF_ENCRYPT);
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_CBC_BF],d);
			results[D_CBC_BF][j]=((double)count)/d*lengths[j];
			}
		}
#endif
#ifndef NO_CAST
	if (doit[D_CBC_CAST])
		{
		for (j=0; j<SIZE_NUM; j++)
			{
			print_message(names[D_CBC_CAST],c[D_CBC_CAST][j],lengths[j]);
			Time_F(START);
			for (count=0,run=1; COND(c[D_CBC_CAST][j]); count++)
				CAST_cbc_encrypt(buf,buf,
					(unsigned long)lengths[j],&cast_ks,
					iv,CAST_ENCRYPT);
			d=Time_F(STOP);
			BIO_printf(bio_err,"%ld %s's in %.2fs\n",
				count,names[D_CBC_CAST],d);
			results[D_CBC_CAST][j]=((double)count)/d*lengths[j];
			}
		}
#endif
	RAND_bytes(buf,36);
#ifndef NO_RSA
	for (j=0; j<RSA_NUM; j++)
		{
		int ret;
		if (!rsa_doit[j]) continue;
		ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num, rsa_key[j]);
		pkey_print_message("private","rsa",rsa_c[j][0],rsa_bits[j],
			RSA_SECONDS);
		Time_F(START);
		for (count=0,run=1; COND(rsa_c[j][0]); count++)
			{
			ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num,
								 rsa_key[j]);
			if (ret <= 0)
				{
				BIO_printf(bio_err,"RSA private encrypt failure\n");
				ERR_print_errors(bio_err);
				count=1;
				break;
				}
			}
		d=Time_F(STOP);
		BIO_printf(bio_err,"%ld %d bit private RSA's in %.2fs\n",
			count,rsa_bits[j],d);
		rsa_results[j][0]=d/(double)count;
		rsa_count=count;
#if 1
		ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num, rsa_key[j]);
		pkey_print_message("public","rsa",rsa_c[j][1],rsa_bits[j],
			RSA_SECONDS);
		Time_F(START);
		for (count=0,run=1; COND(rsa_c[j][1]); count++)
			{
			ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num,
								rsa_key[j]);
			if (ret <= 0)
				{
				BIO_printf(bio_err,"RSA verify failure\n");
				ERR_print_errors(bio_err);
				count=1;
				break;
				}
			}
		d=Time_F(STOP);
		BIO_printf(bio_err,"%ld %d bit public RSA's in %.2fs\n",
			count,rsa_bits[j],d);
		rsa_results[j][1]=d/(double)count;
#endif
		if (rsa_count <= 1)
			{
			for (j++; j<RSA_NUM; j++)
				rsa_doit[j]=0;
			}
		}
#endif
	RAND_bytes(buf,20);
#ifndef NO_DSA
	for (j=0; j<DSA_NUM; j++)
		{
		unsigned int kk;
		if (!dsa_doit[j]) continue;
		DSA_generate_key(dsa_key[j]);
		rsa_num=DSA_sign(EVP_PKEY_DSA,buf,20,buf2,
			&kk,dsa_key[j]);
		pkey_print_message("sign","dsa",dsa_c[j][0],dsa_bits[j],
			DSA_SECONDS);
		Time_F(START);
		for (count=0,run=1; COND(dsa_c[j][0]); count++)
			{
			rsa_num=DSA_sign(EVP_PKEY_DSA,buf,20,buf2,
				&kk,dsa_key[j]);
			if (rsa_num <= 0)
				{
				BIO_printf(bio_err,"DSA sign failure\n");
				ERR_print_errors(bio_err);
				count=1;
				break;
				}
			}
		d=Time_F(STOP);
		BIO_printf(bio_err,"%ld %d bit DSA signs in %.2fs\n",
			count,dsa_bits[j],d);
		dsa_results[j][0]=d/(double)count;
		rsa_count=count;
		rsa_num2=DSA_verify(EVP_PKEY_DSA,buf,20,buf2,
			kk,dsa_key[j]);
		pkey_print_message("verify","dsa",dsa_c[j][1],dsa_bits[j],
			DSA_SECONDS);
		Time_F(START);
		for (count=0,run=1; COND(dsa_c[j][1]); count++)
			{
			rsa_num2=DSA_verify(EVP_PKEY_DSA,buf,20,buf2,
				kk,dsa_key[j]);
			if (rsa_num2 <= 0)
				{
				BIO_printf(bio_err,"DSA verify failure\n");
				ERR_print_errors(bio_err);
				count=1;
				break;
				}
			}
		d=Time_F(STOP);
		BIO_printf(bio_err,"%ld %d bit DSA verify in %.2fs\n",
			count,dsa_bits[j],d);
		dsa_results[j][1]=d/(double)count;
		if (rsa_count <= 1)
			{
			for (j++; j<DSA_NUM; j++)
				dsa_doit[j]=0;
			}
		}
#endif
	fprintf(stdout,"%s\n",SSLeay_version(SSLEAY_VERSION));
        fprintf(stdout,"%s\n",SSLeay_version(SSLEAY_BUILT_ON));
	printf("options:");
	printf("%s ",BN_options());
#ifndef NO_MD2
	printf("%s ",MD2_options());
#endif
#ifndef NO_RC4
	printf("%s ",RC4_options());
#endif
#ifndef NO_DES
	printf("%s ",des_options());
#endif
#ifndef NO_IDEA
	printf("%s ",idea_options());
#endif
#ifndef NO_BF
	printf("%s ",BF_options());
#endif
	fprintf(stdout,"\n%s\n",SSLeay_version(SSLEAY_CFLAGS));
	if (pr_header)
		{
		fprintf(stdout,"The 'numbers' are in 1000s of bytes per second processed.\n");
		fprintf(stdout,"type        ");
		for (j=0;  j<SIZE_NUM; j++)
			fprintf(stdout,"%7d bytes",lengths[j]);
		fprintf(stdout,"\n");
		}
	for (k=0; k<ALGOR_NUM; k++)
		{
		if (!doit[k]) continue;
		fprintf(stdout,"%-13s",names[k]);
		for (j=0; j<SIZE_NUM; j++)
			{
			if (results[k][j] > 10000)
				fprintf(stdout," %11.2fk",results[k][j]/1e3);
			else
				fprintf(stdout," %11.2f ",results[k][j]);
			}
		fprintf(stdout,"\n");
		}
#ifndef NO_RSA
	j=1;
	for (k=0; k<RSA_NUM; k++)
		{
		if (!rsa_doit[k]) continue;
		if (j)
			{
			printf("%18ssign    verify    sign/s verify/s\n"," ");
			j=0;
			}
		fprintf(stdout,"rsa %4u bits %8.4fs %8.4fs %8.1f %8.1f",
			rsa_bits[k],rsa_results[k][0],rsa_results[k][1],
			1.0/rsa_results[k][0],1.0/rsa_results[k][1]);
		fprintf(stdout,"\n");
		}
#endif
#ifndef NO_DSA
	j=1;
	for (k=0; k<DSA_NUM; k++)
		{
		if (!dsa_doit[k]) continue;
		if (j)	{
			printf("%18ssign    verify    sign/s verify/s\n"," ");
			j=0;
			}
		fprintf(stdout,"dsa %4u bits %8.4fs %8.4fs %8.1f %8.1f",
			dsa_bits[k],dsa_results[k][0],dsa_results[k][1],
			1.0/dsa_results[k][0],1.0/dsa_results[k][1]);
		fprintf(stdout,"\n");
		}
#endif
	ret=0;
end:
	if (buf != NULL) Free(buf);
	if (buf2 != NULL) Free(buf2);
#ifndef NO_RSA
	for (i=0; i<RSA_NUM; i++)
		if (rsa_key[i] != NULL)
			RSA_free(rsa_key[i]);
#endif
#ifndef NO_DSA
	for (i=0; i<DSA_NUM; i++)
		if (dsa_key[i] != NULL)
			DSA_free(dsa_key[i]);
#endif
	EXIT(ret);
	}
['int MAIN(int argc, char **argv)\n\t{\n\tunsigned char *buf=NULL,*buf2=NULL;\n\tint ret=1;\n#define ALGOR_NUM\t14\n#define SIZE_NUM\t5\n#define RSA_NUM\t\t4\n#define DSA_NUM\t\t3\n\tlong count,rsa_count;\n\tint i,j,k,rsa_num,rsa_num2;\n#ifndef NO_MD2\n\tunsigned char md2[MD2_DIGEST_LENGTH];\n#endif\n#ifndef NO_MDC2\n\tunsigned char mdc2[MDC2_DIGEST_LENGTH];\n#endif\n#ifndef NO_MD5\n\tunsigned char md5[MD5_DIGEST_LENGTH];\n\tunsigned char hmac[MD5_DIGEST_LENGTH];\n#endif\n#ifndef NO_SHA\n\tunsigned char sha[SHA_DIGEST_LENGTH];\n#endif\n#ifndef NO_RIPEMD\n\tunsigned char rmd160[RIPEMD160_DIGEST_LENGTH];\n#endif\n#ifndef NO_RC4\n\tRC4_KEY rc4_ks;\n#endif\n#ifndef NO_RC5\n\tRC5_32_KEY rc5_ks;\n#endif\n#ifndef NO_RC2\n\tRC2_KEY rc2_ks;\n#endif\n#ifndef NO_IDEA\n\tIDEA_KEY_SCHEDULE idea_ks;\n#endif\n#ifndef NO_BF\n\tBF_KEY bf_ks;\n#endif\n#ifndef NO_CAST\n\tCAST_KEY cast_ks;\n#endif\n\tstatic unsigned char key16[16]=\n\t\t{0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,\n\t\t 0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};\n\tunsigned char iv[8];\n#ifndef NO_DES\n\tdes_cblock *buf_as_des_cblock = NULL;\n\tstatic des_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};\n\tstatic des_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};\n\tstatic des_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};\n\tdes_key_schedule sch,sch2,sch3;\n#endif\n#define\tD_MD2\t\t0\n#define\tD_MDC2\t\t1\n#define\tD_MD5\t\t2\n#define\tD_HMAC\t\t3\n#define\tD_SHA1\t\t4\n#define D_RMD160\t5\n#define\tD_RC4\t\t6\n#define\tD_CBC_DES\t7\n#define\tD_EDE3_DES\t8\n#define\tD_CBC_IDEA\t9\n#define\tD_CBC_RC2\t10\n#define\tD_CBC_RC5\t11\n#define\tD_CBC_BF\t12\n#define\tD_CBC_CAST\t13\n\tdouble d,results[ALGOR_NUM][SIZE_NUM];\n\tstatic int lengths[SIZE_NUM]={8,64,256,1024,8*1024};\n\tlong c[ALGOR_NUM][SIZE_NUM];\n\tstatic char *names[ALGOR_NUM]={\n\t\t"md2","mdc2","md5","hmac(md5)","sha1","rmd160","rc4",\n\t\t"des cbc","des ede3","idea cbc",\n\t\t"rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc"};\n#define\tR_DSA_512\t0\n#define\tR_DSA_1024\t1\n#define\tR_DSA_2048\t2\n#define\tR_RSA_512\t0\n#define\tR_RSA_1024\t1\n#define\tR_RSA_2048\t2\n#define\tR_RSA_4096\t3\n#ifndef NO_RSA\n\tRSA *rsa_key[RSA_NUM];\n\tlong rsa_c[RSA_NUM][2];\n\tdouble rsa_results[RSA_NUM][2];\n\tstatic unsigned int rsa_bits[RSA_NUM]={512,1024,2048,4096};\n\tstatic unsigned char *rsa_data[RSA_NUM]=\n\t\t{test512,test1024,test2048,test4096};\n\tstatic int rsa_data_length[RSA_NUM]={\n\t\tsizeof(test512),sizeof(test1024),\n\t\tsizeof(test2048),sizeof(test4096)};\n#endif\n#ifndef NO_DSA\n\tDSA *dsa_key[DSA_NUM];\n\tlong dsa_c[DSA_NUM][2];\n\tdouble dsa_results[DSA_NUM][2];\n\tstatic unsigned int dsa_bits[DSA_NUM]={512,1024,2048};\n#endif\n\tint rsa_doit[RSA_NUM];\n\tint dsa_doit[DSA_NUM];\n\tint doit[ALGOR_NUM];\n\tint pr_header=0;\n\tapps_startup();\n\tmemset(results, 0, sizeof(results));\n#ifndef NO_DSA\n\tmemset(dsa_key,0,sizeof(dsa_key));\n#endif\n\tif (bio_err == NULL)\n\t\tif ((bio_err=BIO_new(BIO_s_file())) != NULL)\n\t\t\tBIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);\n#ifndef NO_RSA\n\tmemset(rsa_key,0,sizeof(rsa_key));\n\tfor (i=0; i<RSA_NUM; i++)\n\t\trsa_key[i]=NULL;\n#endif\n\tif ((buf=(unsigned char *)Malloc((int)BUFSIZE)) == NULL)\n\t\t{\n\t\tBIO_printf(bio_err,"out of memory\\n");\n\t\tgoto end;\n\t\t}\n#ifndef NO_DES\n\tbuf_as_des_cblock = (des_cblock *)buf;\n#endif\n\tif ((buf2=(unsigned char *)Malloc((int)BUFSIZE)) == NULL)\n\t\t{\n\t\tBIO_printf(bio_err,"out of memory\\n");\n\t\tgoto end;\n\t\t}\n\tmemset(c,0,sizeof(c));\n\tmemset(iv,0,sizeof(iv));\n\tfor (i=0; i<ALGOR_NUM; i++)\n\t\tdoit[i]=0;\n\tfor (i=0; i<RSA_NUM; i++)\n\t\trsa_doit[i]=0;\n\tfor (i=0; i<DSA_NUM; i++)\n\t\tdsa_doit[i]=0;\n\tj=0;\n\targc--;\n\targv++;\n\twhile (argc)\n\t\t{\n#ifndef NO_MD2\n\t\tif\t(strcmp(*argv,"md2") == 0) doit[D_MD2]=1;\n\t\telse\n#endif\n#ifndef NO_MDC2\n\t\t\tif (strcmp(*argv,"mdc2") == 0) doit[D_MDC2]=1;\n\t\telse\n#endif\n#ifndef NO_MD5\n\t\t\tif (strcmp(*argv,"md5") == 0) doit[D_MD5]=1;\n\t\telse\n#endif\n#ifndef NO_MD5\n\t\t\tif (strcmp(*argv,"hmac") == 0) doit[D_HMAC]=1;\n\t\telse\n#endif\n#ifndef NO_SHA\n\t\t\tif (strcmp(*argv,"sha1") == 0) doit[D_SHA1]=1;\n\t\telse\n\t\t\tif (strcmp(*argv,"sha") == 0) doit[D_SHA1]=1;\n\t\telse\n#endif\n#ifndef NO_RIPEMD\n\t\t\tif (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1;\n\t\telse\n\t\t\tif (strcmp(*argv,"rmd160") == 0) doit[D_RMD160]=1;\n\t\telse\n\t\t\tif (strcmp(*argv,"ripemd160") == 0) doit[D_RMD160]=1;\n\t\telse\n#endif\n#ifndef NO_RC4\n\t\t\tif (strcmp(*argv,"rc4") == 0) doit[D_RC4]=1;\n\t\telse\n#endif\n#ifndef NO_DES\n\t\t\tif (strcmp(*argv,"des-cbc") == 0) doit[D_CBC_DES]=1;\n\t\telse\tif (strcmp(*argv,"des-ede3") == 0) doit[D_EDE3_DES]=1;\n\t\telse\n#endif\n#ifndef NO_RSA\n#ifdef RSAref\n\t\t\tif (strcmp(*argv,"rsaref") == 0)\n\t\t\t{\n\t\t\tRSA_set_default_method(RSA_PKCS1_RSAref());\n\t\t\tj--;\n\t\t\t}\n\t\telse\n#endif\n#ifndef RSA_NULL\n\t\t\tif (strcmp(*argv,"openssl") == 0)\n\t\t\t{\n\t\t\tRSA_set_default_method(RSA_PKCS1_SSLeay());\n\t\t\tj--;\n\t\t\t}\n\t\telse\n#endif\n#endif\n\t\t     if (strcmp(*argv,"dsa512") == 0) dsa_doit[R_DSA_512]=2;\n\t\telse if (strcmp(*argv,"dsa1024") == 0) dsa_doit[R_DSA_1024]=2;\n\t\telse if (strcmp(*argv,"dsa2048") == 0) dsa_doit[R_DSA_2048]=2;\n\t\telse if (strcmp(*argv,"rsa512") == 0) rsa_doit[R_RSA_512]=2;\n\t\telse if (strcmp(*argv,"rsa1024") == 0) rsa_doit[R_RSA_1024]=2;\n\t\telse if (strcmp(*argv,"rsa2048") == 0) rsa_doit[R_RSA_2048]=2;\n\t\telse if (strcmp(*argv,"rsa4096") == 0) rsa_doit[R_RSA_4096]=2;\n\t\telse\n#ifndef NO_RC2\n\t\t     if (strcmp(*argv,"rc2-cbc") == 0) doit[D_CBC_RC2]=1;\n\t\telse if (strcmp(*argv,"rc2") == 0) doit[D_CBC_RC2]=1;\n\t\telse\n#endif\n#ifndef NO_RC5\n\t\t     if (strcmp(*argv,"rc5-cbc") == 0) doit[D_CBC_RC5]=1;\n\t\telse if (strcmp(*argv,"rc5") == 0) doit[D_CBC_RC5]=1;\n\t\telse\n#endif\n#ifndef NO_IDEA\n\t\t     if (strcmp(*argv,"idea-cbc") == 0) doit[D_CBC_IDEA]=1;\n\t\telse if (strcmp(*argv,"idea") == 0) doit[D_CBC_IDEA]=1;\n\t\telse\n#endif\n#ifndef NO_BF\n\t\t     if (strcmp(*argv,"bf-cbc") == 0) doit[D_CBC_BF]=1;\n\t\telse if (strcmp(*argv,"blowfish") == 0) doit[D_CBC_BF]=1;\n\t\telse if (strcmp(*argv,"bf") == 0) doit[D_CBC_BF]=1;\n\t\telse\n#endif\n#ifndef NO_CAST\n\t\t     if (strcmp(*argv,"cast-cbc") == 0) doit[D_CBC_CAST]=1;\n\t\telse if (strcmp(*argv,"cast") == 0) doit[D_CBC_CAST]=1;\n\t\telse if (strcmp(*argv,"cast5") == 0) doit[D_CBC_CAST]=1;\n\t\telse\n#endif\n#ifndef NO_DES\n\t\t\tif (strcmp(*argv,"des") == 0)\n\t\t\t{\n\t\t\tdoit[D_CBC_DES]=1;\n\t\t\tdoit[D_EDE3_DES]=1;\n\t\t\t}\n\t\telse\n#endif\n#ifndef NO_RSA\n\t\t\tif (strcmp(*argv,"rsa") == 0)\n\t\t\t{\n\t\t\trsa_doit[R_RSA_512]=1;\n\t\t\trsa_doit[R_RSA_1024]=1;\n\t\t\trsa_doit[R_RSA_2048]=1;\n\t\t\trsa_doit[R_RSA_4096]=1;\n\t\t\t}\n\t\telse\n#endif\n#ifndef NO_DSA\n\t\t\tif (strcmp(*argv,"dsa") == 0)\n\t\t\t{\n\t\t\tdsa_doit[R_DSA_512]=1;\n\t\t\tdsa_doit[R_DSA_1024]=1;\n\t\t\t}\n\t\telse\n#endif\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"bad value, pick one of\\n");\n\t\t\tBIO_printf(bio_err,"md2      mdc2\tmd5      hmac      sha1    rmd160\\n");\n#ifndef NO_IDEA\n\t\t\tBIO_printf(bio_err,"idea-cbc ");\n#endif\n#ifndef NO_RC2\n\t\t\tBIO_printf(bio_err,"rc2-cbc  ");\n#endif\n#ifndef NO_RC5\n\t\t\tBIO_printf(bio_err,"rc5-cbc  ");\n#endif\n#ifndef NO_BF\n\t\t\tBIO_printf(bio_err,"bf-cbc");\n#endif\n#if !defined(NO_IDEA) && !defined(NO_RC2) && !defined(NO_BF) && !defined(NO_RC5)\n\t\t\tBIO_printf(bio_err,"\\n");\n#endif\n\t\t\tBIO_printf(bio_err,"des-cbc  des-ede3 ");\n#ifndef NO_RC4\n\t\t\tBIO_printf(bio_err,"rc4");\n#endif\n#ifndef NO_RSA\n\t\t\tBIO_printf(bio_err,"\\nrsa512   rsa1024  rsa2048  rsa4096\\n");\n#endif\n#ifndef NO_DSA\n\t\t\tBIO_printf(bio_err,"\\ndsa512   dsa1024  dsa2048\\n");\n#endif\n\t\t\tBIO_printf(bio_err,"idea     rc2      des      rsa    blowfish\\n");\n\t\t\tgoto end;\n\t\t\t}\n\t\targc--;\n\t\targv++;\n\t\tj++;\n\t\t}\n\tif (j == 0)\n\t\t{\n\t\tfor (i=0; i<ALGOR_NUM; i++)\n\t\t\tdoit[i]=1;\n\t\tfor (i=0; i<RSA_NUM; i++)\n\t\t\trsa_doit[i]=1;\n\t\tfor (i=0; i<DSA_NUM; i++)\n\t\t\tdsa_doit[i]=1;\n\t\t}\n\tfor (i=0; i<ALGOR_NUM; i++)\n\t\tif (doit[i]) pr_header++;\n#ifndef TIMES\n\tBIO_printf(bio_err,"To get the most accurate results, try to run this\\n");\n\tBIO_printf(bio_err,"program when this computer is idle.\\n");\n#endif\n#ifndef NO_RSA\n\tfor (i=0; i<RSA_NUM; i++)\n\t\t{\n\t\tunsigned char *p;\n\t\tp=rsa_data[i];\n\t\trsa_key[i]=d2i_RSAPrivateKey(NULL,&p,rsa_data_length[i]);\n\t\tif (rsa_key[i] == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"internal error loading RSA key number %d\\n",i);\n\t\t\tgoto end;\n\t\t\t}\n#if 0\n\t\telse\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"Loaded RSA key, %d bit modulus and e= 0x",BN_num_bits(rsa_key[i]->n));\n\t\t\tBN_print(bio_err,rsa_key[i]->e);\n\t\t\tBIO_printf(bio_err,"\\n");\n\t\t\t}\n#endif\n\t\t}\n#endif\n#ifndef NO_DSA\n\tdsa_key[0]=get_dsa512();\n\tdsa_key[1]=get_dsa1024();\n\tdsa_key[2]=get_dsa2048();\n#endif\n#ifndef NO_DES\n\tdes_set_key(&key,sch);\n\tdes_set_key(&key2,sch2);\n\tdes_set_key(&key3,sch3);\n#endif\n#ifndef NO_IDEA\n\tidea_set_encrypt_key(key16,&idea_ks);\n#endif\n#ifndef NO_RC4\n\tRC4_set_key(&rc4_ks,16,key16);\n#endif\n#ifndef NO_RC2\n\tRC2_set_key(&rc2_ks,16,key16,128);\n#endif\n#ifndef NO_RC5\n\tRC5_32_set_key(&rc5_ks,16,key16,12);\n#endif\n#ifndef NO_BF\n\tBF_set_key(&bf_ks,16,key16);\n#endif\n#ifndef NO_CAST\n\tCAST_set_key(&cast_ks,16,key16);\n#endif\n#ifndef NO_RSA\n\tmemset(rsa_c,0,sizeof(rsa_c));\n#endif\n#ifndef SIGALRM\n\tBIO_printf(bio_err,"First we calculate the approximate speed ...\\n");\n\tcount=10;\n\tdo\t{\n\t\tlong i;\n\t\tcount*=2;\n\t\tTime_F(START);\n\t\tfor (i=count; i; i--)\n\t\t\tdes_ecb_encrypt(buf_as_des_cblock,buf_as_des_cblock,\n\t\t\t\t&(sch[0]),DES_ENCRYPT);\n\t\td=Time_F(STOP);\n\t\t} while (d <3);\n\tc[D_MD2][0]=count/10;\n\tc[D_MDC2][0]=count/10;\n\tc[D_MD5][0]=count;\n\tc[D_HMAC][0]=count;\n\tc[D_SHA1][0]=count;\n\tc[D_RMD160][0]=count;\n\tc[D_RC4][0]=count*5;\n\tc[D_CBC_DES][0]=count;\n\tc[D_EDE3_DES][0]=count/3;\n\tc[D_CBC_IDEA][0]=count;\n\tc[D_CBC_RC2][0]=count;\n\tc[D_CBC_RC5][0]=count;\n\tc[D_CBC_BF][0]=count;\n\tc[D_CBC_CAST][0]=count;\n\tfor (i=1; i<SIZE_NUM; i++)\n\t\t{\n\t\tc[D_MD2][i]=c[D_MD2][0]*4*lengths[0]/lengths[i];\n\t\tc[D_MDC2][i]=c[D_MDC2][0]*4*lengths[0]/lengths[i];\n\t\tc[D_MD5][i]=c[D_MD5][0]*4*lengths[0]/lengths[i];\n\t\tc[D_HMAC][i]=c[D_HMAC][0]*4*lengths[0]/lengths[i];\n\t\tc[D_SHA1][i]=c[D_SHA1][0]*4*lengths[0]/lengths[i];\n\t\tc[D_RMD160][i]=c[D_RMD160][0]*4*lengths[0]/lengths[i];\n\t\t}\n\tfor (i=1; i<SIZE_NUM; i++)\n\t\t{\n\t\tlong l0,l1;\n\t\tl0=(long)lengths[i-1];\n\t\tl1=(long)lengths[i];\n\t\tc[D_RC4][i]=c[D_RC4][i-1]*l0/l1;\n\t\tc[D_CBC_DES][i]=c[D_CBC_DES][i-1]*l0/l1;\n\t\tc[D_EDE3_DES][i]=c[D_EDE3_DES][i-1]*l0/l1;\n\t\tc[D_CBC_IDEA][i]=c[D_CBC_IDEA][i-1]*l0/l1;\n\t\tc[D_CBC_RC2][i]=c[D_CBC_RC2][i-1]*l0/l1;\n\t\tc[D_CBC_RC5][i]=c[D_CBC_RC5][i-1]*l0/l1;\n\t\tc[D_CBC_BF][i]=c[D_CBC_BF][i-1]*l0/l1;\n\t\tc[D_CBC_CAST][i]=c[D_CBC_CAST][i-1]*l0/l1;\n\t\t}\n#ifndef NO_RSA\n\trsa_c[R_RSA_512][0]=count/2000;\n\trsa_c[R_RSA_512][1]=count/400;\n\tfor (i=1; i<RSA_NUM; i++)\n\t\t{\n\t\trsa_c[i][0]=rsa_c[i-1][0]/8;\n\t\trsa_c[i][1]=rsa_c[i-1][1]/4;\n\t\tif ((rsa_doit[i] <= 1) && (rsa_c[i][0] == 0))\n\t\t\trsa_doit[i]=0;\n\t\telse\n\t\t\t{\n\t\t\tif (rsa_c[i][0] == 0)\n\t\t\t\t{\n\t\t\t\trsa_c[i][0]=1;\n\t\t\t\trsa_c[i][1]=20;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n#endif\n\tdsa_c[R_DSA_512][0]=count/1000;\n\tdsa_c[R_DSA_512][1]=count/1000/2;\n\tfor (i=1; i<DSA_NUM; i++)\n\t\t{\n\t\tdsa_c[i][0]=dsa_c[i-1][0]/4;\n\t\tdsa_c[i][1]=dsa_c[i-1][1]/4;\n\t\tif ((dsa_doit[i] <= 1) && (dsa_c[i][0] == 0))\n\t\t\tdsa_doit[i]=0;\n\t\telse\n\t\t\t{\n\t\t\tif (dsa_c[i] == 0)\n\t\t\t\t{\n\t\t\t\tdsa_c[i][0]=1;\n\t\t\t\tdsa_c[i][1]=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n#define COND(d)\t(count < (d))\n#define COUNT(d) (d)\n#else\n#define COND(c)\t(run)\n#define COUNT(d) (count)\n\tsignal(SIGALRM,sig_done);\n#endif\n#ifndef NO_MD2\n\tif (doit[D_MD2])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_MD2],c[D_MD2][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_MD2][j]); count++)\n\t\t\t\tMD2(buf,(unsigned long)lengths[j],&(md2[0]));\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_MD2],d);\n\t\t\tresults[D_MD2][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_MDC2\n\tif (doit[D_MDC2])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_MDC2],c[D_MDC2][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_MDC2][j]); count++)\n\t\t\t\tMDC2(buf,(unsigned long)lengths[j],&(mdc2[0]));\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_MDC2],d);\n\t\t\tresults[D_MDC2][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_MD5\n\tif (doit[D_MD5])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_MD5],c[D_MD5][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_MD5][j]); count++)\n\t\t\t\tMD5(&(buf[0]),(unsigned long)lengths[j],&(md5[0]));\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_MD5],d);\n\t\t\tresults[D_MD5][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#if !defined(NO_MD5) && !defined(NO_HMAC)\n\tif (doit[D_HMAC])\n\t\t{\n\t\tHMAC_CTX hctx;\n\t\tHMAC_Init(&hctx,(unsigned char *)"This is a key...",\n\t\t\t16,EVP_md5());\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_HMAC],c[D_HMAC][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_HMAC][j]); count++)\n\t\t\t\t{\n\t\t\t\tHMAC_Init(&hctx,NULL,0,NULL);\n                                HMAC_Update(&hctx,buf,lengths[j]);\n                                HMAC_Final(&hctx,&(hmac[0]),NULL);\n\t\t\t\t}\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_HMAC],d);\n\t\t\tresults[D_HMAC][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_SHA\n\tif (doit[D_SHA1])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_SHA1],c[D_SHA1][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_SHA1][j]); count++)\n\t\t\t\tSHA1(buf,(unsigned long)lengths[j],&(sha[0]));\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_SHA1],d);\n\t\t\tresults[D_SHA1][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_RIPEMD\n\tif (doit[D_RMD160])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_RMD160],c[D_RMD160][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_RMD160][j]); count++)\n\t\t\t\tRIPEMD160(buf,(unsigned long)lengths[j],&(rmd160[0]));\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_RMD160],d);\n\t\t\tresults[D_RMD160][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_RC4\n\tif (doit[D_RC4])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_RC4],c[D_RC4][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_RC4][j]); count++)\n\t\t\t\tRC4(&rc4_ks,(unsigned int)lengths[j],\n\t\t\t\t\tbuf,buf);\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_RC4],d);\n\t\t\tresults[D_RC4][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_DES\n\tif (doit[D_CBC_DES])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_CBC_DES],c[D_CBC_DES][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_CBC_DES][j]); count++)\n\t\t\t\tdes_ncbc_encrypt(buf,buf,lengths[j],sch,\n\t\t\t\t\t\t &iv,DES_ENCRYPT);\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_CBC_DES],d);\n\t\t\tresults[D_CBC_DES][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n\tif (doit[D_EDE3_DES])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_EDE3_DES],c[D_EDE3_DES][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_EDE3_DES][j]); count++)\n\t\t\t\tdes_ede3_cbc_encrypt(buf,buf,lengths[j],\n\t\t\t\t\t\t     sch,sch2,sch3,\n\t\t\t\t\t\t     &iv,DES_ENCRYPT);\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_EDE3_DES],d);\n\t\t\tresults[D_EDE3_DES][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_IDEA\n\tif (doit[D_CBC_IDEA])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_CBC_IDEA],c[D_CBC_IDEA][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_CBC_IDEA][j]); count++)\n\t\t\t\tidea_cbc_encrypt(buf,buf,\n\t\t\t\t\t(unsigned long)lengths[j],&idea_ks,\n\t\t\t\t\tiv,IDEA_ENCRYPT);\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_CBC_IDEA],d);\n\t\t\tresults[D_CBC_IDEA][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_RC2\n\tif (doit[D_CBC_RC2])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_CBC_RC2],c[D_CBC_RC2][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_CBC_RC2][j]); count++)\n\t\t\t\tRC2_cbc_encrypt(buf,buf,\n\t\t\t\t\t(unsigned long)lengths[j],&rc2_ks,\n\t\t\t\t\tiv,RC2_ENCRYPT);\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_CBC_RC2],d);\n\t\t\tresults[D_CBC_RC2][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_RC5\n\tif (doit[D_CBC_RC5])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_CBC_RC5],c[D_CBC_RC5][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_CBC_RC5][j]); count++)\n\t\t\t\tRC5_32_cbc_encrypt(buf,buf,\n\t\t\t\t\t(unsigned long)lengths[j],&rc5_ks,\n\t\t\t\t\tiv,RC5_ENCRYPT);\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_CBC_RC5],d);\n\t\t\tresults[D_CBC_RC5][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_BF\n\tif (doit[D_CBC_BF])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_CBC_BF],c[D_CBC_BF][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_CBC_BF][j]); count++)\n\t\t\t\tBF_cbc_encrypt(buf,buf,\n\t\t\t\t\t(unsigned long)lengths[j],&bf_ks,\n\t\t\t\t\tiv,BF_ENCRYPT);\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_CBC_BF],d);\n\t\t\tresults[D_CBC_BF][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n#ifndef NO_CAST\n\tif (doit[D_CBC_CAST])\n\t\t{\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tprint_message(names[D_CBC_CAST],c[D_CBC_CAST][j],lengths[j]);\n\t\t\tTime_F(START);\n\t\t\tfor (count=0,run=1; COND(c[D_CBC_CAST][j]); count++)\n\t\t\t\tCAST_cbc_encrypt(buf,buf,\n\t\t\t\t\t(unsigned long)lengths[j],&cast_ks,\n\t\t\t\t\tiv,CAST_ENCRYPT);\n\t\t\td=Time_F(STOP);\n\t\t\tBIO_printf(bio_err,"%ld %s\'s in %.2fs\\n",\n\t\t\t\tcount,names[D_CBC_CAST],d);\n\t\t\tresults[D_CBC_CAST][j]=((double)count)/d*lengths[j];\n\t\t\t}\n\t\t}\n#endif\n\tRAND_bytes(buf,36);\n#ifndef NO_RSA\n\tfor (j=0; j<RSA_NUM; j++)\n\t\t{\n\t\tint ret;\n\t\tif (!rsa_doit[j]) continue;\n\t\tret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num, rsa_key[j]);\n\t\tpkey_print_message("private","rsa",rsa_c[j][0],rsa_bits[j],\n\t\t\tRSA_SECONDS);\n\t\tTime_F(START);\n\t\tfor (count=0,run=1; COND(rsa_c[j][0]); count++)\n\t\t\t{\n\t\t\tret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num,\n\t\t\t\t\t\t\t\t rsa_key[j]);\n\t\t\tif (ret <= 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"RSA private encrypt failure\\n");\n\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\tcount=1;\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\td=Time_F(STOP);\n\t\tBIO_printf(bio_err,"%ld %d bit private RSA\'s in %.2fs\\n",\n\t\t\tcount,rsa_bits[j],d);\n\t\trsa_results[j][0]=d/(double)count;\n\t\trsa_count=count;\n#if 1\n\t\tret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num, rsa_key[j]);\n\t\tpkey_print_message("public","rsa",rsa_c[j][1],rsa_bits[j],\n\t\t\tRSA_SECONDS);\n\t\tTime_F(START);\n\t\tfor (count=0,run=1; COND(rsa_c[j][1]); count++)\n\t\t\t{\n\t\t\tret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num,\n\t\t\t\t\t\t\t\trsa_key[j]);\n\t\t\tif (ret <= 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"RSA verify failure\\n");\n\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\tcount=1;\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\td=Time_F(STOP);\n\t\tBIO_printf(bio_err,"%ld %d bit public RSA\'s in %.2fs\\n",\n\t\t\tcount,rsa_bits[j],d);\n\t\trsa_results[j][1]=d/(double)count;\n#endif\n\t\tif (rsa_count <= 1)\n\t\t\t{\n\t\t\tfor (j++; j<RSA_NUM; j++)\n\t\t\t\trsa_doit[j]=0;\n\t\t\t}\n\t\t}\n#endif\n\tRAND_bytes(buf,20);\n#ifndef NO_DSA\n\tfor (j=0; j<DSA_NUM; j++)\n\t\t{\n\t\tunsigned int kk;\n\t\tif (!dsa_doit[j]) continue;\n\t\tDSA_generate_key(dsa_key[j]);\n\t\trsa_num=DSA_sign(EVP_PKEY_DSA,buf,20,buf2,\n\t\t\t&kk,dsa_key[j]);\n\t\tpkey_print_message("sign","dsa",dsa_c[j][0],dsa_bits[j],\n\t\t\tDSA_SECONDS);\n\t\tTime_F(START);\n\t\tfor (count=0,run=1; COND(dsa_c[j][0]); count++)\n\t\t\t{\n\t\t\trsa_num=DSA_sign(EVP_PKEY_DSA,buf,20,buf2,\n\t\t\t\t&kk,dsa_key[j]);\n\t\t\tif (rsa_num <= 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"DSA sign failure\\n");\n\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\tcount=1;\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\td=Time_F(STOP);\n\t\tBIO_printf(bio_err,"%ld %d bit DSA signs in %.2fs\\n",\n\t\t\tcount,dsa_bits[j],d);\n\t\tdsa_results[j][0]=d/(double)count;\n\t\trsa_count=count;\n\t\trsa_num2=DSA_verify(EVP_PKEY_DSA,buf,20,buf2,\n\t\t\tkk,dsa_key[j]);\n\t\tpkey_print_message("verify","dsa",dsa_c[j][1],dsa_bits[j],\n\t\t\tDSA_SECONDS);\n\t\tTime_F(START);\n\t\tfor (count=0,run=1; COND(dsa_c[j][1]); count++)\n\t\t\t{\n\t\t\trsa_num2=DSA_verify(EVP_PKEY_DSA,buf,20,buf2,\n\t\t\t\tkk,dsa_key[j]);\n\t\t\tif (rsa_num2 <= 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"DSA verify failure\\n");\n\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\tcount=1;\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\td=Time_F(STOP);\n\t\tBIO_printf(bio_err,"%ld %d bit DSA verify in %.2fs\\n",\n\t\t\tcount,dsa_bits[j],d);\n\t\tdsa_results[j][1]=d/(double)count;\n\t\tif (rsa_count <= 1)\n\t\t\t{\n\t\t\tfor (j++; j<DSA_NUM; j++)\n\t\t\t\tdsa_doit[j]=0;\n\t\t\t}\n\t\t}\n#endif\n\tfprintf(stdout,"%s\\n",SSLeay_version(SSLEAY_VERSION));\n        fprintf(stdout,"%s\\n",SSLeay_version(SSLEAY_BUILT_ON));\n\tprintf("options:");\n\tprintf("%s ",BN_options());\n#ifndef NO_MD2\n\tprintf("%s ",MD2_options());\n#endif\n#ifndef NO_RC4\n\tprintf("%s ",RC4_options());\n#endif\n#ifndef NO_DES\n\tprintf("%s ",des_options());\n#endif\n#ifndef NO_IDEA\n\tprintf("%s ",idea_options());\n#endif\n#ifndef NO_BF\n\tprintf("%s ",BF_options());\n#endif\n\tfprintf(stdout,"\\n%s\\n",SSLeay_version(SSLEAY_CFLAGS));\n\tif (pr_header)\n\t\t{\n\t\tfprintf(stdout,"The \'numbers\' are in 1000s of bytes per second processed.\\n");\n\t\tfprintf(stdout,"type        ");\n\t\tfor (j=0;  j<SIZE_NUM; j++)\n\t\t\tfprintf(stdout,"%7d bytes",lengths[j]);\n\t\tfprintf(stdout,"\\n");\n\t\t}\n\tfor (k=0; k<ALGOR_NUM; k++)\n\t\t{\n\t\tif (!doit[k]) continue;\n\t\tfprintf(stdout,"%-13s",names[k]);\n\t\tfor (j=0; j<SIZE_NUM; j++)\n\t\t\t{\n\t\t\tif (results[k][j] > 10000)\n\t\t\t\tfprintf(stdout," %11.2fk",results[k][j]/1e3);\n\t\t\telse\n\t\t\t\tfprintf(stdout," %11.2f ",results[k][j]);\n\t\t\t}\n\t\tfprintf(stdout,"\\n");\n\t\t}\n#ifndef NO_RSA\n\tj=1;\n\tfor (k=0; k<RSA_NUM; k++)\n\t\t{\n\t\tif (!rsa_doit[k]) continue;\n\t\tif (j)\n\t\t\t{\n\t\t\tprintf("%18ssign    verify    sign/s verify/s\\n"," ");\n\t\t\tj=0;\n\t\t\t}\n\t\tfprintf(stdout,"rsa %4u bits %8.4fs %8.4fs %8.1f %8.1f",\n\t\t\trsa_bits[k],rsa_results[k][0],rsa_results[k][1],\n\t\t\t1.0/rsa_results[k][0],1.0/rsa_results[k][1]);\n\t\tfprintf(stdout,"\\n");\n\t\t}\n#endif\n#ifndef NO_DSA\n\tj=1;\n\tfor (k=0; k<DSA_NUM; k++)\n\t\t{\n\t\tif (!dsa_doit[k]) continue;\n\t\tif (j)\t{\n\t\t\tprintf("%18ssign    verify    sign/s verify/s\\n"," ");\n\t\t\tj=0;\n\t\t\t}\n\t\tfprintf(stdout,"dsa %4u bits %8.4fs %8.4fs %8.1f %8.1f",\n\t\t\tdsa_bits[k],dsa_results[k][0],dsa_results[k][1],\n\t\t\t1.0/dsa_results[k][0],1.0/dsa_results[k][1]);\n\t\tfprintf(stdout,"\\n");\n\t\t}\n#endif\n\tret=0;\nend:\n\tif (buf != NULL) Free(buf);\n\tif (buf2 != NULL) Free(buf2);\n#ifndef NO_RSA\n\tfor (i=0; i<RSA_NUM; i++)\n\t\tif (rsa_key[i] != NULL)\n\t\t\tRSA_free(rsa_key[i]);\n#endif\n#ifndef NO_DSA\n\tfor (i=0; i<DSA_NUM; i++)\n\t\tif (dsa_key[i] != NULL)\n\t\t\tDSA_free(dsa_key[i]);\n#endif\n\tEXIT(ret);\n\t}']