bn: fix occurances of negative zero
[openssl.git] / crypto / bn / bn_div.c
index 99abf35c418f48164884770f5e33ac9bb4c9884f..5e620b2096ca0366fa0e2e4b9d4ca9964a05a3b5 100644 (file)
@@ -254,9 +254,9 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
     wnump = &(snum->d[num_n - 1]);
 
     /* Setup to 'res' */
-    res->neg = (num->neg ^ divisor->neg);
     if (!bn_wexpand(res, (loop + 1)))
         goto err;
+    res->neg = (num->neg ^ divisor->neg);
     res->top = loop - no_branch;
     resp = &(res->d[loop - 1]);