A few more files to ignore
[openssl.git] / crypto / bn / bn_sqr.c
index bbff1ad72af28c0cac922e394b24ed224495a101..c1d0cca438dc4358218386490a1e543bef2592c9 100644 (file)
@@ -66,7 +66,7 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
        {
        int max,al;
        int ret = 0;
-       BIGNUM *tmp,*rr,*free_a = NULL;
+       BIGNUM *tmp,*rr;
 
 #ifdef BN_COUNT
        fprintf(stderr,"BN_sqr %d * %d\n",a->top,a->top);
@@ -88,7 +88,6 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
        max=(al+al);
        if (bn_wexpand(rr,max+1) == NULL) goto err;
 
-       r->neg=0;
        if (al == 4)
                {
 #ifndef BN_SQR_COMBA
@@ -140,11 +139,11 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
                }
 
        rr->top=max;
+       rr->neg=0;
        if ((max > 0) && (rr->d[max-1] == 0)) rr->top--;
        if (rr != r) BN_copy(r,rr);
        ret = 1;
  err:
-       if (free_a) BN_free(free_a);
        BN_CTX_end(ctx);
        return(ret);
        }
@@ -246,7 +245,7 @@ void bn_sqr_recursive(BN_ULONG *r, const BN_ULONG *a, int n2, BN_ULONG *t)
        if (!zero)
                bn_sqr_recursive(&(t[n2]),t,n,p);
        else
-               memset(&(t[n2]),0,n*sizeof(BN_ULONG));
+               memset(&(t[n2]),0,n2*sizeof(BN_ULONG));
        bn_sqr_recursive(r,a,n,p);
        bn_sqr_recursive(&(r[n2]),&(a[n]),n,p);