New functions BN_CTX_start(), BN_CTX_get(), BN_CTX_end() to access
[openssl.git] / crypto / bn / old / bn_wmul.c
index e3ce10792198eac39b8913a523b2ac57278515de..3b484adf70ca852248bbe23f323addbc32ec04ee 100644 (file)
@@ -5,9 +5,7 @@
 
 int bn_mull(BIGNUM *r,BIGNUM *a,BIGNUM *b, BN_CTX *ctx);
 
-int bn_mull(r,a,b,ctx)
-BIGNUM *r,*a,*b;
-BN_CTX *ctx;
+int bn_mull(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
        {
        int top,i,j,k,al,bl;
        BIGNUM *t;
@@ -19,6 +17,7 @@ printf("bn_mull %d * %d\n",a->top,b->top);
        bn_check_top(a);
        bn_check_top(b);
        bn_check_top(r);
+       BN_CTX_start(ctx);
 
        al=a->top;
        bl=b->top;
@@ -87,7 +86,7 @@ symetric:
                j=BN_num_bits_word((BN_ULONG)al);
                j=1<<(j-1);
                k=j+j;
-               t= &(ctx->bn[ctx->tos]);
+               t = BN_CTX_get(ctx);
                if (al == j) /* exact multiple */
                        {
                        bn_wexpand(t,k*2);
@@ -109,16 +108,13 @@ symetric:
                r->top=top;
                }
 end:
+       BN_CTX_end(ctx);
        bn_fix_top(r);
        return(1);
        }
 #endif
 
-void bn_mul_normal(r,a,na,b,nb)
-BN_ULONG *r,*a;
-int na;
-BN_ULONG *b;
-int nb;
+void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
        {
        BN_ULONG *rr;
 
@@ -155,9 +151,7 @@ printf(" bn_mul_normal %d * %d\n",na,nb);
        }
 
 #if 1
-void bn_mul_low_normal(r,a,b,n)
-BN_ULONG *r,*a,*b;
-int n;
+void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
        {
 #ifdef BN_COUNT
 printf(" bn_mul_low_normal %d * %d\n",n,n);