Apply "better safe than sorry" approach after addressing sporadic SEGV in
[oweals/openssl.git] / crypto / bn / bn_div.c
index 556fcda1e3686d88745550a8099b501ed81be154..2857f44861a702bfc85e380e99db562a7c07ec13 100644 (file)
@@ -185,10 +185,8 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
        BN_ULONG d0,d1;
        int num_n,div_n;
 
-       if (dv)
-               bn_check_top(dv);
-       if (rm)
-               bn_check_top(rm);
+       bn_check_top(dv);
+       bn_check_top(rm);
        bn_check_top(num);
        bn_check_top(divisor);
 
@@ -214,7 +212,6 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
                res=BN_CTX_get(ctx);
        else    res=dv;
        if (sdiv == NULL || res == NULL) goto err;
-       tmp->neg=0;
 
        /* First we normalise the numbers */
        norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2);
@@ -395,8 +392,7 @@ X) -> 0x%08X\n",
        BN_CTX_end(ctx);
        return(1);
 err:
-       if (rm)
-               bn_check_top(rm);
+       bn_check_top(rm);
        BN_CTX_end(ctx);
        return(0);
        }