Remove NOPROTO definitions and error code comments.
[openssl.git] / crypto / bn / bnspeed.c
index f7c2790fff43b08e198e8f7051fd3b5f30c2b44a..0321f66d6cf3d959991687de0b4ec1199328ec9d 100644 (file)
@@ -66,8 +66,8 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <string.h>
-#include "crypto.h"
-#include "err.h"
+#include <openssl/crypto.h>
+#include <openssl/err.h>
 
 #ifndef MSDOS
 #define TIMES
@@ -94,13 +94,14 @@ struct tms {
 #include <sys/timeb.h>
 #endif
 
-#ifdef sun
+#if defined(sun) || defined(__ultrix)
+#define _POSIX_SOURCE
 #include <limits.h>
 #include <sys/param.h>
 #endif
 
-#include "bn.h"
-#include "x509.h"
+#include <openssl/bn.h>
+#include <openssl/x509.h>
 
 /* The following if from times(3) man page.  It may need to be changed */
 #ifndef HZ
@@ -123,17 +124,11 @@ 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
 
-static double Time_F(s)
-int s;
+static double Time_F(int s)
        {
        double ret;
 #ifdef TIMES
@@ -175,27 +170,20 @@ static int sizes[NUM_SIZES]={128,256,512,1024,2048};
 
 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;
@@ -211,7 +199,7 @@ BN_CTX *ctx;
                        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);
                        }