summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>1999-04-19 21:31:43 +0000
committerUlf Möller <ulf@openssl.org>1999-04-19 21:31:43 +0000
commit6b691a5c85ddc4e407e32781841fee5c029506cd (patch)
tree436f1127406e1cacfe83dfcbfff824d89c47d834 /crypto/bn
parent3edd7ed15de229230f74c79c3d71e7c9c674cf4f (diff)
Change functions to ANSI C.
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_add.c20
-rw-r--r--crypto/bn/bn_asm.c70
-rw-r--r--crypto/bn/bn_blind.c22
-rw-r--r--crypto/bn/bn_comba.c12
-rw-r--r--crypto/bn/bn_div.c21
-rw-r--r--crypto/bn/bn_err.c2
-rw-r--r--crypto/bn/bn_exp.c46
-rw-r--r--crypto/bn/bn_exp2.c11
-rw-r--r--crypto/bn/bn_gcd.c13
-rw-r--r--crypto/bn/bn_lib.c93
-rw-r--r--crypto/bn/bn_m.c14
-rw-r--r--crypto/bn/bn_mont.c29
-rw-r--r--crypto/bn/bn_mpi.c9
-rw-r--r--crypto/bn/bn_mul.c38
-rw-r--r--crypto/bn/bn_opts.c36
-rw-r--r--crypto/bn/bn_prime.c50
-rw-r--r--crypto/bn/bn_print.c22
-rw-r--r--crypto/bn/bn_rand.c6
-rw-r--r--crypto/bn/bn_recp.c35
-rw-r--r--crypto/bn/bn_shift.c18
-rw-r--r--crypto/bn/bn_sqr.c16
-rw-r--r--crypto/bn/bn_word.c20
-rw-r--r--crypto/bn/bnspeed.c13
-rw-r--r--crypto/bn/bntest.c59
-rw-r--r--crypto/bn/expspeed.c14
-rw-r--r--crypto/bn/exptest.c4
-rw-r--r--crypto/bn/old/b_sqr.c10
-rw-r--r--crypto/bn/old/bn_high.c4
-rw-r--r--crypto/bn/old/bn_ka.c29
-rw-r--r--crypto/bn/old/bn_low.c13
-rw-r--r--crypto/bn/old/bn_m.c7
-rw-r--r--crypto/bn/old/bn_wmul.c14
-rw-r--r--crypto/bn/test.c21
33 files changed, 203 insertions, 588 deletions
diff --git a/crypto/bn/bn_add.c b/crypto/bn/bn_add.c
index caea96f3b5..cd7d48d71e 100644
--- a/crypto/bn/bn_add.c
+++ b/crypto/bn/bn_add.c
@@ -61,10 +61,7 @@
#include "bn_lcl.h"
/* r can == a or b */
-int BN_add(r, a, b)
-BIGNUM *r;
-BIGNUM *a;
-BIGNUM *b;
+int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b)
{
BIGNUM *tmp;
@@ -107,10 +104,7 @@ BIGNUM *b;
}
/* unsigned add of b to a, r must be large enough */
-int BN_uadd(r,a,b)
-BIGNUM *r;
-BIGNUM *a;
-BIGNUM *b;
+int BN_uadd(BIGNUM *r, BIGNUM *a, BIGNUM *b)
{
register int i;
int max,min;
@@ -170,10 +164,7 @@ BIGNUM *b;
}
/* unsigned subtraction of b from a, a must be larger than b. */
-int BN_usub(r, a, b)
-BIGNUM *r;
-BIGNUM *a;
-BIGNUM *b;
+int BN_usub(BIGNUM *r, BIGNUM *a, BIGNUM *b)
{
int max,min;
register BN_ULONG t1,t2,*ap,*bp,*rp;
@@ -264,10 +255,7 @@ BIGNUM *b;
return(1);
}
-int BN_sub(r, a, b)
-BIGNUM *r;
-BIGNUM *a;
-BIGNUM *b;
+int BN_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b)
{
int max;
int add=0,neg=0;
diff --git a/crypto/bn/bn_asm.c b/crypto/bn/bn_asm.c
index cdf20efa4f..05ede3b250 100644
--- a/crypto/bn/bn_asm.c
+++ b/crypto/bn/bn_asm.c
@@ -62,10 +62,7 @@
#ifdef BN_LLONG
-BN_ULONG bn_mul_add_words(rp,ap,num,w)
-BN_ULONG *rp,*ap;
-int num;
-BN_ULONG w;
+BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
{
BN_ULONG c1=0;
@@ -89,10 +86,7 @@ BN_ULONG w;
return(c1);
}
-BN_ULONG bn_mul_words(rp,ap,num,w)
-BN_ULONG *rp,*ap;
-int num;
-BN_ULONG w;
+BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
{
BN_ULONG c1=0;
@@ -115,9 +109,7 @@ BN_ULONG w;
return(c1);
}
-void bn_sqr_words(r,a,n)
-BN_ULONG *r,*a;
-int n;
+void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
{
bn_check_num(n);
if (n <= 0) return;
@@ -148,10 +140,7 @@ int n;
#else
-BN_ULONG bn_mul_add_words(rp,ap,num,w)
-BN_ULONG *rp,*ap;
-int num;
-BN_ULONG w;
+BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
{
BN_ULONG c=0;
BN_ULONG bl,bh;
@@ -178,10 +167,7 @@ BN_ULONG w;
return(c);
}
-BN_ULONG bn_mul_words(rp,ap,num,w)
-BN_ULONG *rp,*ap;
-int num;
-BN_ULONG w;
+BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
{
BN_ULONG carry=0;
BN_ULONG bl,bh;
@@ -208,9 +194,7 @@ BN_ULONG w;
return(carry);
}
-void bn_sqr_words(r,a,n)
-BN_ULONG *r,*a;
-int n;
+void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
{
bn_check_num(n);
if (n <= 0) return;
@@ -237,8 +221,7 @@ int n;
#if defined(BN_LLONG) && defined(BN_DIV2W)
-BN_ULONG bn_div_words(h,l,d)
-BN_ULONG h,l,d;
+BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
{
return((BN_ULONG)(((((BN_ULLONG)h)<<BN_BITS2)|l)/(BN_ULLONG)d));
}
@@ -247,8 +230,7 @@ BN_ULONG h,l,d;
/* Divide h-l by d and return the result. */
/* I need to test this some more :-( */
-BN_ULONG bn_div_words(h,l,d)
-BN_ULONG h,l,d;
+BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
{
BN_ULONG dh,dl,q,ret=0,th,tl,t;
int i,count=2;
@@ -318,9 +300,7 @@ BN_ULONG h,l,d;
#endif
#ifdef BN_LLONG
-BN_ULONG bn_add_words(r,a,b,n)
-BN_ULONG *r,*a,*b;
-int n;
+BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
{
BN_ULLONG ll=0;
@@ -356,9 +336,7 @@ int n;
return((BN_ULONG)ll);
}
#else
-BN_ULONG bn_add_words(r,a,b,n)
-BN_ULONG *r,*a,*b;
-int n;
+BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
{
BN_ULONG c,l,t;
@@ -408,9 +386,7 @@ int n;
}
#endif
-BN_ULONG bn_sub_words(r,a,b,n)
-BN_ULONG *r,*a,*b;
-int n;
+BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
{
BN_ULONG t1,t2;
int c=0;
@@ -510,8 +486,7 @@ int n;
mul_add_c2((a)[i],(a)[j],c0,c1,c2)
#endif
-void bn_mul_comba8(r,a,b)
-BN_ULONG *r,*a,*b;
+void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
#ifdef BN_LLONG
BN_ULLONG t;
@@ -620,8 +595,7 @@ BN_ULONG *r,*a,*b;
r[15]=c1;
}
-void bn_mul_comba4(r,a,b)
-BN_ULONG *r,*a,*b;
+void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
#ifdef BN_LLONG
BN_ULLONG t;
@@ -666,8 +640,7 @@ BN_ULONG *r,*a,*b;
r[7]=c2;
}
-void bn_sqr_comba8(r,a)
-BN_ULONG *r,*a;
+void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
{
#ifdef BN_LLONG
BN_ULLONG t,tt;
@@ -748,8 +721,7 @@ BN_ULONG *r,*a;
r[15]=c1;
}
-void bn_sqr_comba4(r,a)
-BN_ULONG *r,*a;
+void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a)
{
#ifdef BN_LLONG
BN_ULLONG t,tt;
@@ -791,23 +763,20 @@ BN_ULONG *r,*a;
/* hmm... is it faster just to do a multiply? */
#undef bn_sqr_comba4
-void bn_sqr_comba4(r,a)
-BN_ULONG *r,*a;
+void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a)
{
BN_ULONG t[8];
bn_sqr_normal(r,a,4,t);
}
#undef bn_sqr_comba8
-void bn_sqr_comba8(r,a)
-BN_ULONG *r,*a;
+void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
{
BN_ULONG t[16];
bn_sqr_normal(r,a,8,t);
}
-void bn_mul_comba4(r,a,b)
-BN_ULONG *r,*a,*b;
+void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
r[4]=bn_mul_words( &(r[0]),a,4,b[0]);
r[5]=bn_mul_add_words(&(r[1]),a,4,b[1]);
@@ -815,8 +784,7 @@ BN_ULONG *r,*a,*b;
r[7]=bn_mul_add_words(&(r[3]),a,4,b[3]);
}
-void bn_mul_comba8(r,a,b)
-BN_ULONG *r,*a,*b;
+void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
r[ 8]=bn_mul_words( &(r[0]),a,8,b[0]);
r[ 9]=bn_mul_add_words(&(r[1]),a,8,b[1]);
diff --git a/crypto/bn/bn_blind.c b/crypto/bn/bn_blind.c
index e9b39430e1..1b1bb06046 100644
--- a/crypto/bn/bn_blind.c
+++ b/crypto/bn/bn_blind.c
@@ -60,10 +60,7 @@
#include "cryptlib.h"
#include "bn_lcl.h"
-BN_BLINDING *BN_BLINDING_new(A,Ai,mod)
-BIGNUM *A;
-BIGNUM *Ai;
-BIGNUM *mod;
+BN_BLINDING *BN_BLINDING_new(BIGNUM *A, BIGNUM *Ai, BIGNUM *mod)
{
BN_BLINDING *ret=NULL;
@@ -87,8 +84,7 @@ err:
return(NULL);
}
-void BN_BLINDING_free(r)
-BN_BLINDING *r;
+void BN_BLINDING_free(BN_BLINDING *r)
{
if(r == NULL)
return;
@@ -98,9 +94,7 @@ BN_BLINDING *r;
Free(r);
}
-int BN_BLINDING_update(b,ctx)
-BN_BLINDING *b;
-BN_CTX *ctx;
+int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
{
int ret=0;
@@ -118,10 +112,7 @@ err:
return(ret);
}
-int BN_BLINDING_convert(n,b,ctx)
-BIGNUM *n;
-BN_BLINDING *b;
-BN_CTX *ctx;
+int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)
{
bn_check_top(n);
@@ -133,10 +124,7 @@ BN_CTX *ctx;
return(BN_mod_mul(n,n,b->A,b->mod,ctx));
}
-int BN_BLINDING_invert(n,b,ctx)
-BIGNUM *n;
-BN_BLINDING *b;
-BN_CTX *ctx;
+int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)
{
int ret;
diff --git a/crypto/bn/bn_comba.c b/crypto/bn/bn_comba.c
index 30357cf5fb..7ad09b4a6d 100644
--- a/crypto/bn/bn_comba.c
+++ b/crypto/bn/bn_comba.c
@@ -70,8 +70,7 @@ void bn_mul_comba44(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b);
void bn_sqr_comba88(BN_ULONG *r,BN_ULONG *a);
void bn_sqr_comba44(BN_ULONG *r,BN_ULONG *a);
-void bn_mul_comba88(r,a,b)
-BN_ULONG *r,*a,*b;
+void bn_mul_comba88(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
#ifdef BN_LLONG
BN_ULLONG t;
@@ -180,8 +179,7 @@ BN_ULONG *r,*a,*b;
r[15]=c1;
}
-void bn_mul_comba44(r,a,b)
-BN_ULONG *r,*a,*b;
+void bn_mul_comba44(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
#ifdef BN_LLONG
BN_ULLONG t;
@@ -226,8 +224,7 @@ BN_ULONG *r,*a,*b;
r[7]=c2;
}
-void bn_sqr_comba88(r,a)
-BN_ULONG *r,*a;
+void bn_sqr_comba88(BN_ULONG *r, BN_ULONG *a)
{
#ifdef BN_LLONG
BN_ULLONG t,tt;
@@ -308,8 +305,7 @@ BN_ULONG *r,*a;
r[15]=c1;
}
-void bn_sqr_comba44(r,a)
-BN_ULONG *r,*a;
+void bn_sqr_comba44(BN_ULONG *r, BN_ULONG *a)
{
#ifdef BN_LLONG
BN_ULLONG t,tt;
diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c
index c7bc04d0b4..bffa9f3e61 100644
--- a/crypto/bn/bn_div.c
+++ b/crypto/bn/bn_div.c
@@ -62,12 +62,7 @@
/* The old slow way */
#if 0
-int BN_div(dv, rem, m, d,ctx)
-BIGNUM *dv;
-BIGNUM *rem;
-BIGNUM *m;
-BIGNUM *d;
-BN_CTX *ctx;
+int BN_div(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx)
{
int i,nm,nd;
BIGNUM *D;
@@ -122,12 +117,8 @@ BN_CTX *ctx;
#else
-int BN_div(dv, rm, num, divisor,ctx)
-BIGNUM *dv;
-BIGNUM *rm;
-BIGNUM *num;
-BIGNUM *divisor;
-BN_CTX *ctx;
+int BN_div(BIGNUM *dv, BIGNUM *rm, BIGNUM *num, BIGNUM *divisor,
+ BN_CTX *ctx)
{
int norm_shift,i,j,loop;
BIGNUM *tmp,wnum,*snum,*sdiv,*res;
@@ -292,11 +283,7 @@ err:
#endif
/* rem != m */
-int BN_mod(rem, m, d,ctx)
-BIGNUM *rem;
-BIGNUM *m;
-BIGNUM *d;
-BN_CTX *ctx;
+int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx)
{
#if 0 /* The old slow way */
int i,nm,nd;
diff --git a/crypto/bn/bn_err.c b/crypto/bn/bn_err.c
index 626502a0e3..2041b018ea 100644
--- a/crypto/bn/bn_err.c
+++ b/crypto/bn/bn_err.c
@@ -98,7 +98,7 @@ static ERR_STRING_DATA BN_str_reasons[]=
#endif
-void ERR_load_BN_strings()
+void ERR_load_BN_strings(void)
{
static int init=1;
diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c
index cc4528247e..9833037384 100644
--- a/crypto/bn/bn_exp.c
+++ b/crypto/bn/bn_exp.c
@@ -63,12 +63,7 @@
#define TABLE_SIZE 16
/* slow but works */
-int BN_mod_mul(ret, a, b, m, ctx)
-BIGNUM *ret;
-BIGNUM *a;
-BIGNUM *b;
-BIGNUM *m;
-BN_CTX *ctx;
+int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, BIGNUM *m, BN_CTX *ctx)
{
BIGNUM *t;
int r=0;
@@ -91,9 +86,7 @@ err:
#if 0
/* this one works - simple but works */
-int BN_mod_exp(r,a,p,m,ctx)
-BIGNUM *r,*a,*p,*m;
-BN_CTX *ctx;
+int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m, BN_CTX *ctx)
{
int i,bits,ret=0;
BIGNUM *v,*tmp;
@@ -127,9 +120,7 @@ err:
#endif
/* this one works - simple but works */
-int BN_exp(r,a,p,ctx)
-BIGNUM *r,*a,*p;
-BN_CTX *ctx;
+int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx)
{
int i,bits,ret=0,tos;
BIGNUM *v,*rr;
@@ -163,12 +154,7 @@ err:
return(ret);
}
-int BN_mod_exp(r,a,p,m,ctx)
-BIGNUM *r;
-BIGNUM *a;
-BIGNUM *p;
-BIGNUM *m;
-BN_CTX *ctx;
+int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m, BN_CTX *ctx)
{
int ret;
@@ -197,12 +183,7 @@ BN_CTX *ctx;
}
/* #ifdef RECP_MUL_MOD */
-int BN_mod_exp_recp(r,a,p,m,ctx)
-BIGNUM *r;
-BIGNUM *a;
-BIGNUM *p;
-BIGNUM *m;
-BN_CTX *ctx;
+int BN_mod_exp_recp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m, BN_CTX *ctx)
{
int i,j,bits,ret=0,wstart,wend,window,wvalue;
int start=1,ts=0;
@@ -315,13 +296,8 @@ err:
/* #endif */
/* #ifdef MONT_MUL_MOD */
-int BN_mod_exp_mont(rr,a,p,m,ctx,in_mont)
-BIGNUM *rr;
-BIGNUM *a;
-BIGNUM *p;
-BIGNUM *m;
-BN_CTX *ctx;
-BN_MONT_CTX *in_mont;
+int BN_mod_exp_mont(BIGNUM *rr, BIGNUM *a, BIGNUM *p, BIGNUM *m, BN_CTX *ctx,
+ BN_MONT_CTX *in_mont)
{
int i,j,bits,ret=0,wstart,wend,window,wvalue;
int start=1,ts=0;
@@ -461,12 +437,8 @@ err:
/* #endif */
/* The old fallback, simple version :-) */
-int BN_mod_exp_simple(r,a,p,m,ctx)
-BIGNUM *r;
-BIGNUM *a;
-BIGNUM *p;
-BIGNUM *m;
-BN_CTX *ctx;
+int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,
+ BN_CTX *ctx)
{
int i,j,bits,ret=0,wstart,wend,window,wvalue,ts=0;
int start=1;
diff --git a/crypto/bn/bn_exp2.c b/crypto/bn/bn_exp2.c
index eface739b3..1132d53365 100644
--- a/crypto/bn/bn_exp2.c
+++ b/crypto/bn/bn_exp2.c
@@ -15,15 +15,8 @@
#define EXP2_TABLE_BITS 2 /* 1 2 3 4 5 */
#define EXP2_TABLE_SIZE 4 /* 2 4 8 16 32 */
-int BN_mod_exp2_mont(rr,a1,p1,a2,p2,m,ctx,in_mont)
-BIGNUM *rr;
-BIGNUM *a1;
-BIGNUM *p1;
-BIGNUM *a2;
-BIGNUM *p2;
-BIGNUM *m;
-BN_CTX *ctx;
-BN_MONT_CTX *in_mont;
+int BN_mod_exp2_mont(BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, BIGNUM *a2,
+ BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
{
int i,j,k,bits,bits1,bits2,ret=0,wstart,wend,window,xvalue,yvalue;
int start=1,ts=0,x,y;
diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c
index c80cecdc8d..833d2a8e40 100644
--- a/crypto/bn/bn_gcd.c
+++ b/crypto/bn/bn_gcd.c
@@ -66,9 +66,7 @@ static BIGNUM *euclid(BIGNUM *a, BIGNUM *b);
static BIGNUM *euclid();
#endif
-int BN_gcd(r,in_a,in_b,ctx)
-BIGNUM *r,*in_a,*in_b;
-BN_CTX *ctx;
+int BN_gcd(BIGNUM *r, BIGNUM *in_a, BIGNUM *in_b, BN_CTX *ctx)
{
BIGNUM *a,*b,*t;
int ret=0;
@@ -92,8 +90,7 @@ err:
return(ret);
}
-static BIGNUM *euclid(a,b)
-BIGNUM *a,*b;
+static BIGNUM *euclid(BIGNUM *a, BIGNUM *b)
{
BIGNUM *t;
int shifts=0;
@@ -148,11 +145,7 @@ err:
}
/* solves ax == 1 (mod n) */
-BIGNUM *BN_mod_inverse(in, a, n, ctx)
-BIGNUM *in;
-BIGNUM *a;
-BIGNUM *n;
-BN_CTX *ctx;
+BIGNUM *BN_mod_inverse(BIGNUM *in, BIGNUM *a, BIGNUM *n, BN_CTX *ctx)
{
BIGNUM *A,*B,*X,*Y,*M,*D,*R;
BIGNUM *T,*ret=NULL;
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index ed5a76d027..00693bc5c3 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -80,8 +80,7 @@ int bn_limit_num_high=8; /* (1<<bn_limit_bits_high) */
int bn_limit_bits_mont=0;
int bn_limit_num_mont=8; /* (1<<bn_limit_bits_mont) */
-void BN_set_params(mult,high,low,mont)
-int mult,high,low,mont;
+void BN_set_params(int mult, int high, int low, int mont)
{
if (mult >= 0)
{
@@ -113,8 +112,7 @@ int mult,high,low,mont;
}
}
-int BN_get_params(which)
-int which;
+int BN_get_params(int which)
{
if (which == 0) return(bn_limit_bits);
else if (which == 1) return(bn_limit_bits_high);
@@ -123,7 +121,7 @@ int which;
else return(0);
}
-BIGNUM *BN_value_one()
+BIGNUM *BN_value_one(void)
{
static BN_ULONG data_one=1L;
static BIGNUM const_one={&data_one,1,1,0};
@@ -131,7 +129,7 @@ BIGNUM *BN_value_one()
return(&const_one);
}
-char *BN_options()
+char *BN_options(void)
{
static int init=0;
static char data[16];
@@ -150,8 +148,7 @@ char *BN_options()
return(data);
}
-int BN_num_bits_word(l)
-BN_ULONG l;
+int BN_num_bits_word(BN_ULONG l)
{
static char bits[256]={
0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
@@ -238,8 +235,7 @@ BN_ULONG l;
}
}
-int BN_num_bits(a)
-BIGNUM *a;
+int BN_num_bits(BIGNUM *a)
{
BN_ULONG l;
int i;
@@ -259,8 +255,7 @@ BIGNUM *a;
return(i+BN_num_bits_word(l));
}
-void BN_clear_free(a)
-BIGNUM *a;
+void BN_clear_free(BIGNUM *a)
{
int i;
@@ -277,8 +272,7 @@ BIGNUM *a;
Free(a);
}
-void BN_free(a)
-BIGNUM *a;
+void BN_free(BIGNUM *a)
{
if (a == NULL) return;
if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA)))
@@ -288,13 +282,12 @@ BIGNUM *a;
Free(a);
}
-void BN_init(a)
-BIGNUM *a;
+void BN_init(BIGNUM *a)
{
memset(a,0,sizeof(BIGNUM));
}
-BIGNUM *BN_new()
+BIGNUM *BN_new(void)
{
BIGNUM *ret;
@@ -312,7 +305,7 @@ BIGNUM *BN_new()
}
-BN_CTX *BN_CTX_new()
+BN_CTX *BN_CTX_new(void)
{
BN_CTX *ret;
@@ -328,16 +321,14 @@ BN_CTX *BN_CTX_new()
return(ret);
}
-void BN_CTX_init(ctx)
-BN_CTX *ctx;
+void BN_CTX_init(BN_CTX *ctx)
{
memset(ctx,0,sizeof(BN_CTX));
ctx->tos=0;
ctx->flags=0;
}
-void BN_CTX_free(c)
-BN_CTX *c;
+void BN_CTX_free(BN_CTX *c)
{
int i;
@@ -350,9 +341,7 @@ BN_CTX *c;
Free(c);
}
-BIGNUM *bn_expand2(b, words)
-BIGNUM *b;
-int words;
+BIGNUM *bn_expand2(BIGNUM *b, int words)
{
BN_ULONG *A,*B,*a;
int i,j;
@@ -451,8 +440,7 @@ memset(A,0x5c,sizeof(BN_ULONG)*(words+1));
return(b);
}
-BIGNUM *BN_dup(a)
-BIGNUM *a;
+BIGNUM *BN_dup(BIGNUM *a)
{
BIGNUM *r;
@@ -463,9 +451,7 @@ BIGNUM *a;
return((BIGNUM *)BN_copy(r,a));
}
-BIGNUM *BN_copy(a, b)
-BIGNUM *a;
-BIGNUM *b;
+BIGNUM *BN_copy(BIGNUM *a, BIGNUM *b)
{
int i;
BN_ULONG *A,*B;
@@ -532,8 +518,7 @@ BIGNUM *b;
return(a);
}
-void BN_clear(a)
-BIGNUM *a;
+void BN_clear(BIGNUM *a)
{
if (a->d != NULL)
memset(a->d,0,a->max*sizeof(a->d[0]));
@@ -541,8 +526,7 @@ BIGNUM *a;
a->neg=0;
}
-BN_ULONG BN_get_word(a)
-BIGNUM *a;
+BN_ULONG BN_get_word(BIGNUM *a)
{
int i,n;
BN_ULONG ret=0;
@@ -561,9 +545,7 @@ BIGNUM *a;
return(ret);
}
-int BN_set_word(a,w)
-BIGNUM *a;
-BN_ULONG w;
+int BN_set_word(BIGNUM *a, BN_ULONG w)
{
int i,n;
if (bn_expand(a,sizeof(BN_ULONG)*8) == NULL) return(0);
@@ -589,10 +571,7 @@ BN_ULONG w;
}
/* ignore negative */
-BIGNUM *BN_bin2bn(s, len, ret)
-unsigned char *s;
-int len;
-BIGNUM *ret;
+BIGNUM *BN_bin2bn(unsigned char *s, int len, BIGNUM *ret)
{
unsigned int i,m;
unsigned int n;
@@ -629,9 +608,7 @@ BIGNUM *ret;
}
/* ignore negative */
-int BN_bn2bin(a, to)
-BIGNUM *a;
-unsigned char *to;
+int BN_bn2bin(BIGNUM *a, unsigned char *to)
{
int n,i;
BN_ULONG l;
@@ -645,9 +622,7 @@ unsigned char *to;
return(n);
}
-int BN_ucmp(a, b)
-BIGNUM *a;
-BIGNUM *b;
+int BN_ucmp(BIGNUM *a, BIGNUM *b)
{
int i;
BN_ULONG t1,t2,*ap,*bp;
@@ -669,9 +644,7 @@ BIGNUM *b;
return(0);
}
-int BN_cmp(a, b)
-BIGNUM *a;
-BIGNUM *b;
+int BN_cmp(BIGNUM *a, BIGNUM *b)
{
int i;
int gt,lt;
@@ -712,9 +685,7 @@ BIGNUM *b;
return(0);
}
-int BN_set_bit(a, n)
-BIGNUM *a;
-int n;
+int BN_set_bit(BIGNUM *a, int n)
{
int i,j,k;
@@ -732,9 +703,7 @@ int n;
return(1);
}
-int BN_clear_bit(a, n)
-BIGNUM *a;
-int n;
+int BN_clear_bit(BIGNUM *a, int n)
{
int i,j;
@@ -747,9 +716,7 @@ int n;
return(1);
}
-int BN_is_bit_set(a, n)
-BIGNUM *a;
-int n;
+int BN_is_bit_set(BIGNUM *a, int n)
{
int i,j;
@@ -760,9 +727,7 @@ int n;
return((a->d[i]&(((BN_ULONG)1)<<j))?1:0);
}
-int BN_mask_bits(a,n)
-BIGNUM *a;
-int n;
+int BN_mask_bits(BIGNUM *a, int n)
{
int b,w;
@@ -780,9 +745,7 @@ int n;
return(1);
}
-int bn_cmp_words(a,b,n)
-BN_ULONG *a,*b;
-int n;
+int bn_cmp_words(BN_ULONG *a, BN_ULONG *b, int n)
{
int i;
BN_ULONG aa,bb;
diff --git a/crypto/bn/bn_m.c b/crypto/bn/bn_m.c
index 5166daaeec..555514074c 100644
--- a/crypto/bn/bn_m.c
+++ b/crypto/bn/bn_m.c
@@ -70,8 +70,7 @@ typedef struct bn_pool_st
STACK *sk;
} BN_POOL;
-BIGNUM *BN_POOL_push(bp)
-BN_POOL *bp;
+BIGNUM *BN_POOL_push(BN_POOL *bp)
{
BIGNUM *ret;
@@ -90,15 +89,12 @@ BN_POOL *bp;
return(ret);
}
-void BN_POOL_pop(bp,num)
-BN_POOL *bp;
-int num;
+void BN_POOL_pop(BN_POOL *bp, int num)
{
bp->used-=num;
}
-int BN_m(r,a,b)
-BIGNUM *r,*a,*b;
+int BN_m(BIGNUM *r, BIGNUM *a, BIGNUM *b)
{
static BN_POOL bp;
static init=1;
@@ -114,9 +110,7 @@ BIGNUM *r,*a,*b;
}
/* r must be different to a and b */
-int BN_mm(m, A, B, bp)
-BIGNUM *m,*A,*B;
-BN_POOL *bp;
+int BN_mm(BIGNUM *m, BIGNUM *A, BIGNUM *B, BN_POOL *bp)
{
int i,num;
int an,bn;
diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c
index 4ed433e05c..5bdac17e6c 100644
--- a/crypto/bn/bn_mont.c
+++ b/crypto/bn/bn_mont.c
@@ -68,10 +68,8 @@
#define MONT_WORD
-int BN_mod_mul_montgomery(r,a,b,mont,ctx)
-BIGNUM *r,*a,*b;
-BN_MONT_CTX *mont;
-BN_CTX *ctx;
+int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_MONT_CTX *mont,
+ BN_CTX *ctx)
{
BIGNUM *tmp,*tmp2;
@@ -107,11 +105,8 @@ err:
return(0);
}
-int BN_from_montgomery(ret,a,mont,ctx)
-BIGNUM *ret;
-BIGNUM *a;
-BN_MONT_CTX *mont;
-BN_CTX *ctx;
+int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont,
+ BN_CTX *ctx)
{
#ifdef BN_RECURSION_MONT
if (mont->use_word)
@@ -269,7 +264,7 @@ printf("number BN_from_montgomery\n");
#endif
}
-BN_MONT_CTX *BN_MONT_CTX_new()
+BN_MONT_CTX *BN_MONT_CTX_new(void)
{
BN_MONT_CTX *ret;
@@ -281,8 +276,7 @@ BN_MONT_CTX *BN_MONT_CTX_new()
return(ret);
}
-void BN_MONT_CTX_init(ctx)
-BN_MONT_CTX *ctx;
+void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
{
ctx->use_word=0;
ctx->ri=0;
@@ -292,8 +286,7 @@ BN_MONT_CTX *ctx;
ctx->flags=0;
}
-void BN_MONT_CTX_free(mont)
-BN_MONT_CTX *mont;
+void BN_MONT_CTX_free(BN_MONT_CTX *mont)
{
if(mont == NULL)
return;
@@ -305,10 +298,7 @@ BN_MONT_CTX *mont;
Free(mont);
}
-int BN_MONT_CTX_set(mont,mod,ctx)
-BN_MONT_CTX *mont;
-BIGNUM *mod;
-BN_CTX *ctx;
+int BN_MONT_CTX_set(BN_MONT_CTX *mont, BIGNUM *mod, BN_CTX *ctx)
{
BIGNUM Ri,*R;
@@ -402,8 +392,7 @@ err:
return(0);
}
-BN_MONT_CTX *BN_MONT_CTX_copy(to, from)
-BN_MONT_CTX *to, *from;
+BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
{
if (to == from) return(to);
diff --git a/crypto/bn/bn_mpi.c b/crypto/bn/bn_mpi.c
index 84b0317081..5d786d7b15 100644
--- a/crypto/bn/bn_mpi.c
+++ b/crypto/bn/bn_mpi.c
@@ -60,9 +60,7 @@
#include "cryptlib.h"
#include "bn_lcl.h"
-int BN_bn2mpi(a,d)
-BIGNUM *a;
-unsigned char *d;
+int BN_bn2mpi(BIGNUM *a, unsigned char *d)
{
int bits;
int num=0;
@@ -90,10 +88,7 @@ unsigned char *d;
return(num+4+ext);
}
-BIGNUM *BN_mpi2bn(d,n,a)
-unsigned char *d;
-int n;
-BIGNUM *a;
+BIGNUM *BN_mpi2bn(unsigned char *d, int n, BIGNUM *a)
{
long len;
int neg=0;
diff --git a/crypto/bn/bn_mul.c b/crypto/bn/bn_mul.c
index 0