Import of old SSLeay release: SSLeay 0.9.0b
[openssl.git] / crypto / bf / bfspeed.c
index ee20bd00f71a815484e4322c5d5b12c00f2b757b..640d820dd3c2f6a9e8370de111ad15d373016c88 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/bf/bfspeed.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
  * This package is an SSL implementation written
@@ -217,7 +217,7 @@ char **argv;
                count*=2;
                Time_F(START);
                for (i=count; i; i--)
-                       BF_encrypt(data,&sch,BF_ENCRYPT);
+                       BF_encrypt(data,&sch);
                d=Time_F(STOP);
                } while (d < 3.0);
        ca=count/512;
@@ -235,10 +235,15 @@ char **argv;
 #endif
 
        Time_F(START);
-       for (count=0,run=1; COND(ca); count++)
+       for (count=0,run=1; COND(ca); count+=4)
+               {
+               BF_set_key(&sch,16,key);
+               BF_set_key(&sch,16,key);
                BF_set_key(&sch,16,key);
+               BF_set_key(&sch,16,key);
+               }
        d=Time_F(STOP);
-       printf("%ld blowfish set_key's in %.2f seconds\n",count,d);
+       printf("%ld BF_set_key's in %.2f seconds\n",count,d);
        a=((double)COUNT(ca))/d;
 
 #ifdef SIGALRM
@@ -248,11 +253,14 @@ char **argv;
        printf("Doing BF_encrypt %ld times\n",cb);
 #endif
        Time_F(START);
-       for (count=0,run=1; COND(cb); count++)
+       for (count=0,run=1; COND(cb); count+=4)
                {
                BF_LONG data[2];
 
-               BF_encrypt(data,&sch,BF_ENCRYPT);
+               BF_encrypt(data,&sch);
+               BF_encrypt(data,&sch);
+               BF_encrypt(data,&sch);
+               BF_encrypt(data,&sch);
                }
        d=Time_F(STOP);
        printf("%ld BF_encrypt's in %.2f second\n",count,d);
@@ -275,9 +283,9 @@ char **argv;
                count,BUFSIZE,d);
        c=((double)COUNT(cc)*BUFSIZE)/d;
 
-       printf("blowfish set_key       per sec = %12.2f (%7.1fuS)\n",a,1.0e6/a);
-       printf("Blowfish raw ecb bytes per sec = %12.2f (%7.1fuS)\n",b,8.0e6/b);
-       printf("Blowfish cbc     bytes per sec = %12.2f (%7.1fuS)\n",c,8.0e6/c);
+       printf("Blowfish set_key       per sec = %12.3f (%9.3fuS)\n",a,1.0e6/a);
+       printf("Blowfish raw ecb bytes per sec = %12.3f (%9.3fuS)\n",b,8.0e6/b);
+       printf("Blowfish cbc     bytes per sec = %12.3f (%9.3fuS)\n",c,8.0e6/c);
        exit(0);
 #if defined(LINT) || defined(MSDOS)
        return(0);