#include <sys/timeb.h>
#endif
-#ifdef sun
+#if defined(sun) || defined(__ultrix)
+#define _POSIX_SOURCE
#include <limits.h>
#include <sys/param.h>
#endif
#define START 0
#define STOP 1
-static double Time_F(s)
-int s;
+static double Time_F(int s)
{
double ret;
#ifdef TIMES
void do_mul(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_CTX *ctx);
-int main(argc,argv)
-int argc;
-char **argv;
+int main(int argc, char **argv)
{
BN_CTX *ctx;
- BIGNUM *a,*b,*c,*r;
+ BIGNUM a,b,c;
ctx=BN_CTX_new();
- a=BN_new();
- b=BN_new();
- c=BN_new();
- r=BN_new();
+ BN_init(&a);
+ BN_init(&b);
+ BN_init(&c);
- do_mul(a,b,c,ctx);
+ do_mul(&a,&b,&c,ctx);
}
-void do_mul(r,a,b,ctx)
-BIGNUM *r;
-BIGNUM *a;
-BIGNUM *b;
-BN_CTX *ctx;
+void do_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
{
int i,j,k;
double tm;
BN_rand(b,sizes[j],1,0);
Time_F(START);
for (k=0; k<num; k++)
- BN_mul(r,b,a);
+ BN_mul(r,b,a,ctx);
tm=Time_F(STOP);
printf("mul %4d x %4d -> %8.3fms\n",sizes[i],sizes[j],tm*1000.0/num);
}