Timings.
[openssl.git] / crypto / bn / expspeed.c
index 07c36b2dd241c7b1a09ad49c59c06b9a171c4b1f..e9c1fee7ab44dcfd3574f9a123b8230efeafea30 100644 (file)
@@ -1,3 +1,5 @@
+/* unused */
+
 /* crypto/bn/expspeed.c */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
 #include <openssl/crypto.h>
 #include <openssl/err.h>
 
-#ifndef MSDOS
+#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC))
 #define TIMES
 #endif
 
-#ifndef VMS
 #ifndef _IRIX
 #include <time.h>
 #endif
 #include <sys/types.h>
 #include <sys/times.h>
 #endif
-#else /* VMS */
-#include <types.h>
-struct tms {
-       time_t tms_utime;
-       time_t tms_stime;
-       time_t tms_uchild;      /* I dunno...  */
-       time_t tms_uchildsys;   /* so these names are a guess :-) */
-       }
+
+/* Depending on the VMS version, the tms structure is perhaps defined.
+   The __TMS macro will show if it was.  If it wasn't defined, we should
+   undefine TIMES, since that tells the rest of the program how things
+   should be handled.                          -- Richard Levitte */
+#if defined(VMS) && defined(__DECC) && !defined(__TMS)
+#undef TIMES
 #endif
+
 #ifndef TIMES
 #include <sys/timeb.h>
 #endif
@@ -107,11 +108,7 @@ struct tms {
 #ifndef HZ
 # ifndef CLK_TCK
 #  ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
-#   ifndef VMS
-#    define HZ 100.0
-#   else /* VMS */
-#    define HZ 100.0
-#   endif
+#   define HZ  100.0
 #  else /* _BSD_CLK_TCK_ */
 #   define HZ ((double)_BSD_CLK_TCK_)
 #  endif
@@ -124,12 +121,7 @@ struct tms {
 #define BUFSIZE        ((long)1024*8)
 int run=0;
 
-#ifndef NOPROTO
 static double Time_F(int s);
-#else
-static double Time_F();
-#endif
-
 #define START  0
 #define STOP   1
 
@@ -195,9 +187,6 @@ void do_mul_exp(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx)
        int i,k;
        double tm;
        long num;
-       BN_MONT_CTX m;
-
-       memset(&m,0,sizeof(m));
 
        num=BASENUM;
        for (i=0; i<NUM_SIZES; i++)
@@ -208,11 +197,9 @@ void do_mul_exp(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx)
                BN_mod(a,a,c,ctx);
                BN_mod(b,b,c,ctx);
 
-               BN_MONT_CTX_set(&m,c,ctx);
-
                Time_F(START);
                for (k=0; k<num; k++)
-                       BN_mod_exp_mont(r,a,b,c,ctx,&m);
+                       BN_mod_exp(r,a,b,c,ctx);
                tm=Time_F(STOP);
                printf("mul %4d ^ %4d %% %d -> %8.3fms %5.1f\n",sizes[i],sizes[i],sizes[i],tm*1000.0/num,tm*mul_c[i]/num);
                num/=7;